[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#490605: Bug#532324: udev init script bash+dashism: assumes printf is a builtin



-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

Debian Policy 10.4 states that shell scripts using a /bin/sh shebang
line must conform to POSIX Shell, with a few (listed) exceptions.

http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html
specifies, under “Command Search and Execution” 1.c, a list of required
shell builtins. I cannot find printf(1) there, or in any other place of
current SUSv3 (online edition), for that matter, except as stand-alone
utility.

udev uses /bin:/sbin as $PATH whereas printf(1) lies in /usr/bin.

udev uses printf nevertheless, assuming it right because GNU bash sup-
ports it and dash, unlike posh (I think) and other Debian Policy 10.4
compliant /bin/sh-capable shells, implements it as a speed hack (lower
boot times combined with portable use of printf, since echo isn’t).

I call for the CTTE to decide that no maintainer is above Policy 10.4
and that udev shall be fixed to not use printf as builtin, or require
a different shebang.


My proposals:


① udev in sid will be changed to use "#!/bin/dash" as shebang;
  udev in lenny will be changed to use "#!/bin/bash" as shebang.
  The change in lenny is necessary, as it is affected as well.


② udev in both sid and lenny will be changed to not use printf
  any more.


Both ① and ② need to override the maintainer’s decision.
I would be most pleased if one of the above were to be decided upon.


③ coreutils will be changed to move /usr/bin/printf to /bin/printf
  and have a /usr/bin/printf@ → ../../bin/printf symbolic link.

  I do not like this. It is non-standard, an evil workaround, and
  will(!) lead to the creation of more unportable scripts.


④ dash will be changed to have the printf builtin removed, so that
  maintainers will be forced to change their scripts.

  I do not like this. Debian uses dash to provide a rather minimal
  /bin/sh for quick system startup. While the presence of a printf
  builtin is a speed hack, it serves this purpose well. Other shells,
  including bash, ksh93, mksh and posh, but not pdksh, can be used
  to validate scripts instead.


⑤ Debian changes policy to allow the use of bash+dash as /bin/sh.

  I do not like this, for similar reasons as in ③, as well as for
  the fact that I fought to have mksh an allowed /bin/sh in Debian,
  which has led to improvements upstream. These may be personal,
  but I expect this proposal to be rejected due to the unportabi-
  lity argument.


I think using printf is okay *as long* as it it possible for the
script to pick it up in /usr/bin/ and *not* rely on an unportable
builtin. The whole point of Policy 10.4 is portability, and maybe
even portability beyond Debian. It _is_ well-known, after all,
that shell and utility "echo" are both unportable. (This serves
as comment to #490605.)

The motion to have maintainer scripts, whether in udev or other
places, fixed so that /bin/sh can be a shell other than GNU bash
or dash, is supported (as in, they don't like the current situa-
tion) by the DDs Alexander Wirt, Gerfried Fuchs, and possibly
others.

Thank you very much for your consideration.

//mirabilos – mksh Debian Maintainer – Project Leader, The MirOS Project
- -- 
I believe no one can invent an algorithm. One just happens to hit upon it
when God enlightens him. Or only God invents algorithms, we merely copy them.
If you don't believe in God, just consider God as Nature if you won't deny
existence.		-- Coywolf Qi Hunt
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MirBSD)

iQIVAwUBSnBN2Ha1NLLpkAfgAQNmxQ//RCMN/DovvBuFp2nGqhm55lccA6iGLUCX
EDUGcwPVX0OdWlESa6UjSswNv75kXyuAY1vX5PW09o9M/6NLQU46L+TOP6ZbGDsz
dunimBEoEhw/YzZU1KkOplX7uCyOB39+cvQ4CmwP9U4N5hIGqlttDkWFO+1fwEWR
yEUQ1W8h0zH9M8APGCwgGf6BbdTE2Cmx4uV+tppZ4xwEhxgH6UvjjGm6KmOsKpfl
OzFIb37hhZbxpyywNzWs7Fw4Ze4PC8UqK/dbzn40LLfbQSob3bDj/dfODX0dpwoL
DmelAZzrdDC5CLJASpXC05Jw3Wo2IgMkaCRWJx6/40SMdA9TKVejSD9LbnCAkamj
M1M3aNdFxOW35GEXaJ4EByXGxCY9wTm93xD/f1j49zIBe/IIrfacpa9AU1YUhwaF
W317xSHDJjXJGwLl5QPWGwxwV9lHvMG7K8rTiR/j/F6lMXwNf3nAQE9JvmRgnhVF
D48LBygx7yXVD97Gtv4N9zv7namCDrBd5BrH4lQu2eAwWrtu5fmhODVxBEuBRt/L
Sqv9ApBZaQmoE2P2ULyaEhpN4qCOi63GBzzEVuB7i2pUCfEdGTqqxP16EhK9bzzN
s1L7mPagKcE2jfx1QsBGFeVafLNFs9WxyKhnjCU8V4Rj4xuCLyNCKLxO1DQw/Jx+
LTP8EfDi1xA=
=1ufg
-----END PGP SIGNATURE-----



Reply to: