This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Bug: bash -e misbehaves with several nested
- From: Pavel Fedin <p dot fedin at samsung dot com>
- To: cygwin at cygwin dot com
- Date: Wed, 24 May 2017 15:54:27 +0300
- Subject: Bug: bash -e misbehaves with several nested
- Authentication-results: sourceware.org; auth=none
- Cms-type: 201P
- References: <CGME20170524125429eucas1p1384ad5e0c60eb4974a0f57e0f0203d9a@eucas1p1.samsung.com>
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 ---
$ bash --version
GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
--- cut ---
(of course i686 version prints "i686-pc-cygwin" here)
If i remove "-e" argument, it starts working. If i break down the sequence into two lines:
--- cut ---
#/bin/bash -e
DIR="$( dirname "${BASH_SOURCE[0]}" )"
DIR="$( cd "$DIR" && pwd )"
echo Result: $DIR
--- cut ---
then it also works on both versions of Cygwin.
Kind regards,
Pavel Fedin
Senior Engineer
Samsung Electronics Research center Russia
--
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