From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28525 invoked by alias); 12 Aug 2010 15:04:47 -0000 Received: (qmail 28450 invoked by uid 22791); 12 Aug 2010 15:04:45 -0000 X-SWARE-Spam-Status: No, hits=0.9 required=5.0 tests=AWL,BAYES_00,DONT_USE_RAW_EMAIL_IN_BODY,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mailout-de.gmx.net (HELO mail.gmx.net) (213.165.64.23) by sourceware.org (qpsmtpd/0.43rc1) with SMTP; Thu, 12 Aug 2010 15:04:39 +0000 Received: (qmail invoked by alias); 12 Aug 2010 15:04:36 -0000 Received: from baloo.cs.uni-paderborn.de (EHLO baloo.cs.uni-paderborn.de) [131.234.21.116] by mail.gmx.net (mp057) with SMTP; 12 Aug 2010 17:04:36 +0200 Received: from [127.0.0.1] by baloo.cs.uni-paderborn.de with esmtp (Exim 4.70) (envelope-from ) id L71OJN-0003HO-G8 for cygwin@cygwin.com; Thu, 12 Aug 2010 17:04:35 +0200 Message-ID: <4C640D81.1000201@gmx.de> Date: Thu, 12 Aug 2010 15:04:00 -0000 From: Matthias Andree User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.8) Gecko/20100802 Lightning/1.0b2 Thunderbird/3.1.2 MIME-Version: 1.0 To: cygwin@cygwin.com Subject: Re: Postinstall script errors References: <20100812095930.GX14202@calimero.vinschen.de> <4C6400CF.9050800@gmx.de> <20100812144058.GK14202@calimero.vinschen.de> <4C640ABB.1080507@gmx.de> <20100812145446.GN14202@calimero.vinschen.de> In-Reply-To: <20100812145446.GN14202@calimero.vinschen.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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/msg00300.txt.bz2 Am 12.08.2010 16:54, schrieb Corinna Vinschen: > 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. Sorry to be so unrelenting, but you are still missing the point. Please re-read Jeremy's analysis at . NOTE: *chgrp was not ever run* in the failing scenario, so whatever you pass as chgrp arguments, --silent or not, is irrelevant. What actually happened was: created_group=no ... [ "$created_group" = "yes" ] && # remainder short-circuited, failure stands And since this [ ] && line was the last in the script, the failure from the "[" (= test) command propagated through to the caller and finally through setup.exe which duly reported it. -- 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