OSSP CVS Repository

ossp - Check-in [4945]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 4945
Date: 2005-Jan-12 21:42:46 (local)
2005-Jan-12 20:42:46 (UTC)
User:rse
Branch:
Comment: 1. Fix internal error handling by replacing "|| die" with "or die" constructs because the different binding priority of "||" and "or" leaded to wrong results.

2. Fix shiela-install.pod's description of --loginfo hook for the non-RSE-patches situation: the %p construct has to be used there, too.

Tickets:
Inspections:
Files:
ossp-pkg/shiela/ChangeLog      1.52 -> 1.53     11 inserted, 1 deleted
ossp-pkg/shiela/shiela-install.pod      1.24 -> 1.25     1 inserted, 1 deleted
ossp-pkg/shiela/shiela.pl      1.66 -> 1.67     32 inserted, 32 deleted

ossp-pkg/shiela/ChangeLog 1.52 -> 1.53

--- ChangeLog    2004/08/11 16:50:39     1.52
+++ ChangeLog    2005/01/12 20:42:46     1.53
@@ -9,7 +9,17 @@
 
   ChangeLog
 
-  Changes between 1.1.4 and 1.1.5 (02-Jul-2004 to 11-Aug-2004):
+  Changes between 1.1.4 and 1.1.5 (02-Jul-2004 to 12-Jan-2005):
+
+   *) Fix internal error handling by replacing "|| die" with "or die"
+      constructs because the different binding priority of "||" and "or"
+      leaded to wrong results.
+      [Ralf S. Engelschall, Geoff Thorpe <geoff@geoffthorpe.net>]
+
+   *) Fix shiela-install.pod's description of --loginfo hook for the
+      non-RSE-patches situation: the %p construct has to be used
+      there, too.
+      [Geoff Thorpe <geoff@geoffthorpe.net>]
 
    *) Workaround a buggy feature in Perl versions 5.8.4 and higher
       which totally optimized away "my $var = undef;" constructs


ossp-pkg/shiela/shiela-install.pod 1.24 -> 1.25

--- shiela-install.pod   2004/07/02 19:19:33     1.24
+++ shiela-install.pod   2005/01/12 20:42:46     1.25
@@ -121,7 +121,7 @@
 ``C<ALL $CVSROOT/CVSROOT/shiela --hook=loginfo %p %{sVvto}>''.
 This requires that you use a CVS version with RSE patches
 applied (see below). If you use a stock CVS version, use ``C<ALL
-$CVSROOT/CVSROOT/shiela --hook=loginfo %{sVv}>'' instead and live with
+$CVSROOT/CVSROOT/shiela --hook=loginfo %p %{sVv}>'' instead and live with
 the fact that B<OSSP shiela>'s run-time efficiency is slightly decreased
 and branch recognition might be less correct (because B<OSSP shiela> has
 to determine details the hard way which CVS already would know easily).


ossp-pkg/shiela/shiela.pl 1.66 -> 1.67

--- shiela.pl    2004/08/11 16:50:39     1.66
+++ shiela.pl    2005/01/12 20:42:46     1.67
@@ -127,8 +127,8 @@
     $RT->{pgrp} = getpgrp();
 
     #   supplied arguments
-    $RT->{cvsroot} = $ENV{CVSROOT} || die 'unknown CVS root (set $CVSROOT variable)';
-    $RT->{userid}  = $ENV{CVSUSER} || $ENV{LOGNAME} || $ENV{LOGUSER} || $ENV{USER} || die 'unknown CVS user';
+    $RT->{cvsroot} = $ENV{CVSROOT} or die 'unknown CVS root (set $CVSROOT variable)';
+    $RT->{userid}  = ($ENV{CVSUSER} || $ENV{LOGNAME} || $ENV{LOGUSER} || $ENV{USER}) or die 'unknown CVS user';
 
     #   various directory paths
     $RT->{tmpdir}    = $ENV{TMPDIR} || $ENV{TEMPDIR} || '/tmp';
@@ -379,7 +379,7 @@
 
     #   read configuration file
     my $io = new IO::File "<$file"
-        || die "unable to open configuration file `$file'";
+        or die "unable to open configuration file `$file'";
     my $t = '';
     $t .= $_ while (<$io>);
     $io->close;
@@ -567,8 +567,8 @@
 sub new {
     my $proto = shift;
     my $class = ref($proto) || $proto;
-    my $program = shift || "cvs";
-    my $cvsroot = shift || $ENV{CVSROOT} || die "unknown CVSROOT";
+    my $program = (shift || "cvs");
+    my $cvsroot = (shift || $ENV{CVSROOT}) or die "unknown CVSROOT";
     my $trace = shift || 0;
 
     #   spawn a CVS server process and establish a
@@ -581,7 +581,7 @@
     $cvs->{rfd} = new IO::Handle;
     $cvs->{wfd} = new IO::Handle;
     $cvs->{pid} = IPC::Open2::open2($cvs->{rfd}, $cvs->{wfd}, "$program -f -Q -n server")
-        || die "cannot spawn CVS server process `$program server'";
+        or die "cannot spawn CVS server process `$program server'";
     print STDERR "cvs server: spawned (pid $cvs->{pid})\n" if ($trace);
     bless ($cvs, $class);
 
@@ -822,7 +822,7 @@
     #   append to or override a file with lines from an array
     if ($op eq 'append' or $op eq 'write') {
         my $io = new IO::File ($op eq 'append' ? ">>$file" : ">$file")
-            || die "unable to open `$file' for operation `$op'";
+            or die "unable to open `$file' for operation `$op'";
         foreach my $line (@lines) {
             $line =~ s|\n+$||s;
             $io->print($prefix . $line . "\n");
@@ -833,7 +833,7 @@
     elsif ($op eq 'read') {
         my @text = ();
         my $io = new IO::File "<$file"
-            || die "unable to open `$file' for $op";
+            or die "unable to open `$file' for $op";
         while (<$io>) {
             s|\n$||s;
             push(@text, $prefix . $_);
@@ -871,7 +871,7 @@
         $O .= "\n";
     }
     my $io = new IO::File ">>".$RT->{historydb}
-         || die "cannot store information to history db `$RT->{historydb}'";
+         or die "cannot store information to history db `$RT->{historydb}'";
     $io->print($O);
     $io->close;
     return;
@@ -903,7 +903,7 @@
     my $file;
     foreach $file (@files) {
         $file =~ m|^([^/]+)/(.*):([^:]+)$|
-            || die "invalid file specification `$file' for access control";
+            or die "invalid file specification `$file' for access control";
         my ($d, $f, $t) = ($1, $2, $3);
         my $allow = 0;
         foreach my $module (keys(%{$CF->{Repository}->{Module}})) {
@@ -1249,7 +1249,7 @@
     my $cvsstat = '';
     if (not $RT->{useserver}) {
         my $io = new IO::File "$RT->{cvs} -f -Q -n status ".join(' ', @cvsfiles)."|"
-            || die "unable to open CVS command pipe for reading";
+            or die "unable to open CVS command pipe for reading";
         $cvsstat .= $_ while (<$io>);
         $io->close;
     }
@@ -1340,7 +1340,7 @@
     #   suck in the log message
     my $logfile = $PA->{ARG}->[0];
     my $io = new IO::File "<$logfile"
-        || die "cannot open message file `$logfile' for reading";
+        or die "cannot open message file `$logfile' for reading";
     my $data = '';
     $data .= $_ while (<$io>);
     $io->close;
@@ -1351,7 +1351,7 @@
     #  update the log message
     #  (CVS with RSE patches reads in this again, stock CVS ignores it)
     $io = new IO::File ">$logfile"
-        || die "cannot open message file `$logfile' for writing";
+        or die "cannot open message file `$logfile' for writing";
     $io->print($data);
     $io->close;
 
@@ -1494,7 +1494,7 @@
                     exit(0);
                 }
                 my $io = new IO::File "$RT->{cvs} -f -Q -n log -r$It '$Is'|"
-                    || die "unable to open CVS command pipe for reading";
+                    or die "unable to open CVS command pipe for reading";
                 $rcslog = $_ while (<$io>);
                 $io->close;
             }
@@ -1583,7 +1583,7 @@
         my @newinfo = ();
         foreach my $info (@cvsinfo) {
             $info =~ m|^([^,]+),([^,]+),([^,]+)|
-                || die "invalid loginfo argument `$info' while extending stock CVS information";
+                or die "invalid loginfo argument `$info' while extending stock CVS information";
             my ($Is, $IV, $Iv) = ($1, $2, $3);
 
             my $It = '';
@@ -1603,7 +1603,7 @@
     my @newinfo = ();
     foreach my $info (@cvsinfo) {
         $info =~ m|^([^,]+),([^,]+),([^,]+),([^,]*),([^,]*)$|
-            || die "invalid loginfo argument `$info' while extending summary information";
+            or die "invalid loginfo argument `$info' while extending summary information";
         my ($Is, $IV, $Iv, $It, $Io) = ($1, $2, $3, $4, $5);
 
         #   fix branch/tag and accumulate information
@@ -1616,7 +1616,7 @@
             my $rcslog ='';
             if (not $RT->{useserver}) {
                 my $io = new IO::File "$RT->{cvs} -f -Q -n log '$Is'|"
-                    || die "unable to open CVS command pipe for reading";
+                    or die "unable to open CVS command pipe for reading";
                 $rcslog .= $_ while (<$io>);
                 $io->close;
             }
@@ -1639,7 +1639,7 @@
         if ($Io eq 'A' or $Io eq 'M' or $Io eq 'R') {
             if (not $RT->{useserver}) {
                 my $io = new IO::File "$RT->{cvs} -f -Q -n log -r$Iv '$Is'|"
-                    || die "unable to open CVS command pipe for reading";
+                    or die "unable to open CVS command pipe for reading";
                 $rcslog .= $_ while (<$io>);
                 $io->close;
             }
@@ -1706,11 +1706,11 @@
             #   retrieve whole file contents
             unlink("$RT->{tmpfile}.all");
             my $io = new IO::File ">$RT->{tmpfile}.all"
-                || die "unable to open temporary file $RT->{tmpfile}.all for writing";
+                or die "unable to open temporary file $RT->{tmpfile}.all for writing";
             my $l = 0;
             if (not $RT->{useserver}) {
                 my $cvs = new IO::File "$RT->{cvs} -f -Q -n update -p -r$Iv '$Is'|"
-                    || die "unable to open CVS command pipe for reading";
+                    or die "unable to open CVS command pipe for reading";
                 while (<$cvs>) {
                     $io->print($_);
                     $l++;
@@ -1747,12 +1747,12 @@
                     unlink("$RT->{tmpfile}.null");
                     unlink("$RT->{tmpfile}.xdelta");
                     my $io = new IO::File ">$RT->{tmpfile}.null"
-                        || die "unable to open temporary file $RT->{tmpfile}.null for writing";
+                        or die "unable to open temporary file $RT->{tmpfile}.null for writing";
                     $io->close;
                     system("$RT->{xdelta} delta $RT->{tmpfile}.null " .
                            "$RT->{tmpfile}.all $RT->{tmpfile}.xdelta >/dev/null 2>&1");
                     $io = new IO::File "$RT->{uuencode} $RT->{tmpfile}.xdelta $Is.xdelta |"
-                        || die "unable to open uuencode command pipe for reading";
+                        or die "unable to open uuencode command pipe for reading";
                     $cvsdiff .= $_ while (<$io>);
                     $io->close;
                     $cvsdiff .= "@@ .\n";
@@ -1772,7 +1772,7 @@
                         "\$ cvs diff -u -r0 -r$Iv $Is\n";
                     my $diff = '';
                     my $io = new IO::File "$RT->{diff} -u /dev/null $RT->{tmpfile}.all|"
-                        || die "unable to open CVS command pipe for reading";
+                        or die "unable to open CVS command pipe for reading";
                     $diff .= $_ while (<$io>);
                     $io->close;
                     my $Is_quoted = quotemeta("$RT->{tmpfile}.all");
@@ -1798,10 +1798,10 @@
                     #   retrieve whole file contents (old revision)
                     unlink("$RT->{tmpfile}.old");
                     my $io = new IO::File ">$RT->{tmpfile}.old"
-                        || die "unable to open temporary file $RT->{tmpfile}.old for writing";
+                        or die "unable to open temporary file $RT->{tmpfile}.old for writing";
                     if (not $RT->{useserver}) {
                         my $cvs = new IO::File "$RT->{cvs} -f -Q -n update -p -r$IV '$Is'|"
-                            || die "unable to open CVS command pipe for reading";
+                            or die "unable to open CVS command pipe for reading";
                         $io->print($_) while (<$cvs>);
                         $cvs->close;
                     }
@@ -1819,10 +1819,10 @@
                     #   retrieve whole file contents (new revision)
                     unlink("$RT->{tmpfile}.new");
                     $io = new IO::File ">$RT->{tmpfile}.new"
-                        || die "unable to open temporary file $RT->{tmpfile}.new for writing";
+                        or die "unable to open temporary file $RT->{tmpfile}.new for writing";
                     if (not $RT->{useserver}) {
                         my $cvs = new IO::File "$RT->{cvs} -f -Q -n update -p -r$Iv '$Is'|"
-                            || die "unable to open CVS command pipe for reading";
+                            or die "unable to open CVS command pipe for reading";
                         $io->print($_) while (<$cvs>);
                         $cvs->close;
                     }
@@ -1851,7 +1851,7 @@
                     system("$RT->{xdelta} delta $RT->{tmpfile}.old " .
                            "$RT->{tmpfile}.new $RT->{tmpfile}.xdelta >/dev/null 2>&1");
                     $io = new IO::File "$RT->{uuencode} $RT->{tmpfile}.xdelta $Is.xdelta |"
-                        || die "unable to open uuencode command pipe for reading";
+                        or die "unable to open uuencode command pipe for reading";
                     $cvsdiff .= $_ while (<$io>);
                     $io->close;
                     $cvsdiff .= "@@ .\n";
@@ -1868,7 +1868,7 @@
                 my $d = '';
                 if (not $RT->{useserver}) {
                     my $io = new IO::File "$RT->{cvs} -f -Q -n diff -u -r$IV -r$Iv '$Is'|"
-                        || die "unable to open CVS command pipe for reading";
+                        or die "unable to open CVS command pipe for reading";
                     $d .= $_ while (<$io>);
                     $io->close;
                 }
@@ -1963,7 +1963,7 @@
     my $handle_max; $handle_max = undef;
     foreach my $cvsinfo (@cvsinfo) {
         $cvsinfo =~ m|^([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+)$|
-             || die "invalid loginfo argument `$cvsinfo' while accumulating information";
+             or die "invalid loginfo argument `$cvsinfo' while accumulating information";
         my ($Is, $IV, $Iv, $It, $Io, $Ik, $ID, $Id) = ($1, $2, $3, $4, $5, $6, $7, $8, $9);
         my $e = {};
         $e->{oldrev} = $IV;
@@ -2068,7 +2068,7 @@
                 my $logmsg = &produce_log_message($PA, $RT, $CF, $IN, $logtype, @files);
                 $logurl = $RT->{cvsroot}."/".$logurl if ($logurl !~ m|^/|);
                 print "cvs commit: Writing commit message to $logurl\n";
-                my $io = new IO::File ">>$logurl" || die "cannot append log message to `$logurl'";
+                my $io = new IO::File ">>$logurl" or die "cannot append log message to `$logurl'";
                 $io->print($logmsg);
                 $io->close;
             }
@@ -2117,7 +2117,7 @@
     #   Finally generate the logging message.
     #
 
-    my $RP = $CF->{Logging}->{Report}->{$type} || die "No report of type `$type' defined";
+    my $RP = $CF->{Logging}->{Report}->{$type} or die "No report of type `$type' defined";
     my $prefix = $RP->{Prefix} || '';
     my $style = $RP->{Details} || 'patch:plain';
     my $O = '';

CVSTrac 2.0.1