From: Matthias Andree <matthias.andree@gmx.de>
To: cygwin@cygwin.com
Subject: Re: Postinstall script errors
Date: Thu, 12 Aug 2010 14:52:00 -0000 [thread overview]
Message-ID: <4C640ABB.1080507@gmx.de> (raw)
In-Reply-To: <20100812144058.GK14202@calimero.vinschen.de>
Am 12.08.2010 16:40, schrieb Corinna Vinschen:
> On Aug 12 16:10, Matthias Andree wrote:
>> Am 12.08.2010 15:37, schrieb Jeremy Ramer:
>> > I verified that $created_passwd and $created_group were both no so
>> > both conditionals will fail. But because the last conditional is the
>> > last thing run, the script returns 1. Adding an exit 0 to the script
>> > fixes it, but I'm not sure if that accomplishes what you want from the
>> > script.
>>
>> PLEASE DON'T.
>>
>> Adding an "exit 0" will mask the error and just reinstate the former state of
>> silently failing postinstall scripts more rigidly. This is not desirable. The
>> proper way to fix this is:
>>
>> set -e # this is providing that the whole script is written properly.
>> # it causes immediate exit after one command (outside if, and
>> # outside || or && lists) fails - usually desirable, but takes more
>> # work because you can't write the scripts as sloppily as the
>> # snippet you've just shown from passwd-grp.sh.
>> #
>> # ...other work...
>> #
>> if [ "$created_passwd" = "yes" ] ; then
>> /bin/chgrp --silent root /etc/passwd
>> fi
>>
>> if [ "$created_group" = "yes" ] ; then
>> /bin/chgrp --silent root /etc/group
>> fi
>
> I misinterpreted the `chgrp --silent'. I thought it would result
> in an exit code of 0 from chgrp, but it just suppresses the error
> messages. Sorry about that.
And you're missing the other point that I've just explained on cygwin-apps@, see
http://www.cygwin.com/ml/cygwin-apps/2010-08/msg00116.html
"[ $blah = foo ] && ..." is usually suspicious and often triggers bogus
failures or premature exit, depends on if running under set +e (default) or set
-e (advised).
--
Matthias Andree
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
next prev parent reply other threads:[~2010-08-12 14:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-11 15:18 Jeremy Ramer
2010-08-12 9:59 ` Corinna Vinschen
2010-08-12 13:38 ` Jeremy Ramer
2010-08-12 14:05 ` Corinna Vinschen
2010-08-12 14:10 ` Matthias Andree
2010-08-12 14:41 ` Corinna Vinschen
2010-08-12 14:52 ` Matthias Andree [this message]
2010-08-12 14:54 ` Corinna Vinschen
2010-08-12 15:04 ` Matthias Andree
2010-08-12 15:15 ` Corinna Vinschen
2010-08-12 16:02 ` Matthias Andree
2010-08-12 17:56 ` Tilman Hausherr
2010-08-13 9:48 ` Corinna Vinschen
2010-08-20 19:32 ` Tilman Hausherr
[not found] <58C73DA23112384988EEB999F2EC04DC1E78D328@ATLEISEXCMBX1.eis.equifax.com>
2016-04-11 18:51 ` Ken Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C640ABB.1080507@gmx.de \
--to=matthias.andree@gmx.de \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).