X-Spam-Check-By: sourceware.org
X-Envelope-To: <cygwin@cygwin.com>
X-Virus-Status: Clean
Message-ID: <461CF9DD.2090505@mscha.nl>
Date: Wed, 11 Apr 2007 17:08:13 +0200
From: Michael Schaap <cygwin@mscha.nl>
Reply-To: cygwin@cygwin.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070326 Thunderbird/2.0.0.0 Mnenhy/0.7.5.0
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: [ANNOUNCEMENT] Updated: cron 4.1-1
References: <announce.3.0.1.32.20070411064934.00ba6708@incoming.verizon.net>  <461CEAAC.7040608@mscha.nl>  <010a01c77c43$e1ea24e0$3c0110ac@wirelessworld.airvananet.com>  <461CEEE0.7040202@mscha.nl>  <011601c77c45$e87c8210$3c0110ac@wirelessworld.airvananet.com>  <461CF3E6.2050802@mscha.nl> <011c01c77c48$d71fbf20$3c0110ac@wirelessworld.airvananet.com>
In-Reply-To: <011c01c77c48$d71fbf20$3c0110ac@wirelessworld.airvananet.com>
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 8bit
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On 11-Apr-2007 16:51, Pierre A. Humblet wrote:
> ----- Original Message ----- 
> From: "Michael Schaap"
> To: <cygwin@cygwin.com>
> Sent: Wednesday, April 11, 2007 10:42 AM
> Subject: ***[Possible UCE]*** Re: [ANNOUNCEMENT] Updated: cron 4.1-1
>
>
> | On 11-Apr-2007 16:30, Pierre A. Humblet wrote:
> | > | "[ -e /usr/sbin/sendmail ]" is true when a symlink
> | > | "/usr/sbin/sendmail.exe" exists.
> | >
> | > Precisely if "[ -e /usr/sbin/sendmail ]"  is true then
> | >  || ln -sf /usr/bin/cronlog /usr/sbin/sendmail
> | > shouldn't run.
> | >
> | Indeed it doesn't.  But then:
> |
> | [ -e /usr/sbin/sendmail ] && rm -f /usr/sbin/sendmail.exe
> |
> | does run.
> |
> | – Michael
> |
> | (I can't stand that syntax, by the way.  It's so much easier to see
> | what's going on when you use a proper "if"...)
>
> Except if that if /usr/sbin/sendmail.exe did exist in the first place
> (not a dangling link) then cronlog would not have been linked,
> for the same reason:
>  [ -e /usr/sbin/sendmail -o -e /usr/sbin/sendmail.exe  ]
>
> and thus the rm -f would not do anything except possibly remove
> a dangling symlink. I still don't understand what happened.
>
>   
Okay, I have a symlink

    sendmail.exe -> /usr/sbin/ssmtp.exe

The following code:

    [ -e /usr/sbin/sendmail -o -e /usr/sbin/sendmail.exe  ] ||
      ln -sf /usr/bin/cronlog /usr/sbin/sendmail

does nothing, since "-e /usr/sbin/sendmail.exe" is true.

Then this code runs:

    [ -e /usr/sbin/sendmail ] && rm -f /usr/sbin/sendmail.exe

and *does* "rm -f /usr/sbin/sendmail.exe", since "-e 
/usr/sbin/sendmail.exe" is (still) true.


I'd just rewrite this as a proper "if".  Much easier to read and maintain.
(I don't really see what you're trying to do with that last statement 
anyway.  In which situation is it supposed to do something useful?)

 – Michael

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

