From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32371 invoked by alias); 12 Aug 2010 14:41:09 -0000 Received: (qmail 32359 invoked by uid 22791); 12 Aug 2010 14:41:08 -0000 X-Spam-Check-By: sourceware.org Received: from aquarius.hirmke.de (HELO calimero.vinschen.de) (217.91.18.234) by sourceware.org (qpsmtpd/0.83/v0.83-20-g38e4449) with ESMTP; Thu, 12 Aug 2010 14:41:03 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id 5A9E26D4364; Thu, 12 Aug 2010 16:40:58 +0200 (CEST) Date: Thu, 12 Aug 2010 14:41:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: Postinstall script errors Message-ID: <20100812144058.GK14202@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <20100812095930.GX14202@calimero.vinschen.de> <4C6400CF.9050800@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <4C6400CF.9050800@gmx.de> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2010-08/txt/msg00293.txt.bz2 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. 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