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/sh program interpreter problems...


I have the following two programs in /usr/local/bin:

--- test.btm
#!/usr/local/bin/testint.sh
echo hello from test.btm

--- testint.sh
#!/bin/sh
echo hello from test interpreter.  the file is "$1"

--- test.h
#!/bin/bash
test.btm

Then I do this:

~ $ echo $PATH
/usr/bin:/usr/local/bin:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:...[snip]
~ $ test.btm
: bad interpreter: No such file or directoryn/testint.sh
~ $

First of all, the output is messed up by an ASCII 13 character. Putting an extra space after "testint.sh" in test.btm fixes this. I don't understand why this problem doesn't occur for /bin/sh or /bin/bash interpreter specifications.

~ $ test.btm
bash: /usr/local/bin/test.btm: /usr/local/bin/testint.sh: bad interpreter: No such file or directory


Second, I can't figure out why testint.sh is not found. Further testing shows that the result is highly dependent on the current working directory, and almost inexplicably random. test.sh seems to fail much more often then simply test.btm.
The scripts were initially DOS ASCII. Converting them with dos2unix only takes away the first problem above. All mounts are binmode.
Here are a few more runs:


~ $ cd /usr/local/bin
/usr/local/bin $ test.btm
hello from test interpreter. the file is /usr/local/bin/test.btm
/usr/local/bin $ test.sh
/usr/local/bin/test.sh: /usr/local/bin/test.btm: /usr/local/bin/testint.sh: bad interpreter: No such
file or directory
/usr/local/bin $ test.btm
bash: /usr/local/bin/test.btm: /usr/local/bin/testint.sh: bad interpreter: No such file or directory
/usr/local/bin $ cd ..
/usr/local $ test.btm
hello from test interpreter. the file is /usr/local/bin/test.btm
/usr/local $ test.btm
bash: /usr/local/bin/test.btm: /usr/local/bin/testint.sh: bad interpreter: No such file or directory


Any hints to explain this behaviour, or assurance that it's a known bug, will be welcome. I prefer to understand why I implement a workaround.


Best regards, Robert
Cygwin Configuration Diagnostics
Current System Time: Sun Oct 24 21:50:56 2004

Windows XP Professional Ver 5.1 Build 2600 Service Pack 2

Path:	C:\cygwin\bin
	C:\cygwin\usr\local\bin
	c:\WINDOWS\system32
	c:\WINDOWS
	c:\WINDOWS\System32\Wbem
	c:\Program Files\ATI Technologies\ATI Control Panel
	c:\Program Files\Schlumberger\Smart Cards and Terminals\Cyberflex Access Kits\v4\

Output from C:\cygwin\bin\id.exe (nontsec)
UID: 1003(robert) GID: 513(None)
513(None)

Output from C:\cygwin\bin\id.exe (ntsec)
UID: 1003(robert) GID: 513(None)
513(None)             544(Administrators)
545(Users)            1005(Debugger Users)

SysDir: C:\WINDOWS\system32
WinDir: C:\WINDOWS

CYGWIN = `ntsec'
HOME = `C:\cygwin\home\robert'
PWD = `/usr/local/bin'

Use `-r' to scan registry

c:  hd  NTFS   76316Mb  47% CP CS UN PA FC     
d:  cd           N/A    N/A                    
e:  fd           N/A    N/A                    
f:  cd           N/A    N/A                    
g:  cd           N/A    N/A                    
h:  hd  NTFS   76316Mb  47% CP CS UN PA FC     
l:  hd  NTFS   76316Mb  47% CP CS UN PA FC     
p:  hd  NTFS   76316Mb  47% CP CS UN PA FC     

C:\cygwin      /          system  binmode
C:\cygwin/bin  /usr/bin   system  binmode
C:\cygwin/lib  /usr/lib   system  binmode
.              /cygdrive  system  binmode,cygdrive

Found: C:\cygwin\bin\awk.exe
Found: C:\cygwin\bin\bash.exe
Found: C:\cygwin\bin\cat.exe
Found: C:\cygwin\bin\cp.exe
Not Found: cpp (good!)
Found: C:\cygwin\bin\find.exe
Not Found: gcc
Not Found: gdb
Found: C:\cygwin\bin\grep.exe
Not Found: ld
Found: C:\cygwin\bin\ls.exe
Not Found: make
Found: C:\cygwin\bin\mv.exe
Found: C:\cygwin\bin\rm.exe
Found: C:\cygwin\bin\sed.exe
Found: C:\cygwin\bin\sh.exe
Found: C:\cygwin\bin\tar.exe

   55k 2004/09/14 C:\cygwin\bin\cygbz2-1.dll
   18k 2004/07/06 C:\cygwin\bin\cygcharset-1.dll
    7k 2003/10/19 C:\cygwin\bin\cygcrypt-0.dll
  839k 2004/09/27 C:\cygwin\bin\cygcrypto-0.9.7.dll
   40k 2004/10/10 C:\cygwin\bin\cygform-8.dll
   45k 2001/04/25 C:\cygwin\bin\cygform5.dll
   35k 2002/01/09 C:\cygwin\bin\cygform6.dll
   48k 2003/08/09 C:\cygwin\bin\cygform7.dll
   28k 2003/07/20 C:\cygwin\bin\cyggdbm-3.dll
   30k 2003/08/11 C:\cygwin\bin\cyggdbm-4.dll
   19k 2003/03/22 C:\cygwin\bin\cyggdbm.dll
   15k 2003/07/20 C:\cygwin\bin\cyggdbm_compat-3.dll
   15k 2003/08/11 C:\cygwin\bin\cyggdbm_compat-4.dll
  107k 2004/07/06 C:\cygwin\bin\cyggettextlib-0-14-1.dll
   17k 2004/07/06 C:\cygwin\bin\cyggettextpo-0.dll
  190k 2004/07/06 C:\cygwin\bin\cyggettextsrc-0-14-1.dll
   17k 2001/06/28 C:\cygwin\bin\cyghistory4.dll
   29k 2003/08/10 C:\cygwin\bin\cyghistory5.dll
   25k 2004/10/12 C:\cygwin\bin\cyghistory6.dll
  991k 2004/07/06 C:\cygwin\bin\cygiconv-2.dll
   22k 2001/12/13 C:\cygwin\bin\cygintl-1.dll
   37k 2003/08/10 C:\cygwin\bin\cygintl-2.dll
   54k 2004/07/06 C:\cygwin\bin\cygintl-3.dll
   22k 2004/10/10 C:\cygwin\bin\cygmenu-8.dll
   26k 2001/04/25 C:\cygwin\bin\cygmenu5.dll
   20k 2002/01/09 C:\cygwin\bin\cygmenu6.dll
   29k 2003/08/09 C:\cygwin\bin\cygmenu7.dll
   15k 2003/11/20 C:\cygwin\bin\cygminires.dll
   74k 2004/10/10 C:\cygwin\bin\cygncurses++-8.dll
  156k 2001/04/25 C:\cygwin\bin\cygncurses++5.dll
  175k 2002/01/09 C:\cygwin\bin\cygncurses++6.dll
  216k 2004/10/10 C:\cygwin\bin\cygncurses-8.dll
  226k 2001/04/25 C:\cygwin\bin\cygncurses5.dll
  202k 2002/01/09 C:\cygwin\bin\cygncurses6.dll
  224k 2003/08/09 C:\cygwin\bin\cygncurses7.dll
   13k 2004/10/10 C:\cygwin\bin\cygpanel-8.dll
   15k 2001/04/25 C:\cygwin\bin\cygpanel5.dll
   12k 2002/01/09 C:\cygwin\bin\cygpanel6.dll
   19k 2003/08/09 C:\cygwin\bin\cygpanel7.dll
   62k 2003/12/11 C:\cygwin\bin\cygpcre-0.dll
   63k 2003/04/11 C:\cygwin\bin\cygpcre.dll
    9k 2003/12/11 C:\cygwin\bin\cygpcreposix-0.dll
   61k 2003/04/11 C:\cygwin\bin\cygpcreposix.dll
   22k 2002/06/09 C:\cygwin\bin\cygpopt-0.dll
  108k 2001/06/28 C:\cygwin\bin\cygreadline4.dll
  148k 2003/08/10 C:\cygwin\bin\cygreadline5.dll
  144k 2004/10/12 C:\cygwin\bin\cygreadline6.dll
  170k 2004/09/27 C:\cygwin\bin\cygssl-0.9.7.dll
   62k 2004/10/10 C:\cygwin\bin\cygz.dll
 1111k 2004/09/05 C:\cygwin\bin\cygwin1.dll
    Cygwin DLL version info:
        DLL version: 1.5.11
        DLL epoch: 19
        DLL bad signal mask: 19005
        DLL old termios: 5
        DLL malloc env: 28
        API major: 0
        API minor: 116
        Shared data: 4
        DLL identifier: cygwin1
        Mount registry: 2
        Cygnus registry name: Cygnus Solutions
        Cygwin registry name: Cygwin
        Program options name: Program Options
        Cygwin mount registry name: mounts v2
        Cygdrive flags: cygdrive flags
        Cygdrive prefix: cygdrive prefix
        Cygdrive default prefix: 
        Build date: Sat Sep 4 23:17:09 EDT 2004
        Shared id: cygwin1S4


Cygwin Package Information
Package              Version            
_update-info-dir     00230-1            
ash                  20040127-1         
base-files           3.0-3              
base-passwd          2.1-1              
bash                 2.05b-16           
bzip2                1.0.2-6            
cron                 3.0.1-13           
crypt                1.1-1              
cygrunsrv            1.0-1              
cygutils             1.2.5-1            
cygwin               1.5.11-1           
cygwin-doc           1.3-7              
diffutils            2.8.7-1            
editrights           1.01-1             
fileutils            4.1-2              
findutils            4.1.7-4            
gawk                 3.1.4-3            
gdbm                 1.8.3-7            
grep                 2.5-1              
groff                1.18.1-2           
gzip                 1.3.5-1            
less                 381-1              
libbz2_1             1.0.2-6            
libcharset1          1.9.2-1            
libgdbm              1.8.0-5            
libgdbm-devel        1.8.3-7            
libgdbm3             1.8.3-3            
libgdbm4             1.8.3-7            
libgettextpo0        0.14.1-1           
libiconv             1.9.2-1            
libiconv2            1.9.2-1            
libintl1             0.10.40-1          
libintl2             0.12.1-3           
libintl3             0.14.1-1           
libncurses5          5.2-1              
libncurses6          5.2-8              
libncurses7          5.3-4              
libncurses8          5.4-1              
libpcre              4.1-1              
libpcre0             4.5-1              
libpopt0             1.6.4-4            
libreadline4         4.1-2              
libreadline5         4.3-5              
libreadline6         5.0-1              
login                1.9-7              
man                  1.5o-1             
minires              0.97-1             
mktemp               1.5-3              
ncurses              5.4-1              
openssh              3.9p1-2            
openssl              0.9.7d-2           
readline             5.0-1              
sed                  4.1.2-1            
sh-utils             2.0.15-4           
tar                  1.13.25-5          
termcap              20021106-2         
terminfo             5.4_20041009-1     
texinfo              4.2-4              
textutils            2.0.21-1           
unison               2.10.2-2           
unzip                5.50-5             
wget                 1.9.1-1            
which                1.5-2              
zip                  2.3-6              
zlib                 1.2.2-1            
Use -h to see help about each section

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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