[PATCH] setup: fix abnormal exit test for postinstall scripts

Igor Peshansky pechtcha@cs.nyu.edu
Fri Mar 17 13:26:00 GMT 2006

On Fri, 17 Mar 2006, Max Bowsher wrote:

> Igor Peshansky wrote:
> > On Thu, 16 Mar 2006, Max Bowsher wrote:
> >
> > Speaking of in-use DLLs, did you have a chance to look at
> > <http://cygwin.com/ml/cygwin-apps/2006-03/msg00060.html>?
> OK, I'll have a look.


> >> So, I think we should always rename preremove scripts, because we
> >> certainly don't want a failed preremove script to be removed by the
> >> later file-removal phase - it might be wanted for debugging.
> >
> > I would even go one step further, and cancel the uninstall of the current
> > package and all packages it depends on if the preremove failed.  But
> > that should be a separate patch.

Would this work, BTW?

> >> As for postinstall scripts ... I think ideally it would be a separate
> >> operation (c.f. 'dpkg --configure --pending'), but I guess we can go
> >> with the simple solution for now, and defer a more complex solution
> >> until someone has the inclination.
> >
> > So, does this mean "please check in"?
> I'd like preremove scripts to be renamed on failure. But, OK, you check
> in as-is, and I'll follow-up with a change for that.

Hmm, it's easy enough to rename scripts on failure -- it is simply a
question of propagating the information of whether this is a preremove
script or not to the script object itself.  Since all preremove scripts
are run from try_run_script(), and none of the postinstall scripts are, it
should be reasonably easy to add a rename_on_failure field (and
constructor argument that defaults to false), and set it to true in
the Script() constructor in try_run_script().  Once I commit this one in,
I can look into adding the rename_on_failure code...

While we're at it, I'd also like to clean up the constant mentions of
strings "/etc/postinstall" (in at least 3 places) and "/etc/preremove" (in
two).  Those should be defined in script.h as macros, most likely...

Another patch coming up...
      |\      _,,,---,,_	    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"

More information about the Cygwin-apps mailing list