delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/08/12/10:55:04

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Thu, 12 Aug 2010 16:54:46 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Postinstall script errors
Message-ID: <20100812145446.GN14202@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <AANLkTinNXnksnBKU7EKC4mFsqR9P5uAFsgTn0WyJ1Z=j AT mail DOT gmail DOT com> <20100812095930 DOT GX14202 AT calimero DOT vinschen DOT de> <AANLkTim0EAbuHF81OC0RX_qz2jMf_Sqhj0tNOCyQNV8c AT mail DOT gmail DOT com> <4C6400CF DOT 9050800 AT gmx DOT de> <20100812144058 DOT GK14202 AT calimero DOT vinschen DOT de> <4C640ABB DOT 1080507 AT gmx DOT de>
MIME-Version: 1.0
In-Reply-To: <4C640ABB.1080507@gmx.de>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Aug 12 16:52, Matthias Andree wrote:
> 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

No, I didn't.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019