Need Simple Way To Determine If File Is Executable

Fredrik Lundh fredrik at pythonware.com
Wed Dec 20 07:33:20 EST 2006


Sebastian 'lunar' Wiesner wrote:

>> you're confusing the shell's "is this file executable" check with the
>> loader's "can I execute this file" check:
>>
>> $ export PATH=.:$PATH
>> $ dd if=/dev/zero of=ls count=1
>> 1+0 records in
>> 1+0 records out
>> $ ls -l ls
>> -rw-rw-r--  1 slab slab 512 Dec 20 03:33 ls
>> $ chmod a+x ls
>> $ ls
>> -bash: ./ls: cannot execute binary file
> 
> ???
> Am I blind or is there really no difference between you shell example an
> mine?
> As far as I can see, you are doing exactly the same thing as I did...

no, I'm showing that a local file marked as executable overrides a 
shared one, even if the local file isn't actually an executable.

> So what are trying to proof?

that you're wrong when you claim that the contents of the file matters 
when using the usual Unix conventions to check if a file is executable.

maybe you should read Tim's post and the post he replied to again?

</F>




More information about the Python-list mailing list