delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/05/25/10:50:23

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:reply-to:message-id:to:subject
:in-reply-to:references:mime-version:content-type
:content-transfer-encoding; q=dns; s=default; b=Z3iNWmTeCfKOR0yi
mcjVFX5T8LGDER+/IBXbDTFXYV4Dy/tUltyZXfm6oYKQYG3dXXB+5jKQhqbllSjD
S5upm5g+Euo6YhZDYyZElMxM5115oln4PGS+IpmiRqmwEkoXNrCj0cTOUG6RgK92
7Uh+9Bq0exZlAxSbTe67nseWcv0=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:reply-to:message-id:to:subject
:in-reply-to:references:mime-version:content-type
:content-transfer-encoding; s=default; bh=oQKUbWBbzQ0tMFWeD3hpXT
Chv1Y=; b=qCk7YzDM8NjVgLcfLGPyVBY3ioqyQwCwmb9An06beODXXUhK+s/huO
HwyryxVsHzJgkKMDkPEzvIsO+GYmPVPROkvVByeS4UtJxtCRtUI0kVcWDMwiD5Lt
u9kVqMmNWDE2yS9ksxoVbh/Fe4miZNU4wLIsLWVOvv277GBnBWJiI=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-10.7 required=5.0 tests=BAYES_00,FREEMAIL_FROM,GIT_PATCH_2,GIT_PATCH_3,KAM_THEBAT,MIME_BASE64_BLANKS,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=H*c:Windows-1251, Documents, H*M:yandex, H*R:D*cygwin.com
X-HELO: forward1h.cmail.yandex.net
Authentication-Results: smtp2h.mail.yandex.net; dkim=pass header.i=@yandex.ru
X-Yandex-Suid-Status: 1 0,1 0
Date: Thu, 25 May 2017 17:40:21 +0300
From: Andrey Repin <anrdaemon AT yandex DOT ru>
Reply-To: cygwin AT cygwin DOT com
Message-ID: <269992253.20170525174021@yandex.ru>
To: Pavel Fedin <p DOT fedin AT samsung DOT com>, cygwin AT cygwin DOT com
Subject: Re: Bug: bash -e misbehaves with several nested
In-Reply-To: <000e01d2d53d$57318470$05948d50$@samsung.com>
References: <CGME20170524125429eucas1p1384ad5e0c60eb4974a0f57e0f0203d9a AT eucas1p1 DOT samsung DOT com> <000e01d2d48c$e16d1ca0$a44755e0$@samsung.com> <be033564-acfc-1d1a-bc4c-9cbbb73b155f AT gmail DOT com> <000e01d2d53d$57318470$05948d50$@samsung.com>
MIME-Version: 1.0
X-IsSubscribed: yes
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id v4PEoLFD011699

Greetings, Pavel Fedin!

>> >  Hello! I'd like to report a strange bug in 64-bit bash. The following script:
>> >
>> > ---- cut ---
>> > #/bin/bash -e
>> >
>> > DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
>> > echo Works: $DIR
>> > ---- cut ---
>> >
>> > Simply exits and produces no output (never reaches echo). The same script works perfectly
>> on 32 bits. Versions are the same:
>> >
>> > --- cut ---
>> 
>> It works fine for me.
>> 
>> $ ./prova.bash
>> Works: /tmp

>  Huh, works here too, indeed. But there's one little thing. If you just
> copypasted this from my email, then you probably miss "#!"
> (there's just "#", since i retyped the header, and made a typo). And with
> this typo it really works for some reason. Could you make
> sure once again ?
>  Apparently it has to do with -e switch.

I doubt that.

> + cat /home/anrdaemon/Documents/.sh/xx.sh
> #!/bin/bash -xe
>
> cat "$0"
> DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
> echo Works: $DIR
> +++ dirname /home/anrdaemon/Documents/.sh/xx.sh
> ++ cd /home/anrdaemon/Documents/.sh
> ++ pwd
> + DIR=/home/anrdaemon/Documents/.sh
> + echo Works: /home/anrdaemon/Documents/.sh
> Works: /home/anrdaemon/Documents/.sh

At the same time,

> #/bin/bash -xe
>
> cat "$0"
> DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
> echo Works: $DIR
> /home/anrdaemon/Documents/.sh/xx.sh: 4:
> /home/anrdaemon/Documents/.sh/xx.sh: Bad substitution
> Works: /home/anrdaemon/Documents/.sh

If you are wondering, what's going on, …
sh is not bash. For me. I guess, dash is a little more vocal about errors,
than bash.


-- 
With best regards,
Andrey Repin
Thursday, May 25, 2017 17:34:21

Sorry for my terrible english...
--
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