[PATCH] setup: fix abnormal exit test for postinstall scripts
Igor Peshansky
pechtcha@cs.nyu.edu
Thu Mar 9 14:57:00 GMT 2006
On Thu, 9 Mar 2006, Igor Peshansky wrote:
> P.S. A note for the archives: now that setup has a proper mechanism to
> detect failed postinstall scripts... [snip]
Whoops, I guess I misremembered that the patch has not yet been applied.
So...
On Mon, 23 Jan 2006, Igor Peshansky wrote:
> Just noticed that the postinstall mechanism in setup inverts the test for
> abnormal exit. The attached one-liner patch fixes that. ChangeLog below.
> Igor
> ==============================================================================
> 2006-01-23 Igor Peshansky <pechtcha@cs.nyu.edu>
>
> * script.cc (Script::run): Fix inverted test for abnormal exit.
Ping (attached as "setup-script-exit-code-fix.patch-1").
On Tue, 31 Jan 2006, Igor Peshansky wrote:
> Dave's advice in <http://cygwin.com/ml/cygwin/2006-01/msg01475.html>, made
> me realize that setup will always rename the script to ".done", even if it
> didn't complete properly (i.e., exited with a non-zero exit code). Now
> that we detect the code correctly, let's also use that to not rename
> failed scripts for easier detection (patch attached). ChangeLog below.
>
> Note that this will put a bit of extra burden on package maintainers to
> ensure that their scripts always return a zero exit code. Most scripts
> already do that, though.
> Igor
> ==============================================================================
> 2006-01-31 Igor Peshansky <pechtcha@cs.nyu.edu>
>
> * script.cc (Script::run): Fix inverted test for abnormal exit.
> Do not rename to ".done" unless completed successfully.
And ping (attached as "setup-script-exit-code-fix.patch").
In light of the "extra burden" consideration, let's look at those
separately.
Igor
--
http://cs.nyu.edu/~pechtcha/
|\ _,,,---,,_ pechtcha@cs.nyu.edu | igor@watson.ibm.com
ZZZzz /,`.-'`' -. ;-;;,_ Igor Peshansky, Ph.D. (name changed!)
|,4- ) )-,_. ,\ ( `'-' old name: Igor Pechtchanski
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
"Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte."
"But no -- you are no fool; you call yourself a fool, there's proof enough in
that!" -- Rostand, "Cyrano de Bergerac"
-------------- next part --------------
Index: script.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/script.cc,v
retrieving revision 2.21
diff -u -p -r2.21 script.cc
--- script.cc 14 Oct 2005 04:00:50 -0000 2.21
+++ script.cc 23 Jan 2006 17:07:02 -0000
@@ -243,7 +243,7 @@ Script::run() const
if (to_log && !file_out.isEmpty ())
log(LOG_BABBLE) << file_out << endLog;
- if (!retval)
+ if (retval)
log(LOG_PLAIN) << "abnormal exit: exit code=" << retval << endLog;;
/* if file exists then delete it otherwise just ignore no file error */
-------------- next part --------------
Index: script.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/script.cc,v
retrieving revision 2.21
diff -u -p -r2.21 script.cc
--- script.cc 14 Oct 2005 04:00:50 -0000 2.21
+++ script.cc 31 Jan 2006 14:39:40 -0000
@@ -243,14 +243,15 @@ Script::run() const
if (to_log && !file_out.isEmpty ())
log(LOG_BABBLE) << file_out << endLog;
- if (!retval)
+ if (retval)
log(LOG_PLAIN) << "abnormal exit: exit code=" << retval << endLog;;
/* if file exists then delete it otherwise just ignore no file error */
io_stream::remove (String ("cygfile://") + scriptName + ".done");
- io_stream::move (String ("cygfile://") + scriptName,
- String ("cygfile://") + scriptName + ".done");
+ if (!retval)
+ io_stream::move (String ("cygfile://") + scriptName,
+ String ("cygfile://") + scriptName + ".done");
return retval;
}
More information about the Cygwin-apps
mailing list