[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
loginfo - 1.11.1p1 runs differently with %{sVv}
From: |
Dale Miller |
Subject: |
loginfo - 1.11.1p1 runs differently with %{sVv} |
Date: |
Wed, 27 Jun 2001 13:49:27 -0500 |
I have been using CVS v1.11 on our DEC alpha.
'uname -a' = OSF1 cmp V4.0 878 alpha
I downloaded it in June 2000, did the ./configure, make, make install
without any modifications.
I recently downloaded CVS v1.11.1p1 to the same platform.
And did the same installation procedures and then did some testing.
I discovered changes in the way one of my perl programs was working that
was called by loginfo.
I then did the make install of v1.11 again to fall back to it.
Since then I rebuilt v1.11.1p1 using "./configure
--prefix=/sdhs_mnt3/test_cvs"
so that I had a test environment and could compare v1.11 to v1.11.1p1
The example shown in "loginfo" gives the same results for v1.11 and
v1.11.1p1.
------------------------------------------------------------------
Entry from "loginfo" with example when using CVS v1.11
cvs_testing (echo ""; id; echo %{sVv}; date; cat)
cvs commit -m"SCR99999999" cvs_testing/testfile1
Checking in cvs_testing/testfile1;
/sdhs_mnt2/cvsroot/cvs_testing/testfile1,v <-- testfile1
new revision: 1.3; previous revision: 1.2
done
uid=137 (miller) gid=137(miller)
groups=0(system),1009(CM),6002(cvsadmin)
cvs_testing testfile1,1.2,1.3
Mon Jun 25 19:10:02 GMT 2001
Update of /sdhs_mnt2/cvsroot/cvs_testing
In directory cmp:/home/miller/cvs_stage/cvs_testing
Modified Files:
testfile1
Log Message:
SCR99999999
------------------------------------------------------------------
However, I found that "loginfo" entries gives different results when
using "%{sVs}"
I have a filter program written in perl that I call from "loginfo" using
a loginfo entry in the format of:
module filter_program -logfile=/path/commitlog -user=$USER
-fileinfo="%{sVv}"
This format works with v1.11 but not with v1.11.1p1
I have discovered that if I remove the double quotes from "%{sVv}" it
will work with both version.
module filter_program -logfile=/path/commitlog -user=$USER
-fileinfo=%{sVv}
Since %{sVv} returns "path file,oldversion,newversion" with the embedded
space it made sense to use the quotes.
The rest of this message contains a copy of the filter_program that I am
using (with DEBUG statements added and the writting to a logfile being
commented out). I then used the same filter_program on both v1.11 and
v1.11.1p1 using "%{sVv}" and %{sVv} with the results shown below.
The NEWS file in the release does not mention any changes of this
nature. In my case this has a major impact because I use information in
the commit.log that I create to show what SCR (system change request)
was being used for each file that is changed. With the double quotes
around %s{sVv} my logs miss the SCRnumber and the filename.
DETAILS FOLLOW--
First the filter program with DEBUGS added and logfile commented out:
---------------------------------------------------------------
#!/usr/local/bin/perl -s
# cvs-log_SCR_test Dale Miller
#
# $Id: cvs-log_SCR,v 1.2 2000/09/06 22:04:00 miller Exp $
#
# This program is called by $CVSROOT/CVSROOT/loginfo
# and is used to write log entries that include the SCRnumber
# that was verified by verifymsg_SCR
#
$logfile = "/tmp/cvs.log" unless defined $logfile;
$user = "user" unless defined $user;
$fileinfo = "fileinfo" unless defined $fileinfo;
# current date and time
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
gmtime(time);
$date = sprintf("%4d%02d%02s-%02d:%02d", ($year + 1900), ($mon + 1),
$mday, $hour, $min);
print "DEBUG0: @ARGV\n";
print "DEBUG1: $fileinfo\n";
$fileinfo =~ s/^'(.*)'$/$1/; # remove surrounding quote
@extra = (<>); # this data is supplied by CVS as stdin to this program
print "DEBUG2: @extra\n";
foreach (@extra) { # scan through the data and get the SCR
number
print "DEBUG3: $_\n";
if (/(^SCR\d{8})/) {
$scr=substr($_, 0, 11);
last;
}
}
$scr = "SCR" unless defined $scr;
#open(LOGFILE, ">>$logfile") or die "Cannot append to $logfile: $!\n";
#print LOGFILE "$date $scr $user $fileinfo\n";
print "$date $scr $user $fileinfo\n";
#close(LOGFILE);
--------------------------------------------------------------------
Sample runs follow:
CVS v1.11 with -fileinfo="%{sVv}" works.
Notice DEBUG1 and the single quotes.
--------------------------------------------------------------------
Entry from "loginfo" with example when using CVS v1.11
cvs_testing $CVSROOT/CVSROOT/cvs-log_SCR_test -logfile=/tmp/commit.log
-user=$USER -fileinfo="%{sVv}"
cvs commit -m"SCR99999999" cvs_testing/testfile1
Checking in cvs_testing/testfile1;
/sdhs_mnt2/cvsroot/cvs_testing/testfile1,v <-- testfile1
new revision: 1.6; previous revision: 1.5
done
DEBUG0:
DEBUG1: 'cvs_testing testfile1,1.5,1.6'
DEBUG2: Update of /sdhs_mnt2/cvsroot/cvs_testing
In directory cmp:/home/miller/cvs_stage/cvs_testing
Modified Files:
testfile1
Log Message:
SCR99999999
DEBUG3: Update of /sdhs_mnt2/cvsroot/cvs_testing
DEBUG3: In directory cmp:/home/miller/cvs_stage/cvs_testing
DEBUG3:
DEBUG3: Modified Files:
DEBUG3: testfile1
DEBUG3: Log Message:
DEBUG3: SCR99999999
20010625-19:23 SCR99999999 miller cvs_testing testfile1,1.5,1.6
------------------------------------------------------------------
CVS v1.11 with -fileinfo=%{sVv} works.
Notice DEBUG1 and the absence of the single quotes.
------------------------------------------------------------------
Entry from "loginfo" with example when using CVS v1.11
cvs_testing $CVSROOT/CVSROOT/cvs-log_SCR_test -logfile=/tmp/commit.log
-user=$USER -fileinfo=%{sVv}
cvs commit -m"SCR99999999" cvs_testing/testfile1
Checking in cvs_testing/testfile1;
/sdhs_mnt2/cvsroot/cvs_testing/testfile1,v <-- testfile1
new revision: 1.9; previous revision: 1.8
done
DEBUG0:
DEBUG1: cvs_testing testfile1,1.8,1.9
DEBUG2: Update of /sdhs_mnt2/cvsroot/cvs_testing
In directory cmp:/home/miller/cvs_stage/cvs_testing
Modified Files:
testfile1
Log Message:
SCR99999999
DEBUG3: Update of /sdhs_mnt2/cvsroot/cvs_testing
DEBUG3: In directory cmp:/home/miller/cvs_stage/cvs_testing
DEBUG3:
DEBUG3: Modified Files:
DEBUG3: testfile1
DEBUG3: Log Message:
DEBUG3: SCR99999999
20010625-21:59 SCR99999999 miller cvs_testing testfile1,1.8,1.9
--------------------------------------------------------------------------
------------------------------------------------------------------
CVS v1.11.1p1 with -fileinfo="%{sVv}" fails.
Notice DEBUG0 and DEBUG1. DEBUG0 is the @ARGV and DEBUG1 is only the
module name.
------------------------------------------------------------------
Entry from "loginfo" with example when using CVS v1.11.1p1
ALL $CVSROOT/CVSROOT/cvs-log_SCR_test
-logfile=/home/miller/cvs_test/commit.log -user=$USER -fileinfo="%{sVv}"
cvs commit -m"SCR99999999" alpha/testit
Checking in alpha/testit;
/sdhs_mnt3/test_cvsroot/alpha/testit,v <-- testit
new revision: 1.11; previous revision: 1.10
done
DEBUG0: testit,1.10,1.11
DEBUG1: alpha
Can't open testit,1.10,1.11: No such file or directory
DEBUG2:
20010625-19:06 SCR miller alpha
---------------------------------------------------------------------------
CVS v1.11.1p1 with -fileinfo=%{sVv} works.
Entry from "loginfo" with example when using CVS v1.11.1p1
ALL $CVSROOT/CVSROOT/cvs-log_SCR_test
-logfile=/home/miller/cvs_test/commit.log -user=$USER -fileinfo=%{sVv}
cvs commit -m"SCR12345678" alpha/testit
Checking in alpha/testit;
/sdhs_mnt3/test_cvsroot/alpha/testit,v <-- testit
new revision: 1.22; previous revision: 1.21
done
DEBUG0:
DEBUG1: alpha testit,1.21,1.22
DEBUG2: Update of /sdhs_mnt3/test_cvsroot/alpha
In directory cmp:/home/miller/cvs_test/alpha
Modified Files:
testit
Log Message:
SCR12345678
DEBUG3: Update of /sdhs_mnt3/test_cvsroot/alpha
DEBUG3: In directory cmp:/home/miller/cvs_test/alpha
DEBUG3:
DEBUG3: Modified Files:
DEBUG3: testit
DEBUG3: Log Message:
DEBUG3: SCR12345678
20010625-20:37 SCR12345678 miller alpha testit,1.21,1.22
--------------------------------------------------------------------------
Bottom line is that I remove the double quotes because it works with
v1.11 and v1.11.1p1
Other people may run into this problem and should be aware that it
exist.
--------------------------------------------------------------------------
It may have been because of changes to logmsg.c
diff cvs-1.11/src/logmsg.c cvs-1.11.1p1/src/logmsg.c
193d192
<
194a194,196
> /* FIXME - It's possible we should be relying on cvs_temp_file to
open
> * the file here - we get race conditions otherwise.
> */
208,209d209
< else
< (void) fprintf (fp, "\n");
275c275
< if (client_active)
---
> if (current_parsed_root->isremote)
399c399
< if (client_active)
---
> if (current_parsed_root->isremote)
417c417
< /* Get a temp filename, open a temporary file, write the message
to the
---
> /* open a temporary file, write the message to the
420,423c420
< fname = cvs_temp_name ();
<
< fp = fopen (fname, "w");
< if (fp == NULL)
---
> if ((fp = cvs_temp_file (&fname)) == NULL)
795,796c792,793
< prog = xmalloc ((fmt_percent - filter) + strlen (srepos)
< + strlen (str_list) + strlen (fmt_continue)
---
> prog = cp = xmalloc ((fmt_percent - filter) + 2 * strlen
(srepos)
> + 2 * strlen (str_list) + strlen (fmt_continue)
798,804c795,801
< (void) strncpy (prog, filter, fmt_percent - filter);
< prog[fmt_percent - filter] = '\0';
< (void) strcat (prog, "'");
< (void) strcat (prog, srepos);
< (void) strcat (prog, str_list);
< (void) strcat (prog, "'");
< (void) strcat (prog, fmt_continue);
---
> (void) memcpy (cp, filter, fmt_percent - filter);
> cp += fmt_percent - filter;
> *cp++ = '"';
> cp = shell_escape (cp, srepos);
> cp = shell_escape (cp, str_list);
> *cp++ = '"';
> (void) strcpy (cp, fmt_continue);
Thank you,
Dale Miller
- loginfo - 1.11.1p1 runs differently with %{sVv},
Dale Miller <=