public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* cygwin-bash compat/regression bug...  startup line prob
@ 2014-04-28 20:43 Linda Walsh
  2014-04-28 21:18 ` Eric Blake
  0 siblings, 1 reply; 10+ messages in thread
From: Linda Walsh @ 2014-04-28 20:43 UTC (permalink / raw)
  To: cygwin

This 'used' to work...but doesn't now: -- running
bash with the "-u" flag:

> t.sh
/usr/bin/bash: - : invalid option
Usage:  /usr/bin/bash [GNU long option] [option] ...
         /usr/bin/bash [GNU long option] [option] script-file ...
GNU long options:
         --debug
         --debugger
         --dump-po-strings
         --dump-strings
         --help
         --init-file
         --login
         --noediting
         --noprofile
         --norc
         --posix
         --protected
         --rcfile
         --restricted
         --verbose
         --version
         --wordexp
Shell options:
         -irsD or -c command or -O shopt_option          (invocation only)
         -abefhkmnptuvxBCHP or -o option
> which t.sh
/Users/law.Bliss/bin/t.sh
> cat bin/t.sh
#!/bin/bash -u -x
echo "Hello World"
>
-----------------------------

It has something to do with the "-u" switch -- the "-x" was
added to try to figure out why a script that had just
#!/bin/bash -u
died w/o executing a single line.

If I run it via:
> bash t.sh
Hello World
>
---works---
Also weird -- the interp line says "/bin/bash" not "/usr/bin/bash"
as the shell, so why does the error come from /usr/bin/bash?

It doesn't when I do it interactively:
> /bin/bash - - 
/bin/bash: -: No such file or directory
---
or 'bash' alone:
> bash - - 
bash: -: No such file or directory


----
Ideas?  would a cygcheck be of any use?

Note, if I combine the switches (-ux), it works -- but I only
added the '-x' to debug why '-u' didn't work.

> uname -a
CYGWIN_NT-6.1 Athenae 1.7.29(0.272/5/3) 2014-04-07 13:46 x86_64 Cygwin
> bash --version
GNU bash, version 4.1.11(2)-release (x86_64-unknown-cygwin)

---
This, also, doesn't work:
> echo t.sh|bash -i     #(with or without '-i')
#note -- first some unrelated output from confused startup scripts:

User Bliss\law's .bashrc called 2nd time
/usr/bin/stty: standard input: Inappropriate ioctl for device
/usr/bin/stty: standard input: Inappropriate ioctl for device
dirname: extra operand `a'
Try `dirname --help' for more information.
## here is the 'echo' being read into bash:

law.Bliss> t.sh
/usr/bin/bash: - : invalid option
Usage:  /usr/bin/bash [GNU long option] [option] ...
         /usr/bin/bash [GNU long option] [option] script-file ...
GNU long options:
...
-----


--
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

^ permalink raw reply	[flat|nested] 10+ messages in thread
* cygwin-bash compat/regression bug...  startup line prob
@ 2014-05-01 22:11 Linda Walsh
  2014-05-02  1:33 ` Eric Blake
  0 siblings, 1 reply; 10+ messages in thread
From: Linda Walsh @ 2014-05-01 22:11 UTC (permalink / raw)
  To: cygwin

Bob McGowan wrote:

> >> Because you weren't running /bin/bash at that point in time, but
> >> /usr/bin/bash.  Again, you snipped the relevant portion of your original
> > ----
> > No...I was... the output at the top was from "t.sh", which had
> > #!/bin/bash.
> >
> > But the error message says /usr/bin/bash.
----
   That's why I commented that something was bogus.  Here it is
again:
law.Bliss> cat /tmp/t.sh
#!/bin/bash -u
echo -e "Hello World\n"

law.Bliss> t.sh
/usr/bin/bash: - : invalid option
Usage:  /usr/bin/bash [GNU long option] [option] ...
       /usr/bin/bash [GNU long option] [option] script-file ...
GNU long options:
----
The reason the above fails... (I got it to work).. is that if there is a space
on the line after the "-u", that also fails.

I didn't deliberately put one there, but that it no longer handles
separate options is an evolution of software devolution.

But NOTE -- the above error claims it is coming from /usr/bin/bash.
That's not my login shell nor on the shebang line.

That's cygwin-black-magic... converting all /bin paths to /usr/bin...even
shells?...


>
>
> Regarding how your script is executed:
>
> If you do "$ bash t.sh", the she-bang line is *ignored*, it's just a
> comment in this case.
---
I'm aware of that -- I was noting that the alternate ways of invoking it
made a difference.  Not that I didn't understand why.






--
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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-05-03 19:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-28 20:43 cygwin-bash compat/regression bug... startup line prob Linda Walsh
2014-04-28 21:18 ` Eric Blake
2014-05-01  5:57   ` Linda Walsh
2014-05-01  6:41     ` Eric Blake
2014-05-01 18:11       ` Linda Walsh
2014-05-01 20:41         ` two execve() inconsistencies [was: cygwin-bash compat/regression bug... startup line prob] Eric Blake
2014-05-02 21:44           ` two execve() inconsistencies (was cygwin-bash compat/regression bug... startup line prob) Linda Walsh
2014-05-01 22:11 cygwin-bash compat/regression bug... startup line prob Linda Walsh
2014-05-02  1:33 ` Eric Blake
2014-05-03 19:01   ` Linda Walsh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).