Submitting software patches

Scott Harrison, last updated 05/19/2001

The system works, yet there remains much tweaking to do.

General Guidelines

  1. submit patches to albertel@msu.edu
  2. patches must be a unified diff format (-u)
  3. should be against a specific CVS tag (like HEAD, or when we get to releases, the most recent *_RELEASE tag)
  4. should contain a description of bugs they fix or functionality they add
  5. try to make each patch as _targetted_ as possible. (Fix 1 bug, or add 1 feature) to make it easier to see what is going on.
  6. Large functionality changes should probably get some discussion on the mailing list before being submitted.

Example Scenario

Large functionality changes should probably get some discussion on the mailing list before being submitted.

A fictional Dr. Sherbert is writing a handler to display web statistics (information present in /var/log/httpd/access.log). Here is a list of e-mails and commands which take place.

Dr. Sherbert e-mails the list with his idea

sherbert %> mail lon-capa@hobbes.lite.msu.edu
Hi,

I want to create a handler to show web statistics (hits
per hour, IP addresses, most popular URLs, hits per day,
etc).  This would provide data I can show the
administration as well as helping me better monitor
how adequately my server cluster is performing.
I plan on calling this handler lonapachestat.pm, associating
with apachestat, and available only to those with roles (see
roles.tab and rolesplain.tab) of "gan=generating anonymous
statistics".  I would make appropriate changes to
/etc/httpd/conf/srm.conf

-Bert

Two others respond on the mailing list.

gwynne %> mail lon-capa@hobbes.lite.msu.edu
Bert,

I like that idea, but don't you think that this is
better handled as a batch-cron job?  Why not have
these statistics compiled every day?  I think
SOURCE="loncom/cron/loncapa" TARGET="etc/cron.d/loncapa"
handles this.  Also, I assume you mean associating
with the location http://MACHINENAME/adm/lonapachestat.

Gwynne


godfried %> mail lon-capa@hobbes.lite.msu.edu
Bert,

This would be of immense help to some questions I have.
I want to be able to "play-back" what each user session
is doing for my course.  Also, if a student e-mails me,
I want to be able to see where in the course sequence
the student was working.  I would need the statistics calculated
dynamically as opposed to a batch process.

Godfried

After more discussion, Dr. Sherbert's idea is accepted.

 

PATCHING /etc/httpd/conf/srm.conf

submit patches to albertel@msu.edu
patches must be a unified diff format (-u)
should be against a specific CVS tag (like HEAD, or when we get to releases, the most recent *_RELEASE tag)
should contain a description of bugs they fix or functionality they add
try to make each patch as _targetted_ as possible. (Fix 1 bug, or add 1 feature) to make it easier to see what is going on.

Dr. Sherbert wants to alter the web server configuration so that whenever http://MACHINENAME/apachestat is requested, the lonapachestat.pm handler is called.

To do this, he needs to alter srm.conf. After setting up CVS and checking out LON-CAPA (cvs co loncapa), he needs to find srm.conf in the CVS source repository.

[sherbert@morphy1 loncapa]$ find . -type f | grep srm.conf
./loncom/srm.conf
[sherbert@morphy1 loncapa]$ 

Dr. Sherbert sees the following section of code in srm.conf.

# -------------------------------------------------------------- Admin Programs

<Location /adm/roles>
PerlAccessHandler       Apache::lonacc
SetHandler perl-script
PerlHandler Apache::lonroles
ErrorDocument     403 /adm/login
ErrorDocument	  500 /adm/errorhandler
</Location>

<Location /adm/login>
SetHandler perl-script
PerlHandler Apache::lonlogin
</Location>

<Location /adm/logout>
PerlAccessHandler       Apache::lonacc
SetHandler perl-script
PerlHandler Apache::lonlogout
ErrorDocument     403 /adm/login
</Location>

Dr. Sherbert then adds in his handler.

# -------------------------------------------------------------- Admin Programs

<Location /adm/apachestat>
PerlAccessHandler       Apache::lonacc
SetHandler perl-script
PerlHandler Apache::lonapachestat
ErrorDocument     403 /adm/login
ErrorDocument	  500 /adm/errorhandler
</Location>

<Location /adm/roles>
PerlAccessHandler       Apache::lonacc
SetHandler perl-script
PerlHandler Apache::lonroles
ErrorDocument     403 /adm/login
ErrorDocument	  500 /adm/errorhandler
</Location>

<Location /adm/login>
SetHandler perl-script
PerlHandler Apache::lonlogin
</Location>

<Location /adm/logout>
PerlAccessHandler       Apache::lonacc
SetHandler perl-script
PerlHandler Apache::lonlogout
ErrorDocument     403 /adm/login
</Location>

Dr. Sherbert then creates a unified diff format of his changes against the HEAD (current) release.

[sherbert@morphy1]$ cd loncapa/loncom
[sherbert@morphy1]$ cvs diff -U 3 -r HEAD srm.conf
Index: srm.conf
===================================================================
RCS file: /home/cvs/loncom/srm.conf,v
retrieving revision 1.14
diff -U3 -r1.14 srm.conf
--- srm.conf	2001/05/15 12:35:07	1.14
+++ srm.conf	2001/05/19 13:14:53
@@ -353,6 +353,14 @@
 
 # -------------------------------------------------------------- Admin Programs 
+
+PerlAccessHandler       Apache::lonacc
+SetHandler perl-script
+PerlHandler Apache::lonapachestat
+ErrorDocument     403 /adm/login
+ErrorDocument	  500 /adm/errorhandler
+
+
 
 PerlAccessHandler       Apache::lonacc
 SetHandler perl-script

Dr. Sherbert e-mails his patch to Guy.

[sherbert@morphy1]$ cvs diff -U 3 -r HEAD srm.conf | mail -s 'patch to\
 srm.conf to add adm/apachestat handling with lonapachestat.pm'\
albertel@msu.edu

Guy responds

Bert,

Your change was checked into the LON-CAPA system.  Thanks!

-Guy

Dr. Sherbert did the following right things.
  • he described the fix in his mail message
    patch to srm.conf to add adm/apachestat handling with lonapachestat.pm
  • his submitted change fixed 1 bug/feature
  • he created a unified diff format for his patch