Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] Why fakeroot works without #! (basically, RTFM)
@ 2016-06-08 10:08 Brian Foster
  2016-06-09 21:36 ` Yann E. MORIN
  0 siblings, 1 reply; 2+ messages in thread
From: Brian Foster @ 2016-06-08 10:08 UTC (permalink / raw)
  To: buildroot


Hi!

  I happened to notice in very recent commit 974e83a8f9a1
  ("fs: add sha-bang to fakeroot script") the comment:
    
    ? We [are] directly running this script, so it should start
     with a sha-bang (not sure why/how it works today...). ?

  What is running the (generated) fakeroot script being talked
  about is the the Host script .../usr/bin/fakeroot, which is a
  GNU bash script.  The answer then is in ??COMMAND EXECUTION'
  of the bash(1) manual page:

    ? If [the exec()] fails because the file is not in executable
     format, and  the file is not a directory, it is assumed to be
     a shell script, a file containing shell commands.  A subshell
     is spawned to execute it. [...] ?

  Or in other words, the traditional Unix shell behaviour of:
  If exec() failed with errno ENOEXEC on a plain file, Then
  assume it is a script written in the language of the shell
  trying to run the script, and run it in a subshell.

  As an aside, that means the commit 974e83a8f9a1 has changed the
  semantics.  The generated fakeroot script used to always be run
  by the GNU bash shell, but now it is run by `/bin/sh' which may
  not be bash (e.g., on my system, it is dash(1)).  However, this
  _probably_ does not matter, since, as I recall, POSIX(?) requires
  `/bin/sh' to implement the Bourne shell language, which is what
  the generated script uses, and what both dash and bash provide.

cheers!
	-blf-

-- 
Brian Foster
Principal MTS, Software        |  La Ciotat, France
Maxim Integrated               |  http://www.maximintegrated.com/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-09 21:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-08 10:08 [Buildroot] Why fakeroot works without #! (basically, RTFM) Brian Foster
2016-06-09 21:36 ` Yann E. MORIN

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox