[m-dev.] For review: another fix for remote CVS

Warwick Harvey wharvey at cs.monash.edu.au
Tue May 25 12:46:26 AEST 1999


Estimated hours taken: 0.5

My previous patch to allow querying of a remote user via `xmessage' should 
have had tighter checking of the result code.  Certain kinds of errors (e.g. 
executing an incompatible binary) were interpreted as confirmation to 
proceed with the commit.

CVSROOT/check.pl:
	Make sure we print an error message unless the return code from
	`xmessage' is explicitly either `0' or `1'.  Also, swap the return
	values from `xmessage' so that `yes' returns `0' rather than `1',
	to further reduce the chance that an error (non-zero exit status)
	is interpreted as confirmation to proceed.


--- check.pl    1999/05/24 02:43:01     1.10
+++ check.pl    1999/05/25 02:15:06
@@ -172,10 +172,12 @@
                # redirects X connections back to their origin.
                #
 
-               $result = system "xmessage", "-buttons", "yes:1,no:0",
+               $result = system "xmessage", "-buttons", "yes:0,no:1",
                                "Problem with `$file'.  Commit anyway?";
-               if ($result != 0xff00 && ($result & 0xff) == 0) {
-                       return $result >> 8;
+               $errcode = $result & 0xff;
+               $exitval = $result >> 8;
+               if ($errcode == 0 && ($exitval == 0 || $exitval == 1)) {
+                       return ! $exitval;
                } else {
                        print "Error running `xmessage', sorry.\n";
                        print "(Result code = ", $result, ")\n";


--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list