Shell scripts on FAT volumes

2007-08-21 Thread Thorsten Kampe
[Cygwin latest snapshot]

I just noticed (on two different Windows XP) Cygwin installation that 
Shebang shell scripts are not executable on FAT32 volumes (like usb 
drives). The mount man page says Normally, files ending in certain 
extensions (.exe, .com,  .bat,  .cmd) are  assumed  to be executable.  
Files whose first two characters begin with  '#!' are also considered 
to be executable.

Is that expected behaviour?


Thorsten


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



Re: Shell scripts on FAT volumes

2007-08-21 Thread yitzle
On 8/21/07, Thorsten Kampe [EMAIL PROTECTED] wrote:
 [Cygwin latest snapshot]

 I just noticed (on two different Windows XP) Cygwin installation that
 Shebang shell scripts are not executable on FAT32 volumes (like usb
 drives). The mount man page says Normally, files ending in certain
 extensions (.exe, .com,  .bat,  .cmd) are  assumed  to be executable.
 Files whose first two characters begin with  '#!' are also considered
 to be executable.

 Is that expected behaviour?


 Thorsten

I created test.sh on my USB key (FAT):

 cat  test.sh  END
#!/usr/bin/bash
echo Test!
END

Then I did
 chmod 700 test.sh

Then I ran it:
 ./test.sh

Worked fine.

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



Re: Shell scripts on FAT volumes

2007-08-21 Thread Corinna Vinschen
On Aug 21 15:37, Thorsten Kampe wrote:
 [Cygwin latest snapshot]
 
 I just noticed (on two different Windows XP) Cygwin installation that 
 Shebang shell scripts are not executable on FAT32 volumes (like usb 
 drives). The mount man page says Normally, files ending in certain 
 extensions (.exe, .com,  .bat,  .cmd) are  assumed  to be executable.  
 Files whose first two characters begin with  '#!' are also considered 
 to be executable.
 
 Is that expected behaviour?

Right now, yes.  I have disabled code which sets the x bit by reading
the first bytes of a file to figure out if it starts with magic chars
like '#!'.  The reason I disabled this code in the first place is the
fact that it's not thread safe.  I even considered it entirely
unnecessary, but apparently it's not.  However, even though the scripts
don't have the x bit set, they are nevertheless executable.  Try it:

  (This is on FAT)
  $ cat  x.sh  EOF
  #!/bin/bash
  echo hallo
  EOF
  $ ls -l x.sh
  -rw-r--r-- 1 corinna users 23 Aug 21 16:55 x.sh
  $ ./x.sh
  hallo
  $


Corinna

-- 
Corinna Vinschen  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader  cygwin AT cygwin DOT com
Red Hat

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



Re: Shell scripts on FAT volumes

2007-08-21 Thread Thorsten Kampe
* yitzle (Tue, 21 Aug 2007 10:42:24 -0400)
 On 8/21/07, Thorsten Kampe [EMAIL PROTECTED] wrote:
  I just noticed (on two different Windows XP) Cygwin installation that
  Shebang shell scripts are not executable on FAT32 volumes (like usb
  drives). The mount man page says Normally, files ending in certain
  extensions (.exe, .com,  .bat,  .cmd) are  assumed  to be executable.
  Files whose first two characters begin with  '#!' are also considered
  to be executable.

 I created test.sh on my USB key (FAT):
 
  cat  test.sh  END
 #!/usr/bin/bash
 echo Test!
 END
 
 Then I did
  chmod 700 test.sh
 
 Then I ran it:
  ./test.sh
 
 Worked fine.

Hm yeah, I was unprecise. Executing works for me, too. But tab 
completion doesn't or something as simple as which startkde for 
scripts in $PATH. Also in start scripts like startxwin.bat I can't 
simply put startkde, I have to say sh /bin/startkde.

Thorsten


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



Re: Shell scripts on FAT volumes

2007-08-21 Thread Corinna Vinschen
On Aug 21 17:00, Corinna Vinschen wrote:
 On Aug 21 15:37, Thorsten Kampe wrote:
  [Cygwin latest snapshot]
  
  I just noticed (on two different Windows XP) Cygwin installation that 
  Shebang shell scripts are not executable on FAT32 volumes
  [...]
  Is that expected behaviour?
 
 Right now, yes.  I have disabled code which sets the x bit by reading
 the first bytes of a file to figure out if it starts with magic chars
 like '#!'.  The reason I disabled this code in the first place is the
 fact that it's not thread safe.

I just applied a patch which re-enables this code in a thread safe manner.


Corinna

-- 
Corinna Vinschen  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader  cygwin AT cygwin DOT com
Red Hat

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