This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

bash-4.3.33-1 fails to execute shell script with CR+LF EOL in text-mounted directory


Dear Cygwin developers:

 It seems that bash-4.3.33(1) handles CR+LF end-of-line in 
the shell-script incorrectly, all of the following conditions are met:

a. the shell-script file is on TEXT-MOUNTED directory,
b. end-of-line style of the file is CR+LF, and
c. the command in the file includes & (exec-background),
   $( ), or `` (command substitutions)

It works:
d. it is on the binary-mounted directory, and with igncr shell-option,
e. end-of-line style is LF, or
f. condition c is not met. It seems that &&, | and || work fine,
   although I didn't try all of the metachacters and control-constructs.

 I found it on x86 Cygwin with 64bit Windows environment first,
the same behavior is observed on 32bit Windows environment also.
I've not tried yet on x64 Cygwin with 64bit Windows environment.

shell-script to test: (WITH CR+LF END-OF-LINE STYLE)
--- 8< ------ 8< ------ 8< ------ 8< ------ 8< ---
#!/bin/bash
echo hoge &
echo fuga &
echo piyo &
echo foo &
echo bar &
echo baz
--- 8< ------ 8< ------ 8< ------ 8< ------ 8< ---

example of execution, on bash-4.3.33(1):
--- 8< ------ 8< ------ 8< ------ 8< ------ 8< ---
$ LANG=C ./test.sh
hoge
./test.sh: line 3: fuga: command not found
./test.sh: line 4: piyo: command not found
./test.sh: line 5: o: command not found
./test.sh: line 6: ho: command not found
./test.sh: line 7: cho: command not found
--- 8< ------ 8< ------ 8< ------ 8< ------ 8< ---

Maybe commands are read from the positions one-byte shifted, line-by-line.

mounting information:
--- 8< ------ 8< ------ 8< ------ 8< ------ 8< ------ 8< ------ 8< ---
$ mount
C:/cygwin/bin on /usr/bin type ntfs (binary,noacl)
C:/cygwin/lib on /usr/lib type ntfs (binary,noacl)
C:/user/binary on /home/user/binary type ntfs (binary,noacl,user)
C:/cygwin on / type ntfs (binary,noacl)
C:/user on /home/user type ntfs (text,noacl,user)
C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto)
--- 8< ------ 8< ------ 8< ------ 8< ------ 8< ------ 8< ------ 8< ---

bash which handles the end-of-line INCORRECTLY:
--- 8< ------ 8< ------ 8< ------ 8< ------ 8< ------ 8< ------ 8< ---
$ LANG=C bash --version
GNU bash, version 4.3.33(1)-release (i686-pc-cygwin)
Copyright (C) 2013 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.
--- 8< ------ 8< ------ 8< ------ 8< ------ 8< ------ 8< ------ 8< ---

bash which handles the end-of-line correctly:
--- 8< ------ 8< ------ 8< ------ 8< ------ 8< ------ 8< ------ 8< ---
$ LANG=C bash --version
GNU bash, version 4.1.17(9)-release (i686-pc-cygwin)
Copyright (C) 2009 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.
--- 8< ------ 8< ------ 8< ------ 8< ------ 8< ------ 8< ------ 8< ---

 Attached cygcheck.out is modified to omit sensitive informations,
and includes UTF-8 encoded Japanese characer, because it was 
generated on Japanese Windows environment.

Best Regards.


Attachment: cygcheck.out
Description: cygcheck.out

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]