Re: Bug: bash -e misbehaves with several nested
On 2017-11-10 09:42, Pavel Fedin wrote: >> On Thursday, May 25, 2017 8:47 PM, Brian Inglis wrote: >> On 2017-05-25 08:40, Andrey Repin wrote: >>> 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. >> >> So the complaint is that sh doesn't work with bash arrays? >> Hashbangs matter - print that on a T-shirt and sell it ;^> > Long time has passed, i've rechecked the problem and it's not gone. > This time i've checked it with strace (see long log below). Any hints there? > --- cut --- > > p.fedin@fedinw7x64 /cygdrive/d/Projects/Test > $ bash -c ./test.sh > + DIR= > > p.fedin@fedinw7x64 /cygdrive/d/Projects/Test > $ strace bash -c ./test.sh >65 64249 [main] bash 16056 pinfo_init: Set nice to 0 >27 64276 [main] bash 16056 pinfo_init: pid 16056, pgid 16056, > process_state 0x41 >13 64289 [main] bash 16056 App version: 2006.1, api: 0.305 >11 64300 [main] bash 16056 DLL version: 2009.0, api: 0.318 >11 64311 [main] bash 16056 DLL build:2017-09-12 10:18 >48 64359 [main] bash 16056 dtable::extend: size 32, fds 0x1802FA298 >96 64455 [main] bash 16056 __get_lcid_from_locale: LCID=0x0409 > 243 64698 [main] bash 16056 transport_layer_pipes::connect: Try to > connect to named pipe: \\.\pipe\cygwin-e022582115c10879-lpc >73 64771 [main] bash 16056 transport_layer_pipes::connect: Error opening > the pipe (2) >22 64793 [main] bash 16056 client_request::make_request: cygserver > un-available > --- Process 16056 thread 15536 created > --- Process 16056 thread 20096 created > --- Process 6596 loaded C:\PaperSecu\paperhk64.dll at 07FEF534 > --- Process 18176 loaded C:\PaperSecu\paperhk64.dll at 07FEF534 > --- Process 18176, exception c005 at 000180128CFA > --- Process 18176 thread 20260 exited with status 0xc005 > --- Process 18176 exited with status 0xc005 > 295654 401998 [main] bash 16056 child_info::sync: pid 18176, WFMO returned > 1, exit_code 0xC005, res 0 > --- Process 10540 thread 13396 created > --- Process 10540 loaded C:\PaperSecu\paperhk64.dll at 07FEF534 > --- Process 10540, exception c005 at 000180128CFA > --- Process 10540 thread 15880 exited with status 0xc005 > --- Process 10540 exited with status 0xc005 > 288711 1697816 [main] bash 16056 child_info::sync: pid 10540, WFMO returned > 1, exit_code 0xC005, res 0 > --- Process 14076 created > --- Process 14076 loaded C:\PaperSecu\paperhk64.dll at 07FEF534 > --- Process 14076, exception c005 at 000180128CFA > --- Process 14076 thread 6832 exited with status 0xc005 > --- Process 14076 exited with status 0xc005 > 283609 3986009 [main] bash 16056 child_info::sync: pid 14076, WFMO returned > 1, exit_code 0xC005, res 0 > --- Process 14972 created > --- Process 14972 thread 6736 created > --- Process 14972 loaded C:\PaperSecu\paperhk64.dll at 07FEF534 > --- Process 14972, exception c005 at 000180128CFA > --- Process 14972 thread 10732 exited with status 0xc005 > --- Process 14972 exited with status 0xc005 > 280402 8271824 [main] bash 16056 child_info::sync: pid 14972, WFMO returned > 1, exit_code 0xC005, res 0 > --- Process 13904 created > --- Process 13904 thread 20164 created > --- Process 13904 loaded C:\PaperSecu\paperhk64.dll at 07FEF534 > ---
RE: Bug: bash -e misbehaves with several nested
Hello! > $ ./prova_bash > Works: /cygdrive/e/cygwin/tmp > > $ cat prova_bash > #!/bin/bash -e > > DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" > echo Works: $DIR Ok, ok, ok... Yet another "find it yourself" problem :) I'll try to... Sorry for late reply, i tend to forget things... 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
Re: Bug: bash -e misbehaves with several nested
On 2017-05-25 08:40, Andrey Repin wrote: > 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. So the complaint is that sh doesn't work with bash arrays? Hashbangs matter - print that on a T-shirt and sell it ;^> -- Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada -- 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
Re: Bug: bash -e misbehaves with several nested
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...
Re: Bug: bash -e misbehaves with several nested
On 25/05/2017 11:57, Pavel Fedin wrote: Hello! 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. $ ./prova_bash Works: /cygdrive/e/cygwin/tmp $ cat prova_bash #!/bin/bash -e DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" echo Works: $DIR -- 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
RE: Bug: bash -e misbehaves with several nested
Hello! > > 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. Kind regards, Pavel Fedin Senior Engineer Samsung Electronics Research center Russia > -Original Message- > From: cygwin-ow...@cygwin.com [mailto:cygwin-ow...@cygwin.com] On Behalf Of > Marco Atzeri > Sent: Wednesday, May 24, 2017 8:41 PM > To: cygwin@cygwin.com > Subject: Re: Bug: bash -e misbehaves with several nested > > On 24/05/2017 14:54, Pavel Fedin wrote: > > 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 > > > $ uname -svr > CYGWIN_NT-6.1 2.8.0(0.309/5/3) 2017-04-01 20:47 > > > -- > 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 > -- 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
Re: Bug: bash -e misbehaves with several nested
On 24/05/2017 14:54, Pavel Fedin wrote: 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 $ uname -svr CYGWIN_NT-6.1 2.8.0(0.309/5/3) 2017-04-01 20:47 -- 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