[vox-tech] Binary problems

Jeff Newmiller vox-tech@lists.lugod.org
Thu, 26 Feb 2004 13:05:00 -0800 (PST)


On Thu, 26 Feb 2004, Peter Jay Salzman wrote:

> On Thu 26 Feb 04, 12:28 PM, Doctorcam <cam@ellisonet.ca> said:
> > * Jeff Newmiller (jdnewmil@dcn.davis.ca.us) wrote:
> > 
> > > Sounds to me like you want to provide a directory specification for the
> > > executable...
> > > 
> > >    ./primafax_l.bin
> > > 
> > > or
> > > 
> > >    strace ./primafax_l.bin
> > > 
> > 
> > Colour me red - for embarrassment - I knew this, but the brain wasn't
> > working.  Thank you for pointing out what should have been obvious.
> 
> ok, so now *i'm* confused.
> 
> strace showed a call to open() that returned a file descriptor pointing
> to the binary file.  i believe it was fd 4.
> 
> i thought open() returned -1 upon error?

It does.

Cam tried to invoke the program with

  $ primafax_l.bin

but bash complained that it could not find the file:

  bash: primafax_l.bin: command not found

He then tried to give it as an argument to a separate instance of bash... 

  $ sh primafax_l.bin

which tried to interpret it as a shell script and found that it was not
shell script...

  primafax_l.bin: primafax_l.bin: cannot execute binary file

so then he used strace...

  $ strace sh primafax_l.bin

which simply told him the same thing in more detail.

The behavior of the first token on a bash commandline is different than
its behavior when provided as the argument to an instance of bash... bash
interprets the _argument_ as a normal path to a script file... which
amounts to allowing invocation of shell scripts in the current directory.  
When provided as the first token on a commandline, bash is more cautious
if no slashes are present.

---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil@dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...2k
---------------------------------------------------------------------------