By Jake Edge
May 26, 2010
A report that a thousand or more Debian packages will no longer build from
source would be a cause for concern at any time, but when the project is
trying to button
up for a release, it is especially unwelcome. It turns out that the
initial estimates were overblown, but that a change in the dash
shell to make it POSIX-compliant, exposed a number of
"bash-isms" that
had crept into the Debian build scripts. In the process of tracking things
down, various problems with checkbashisms were found as well.
As reported to debian-devel by Raphael
Geissert, the dash shell recently changed:
dash recently added support for the magic variable $LINENO, which was the last
piece to make it POSIX compliant. However, this change made the autoconf-generated configure scripts use dash to execute the script's code. Without
support for LINENO, configure scripts exec to bash automatically.
That caused multiple Debian packages to "fail to build from source"
(FTBFS). Geissert's estimate for the number of packages affected was
a rather eye-opening 1504. That led Petter Reinholdtsen to ask:
What about reverting this change in dash until after Squeeze is
released? Now [seems] like a bad time to make thousand of packages in
Debian fail to build from source. :)
Several folks pointed him at the bug
report, where that plan was being put into action. The newer
dash was
put into the experimental release tree, while the unstable—eventual
Squeeze—tree got a dash without the POSIX upgrade.
The original move to dash was done for performance and
POSIX-compliance reasons. At the time, it broke various things because
scripts that specified /bin/sh were really written to run with
bash and did not conform to the POSIX shell standard. The
checkbashisms script was developed to help find these problems so
that they could be fixed. Unfortunately, as the Debian folks just found,
checkbashisms produces a lot of false positives as well as some
false negatives.
As it turns out, building the archive with both the old and the new
dash yielded
a list of "only" 124 packages that failed to build. Still a concern, but not one
that merited the
outcry that the first message elicited. Neil Williams was rather annoyed both at the dash change and
the original report: "(I've heard of off-by-one errors but
off-by-one-order-of-magnitude is a
stretch.) [...]
Please, let's get some accurate figures before raising things like
this." But as David Weinhall points
out, the underlying problem is not with dash at all:
You're getting things the wrong way around. The version of dash that
will be put in experimental will be the correct one, the one in unstable
will be the crippled one. The reason things [fail] isn't because of
dash, but because of sloppy programming on behalf of people that still
believe that bash is the say all and end all when it comes to shell
scripts.
But Lucas Nussbaum, who ran the comparative archive builds, wondered about the whole exercise of removing
bash-isms from the Debian build scripts. He is concerned that a
lot of work is being done for POSIX-compliance which "only a minority
of users care" about and to shave a few seconds from boot time.
Was is really the right path to follow? Wouldn't it have been easier to
work on bash to make sure that it supports everything POSIX requires,
and to improve its performance a bit?
Now we are going to patch configure scripts to make sure that they can
run correctly with dash. What's next? Rewrite C programs that use
GCC-specific extensions?
There is quite a list of commonly used bash-isms on the page about
the dash move linked above. For good or ill, bash is the
shell that many folks use and test under. The fact that it will happily
run /bin/sh scripts that have used bash extensions is
perhaps unfortunate in some ways, but it's also something that isn't going
to change. In order for Debian to stay dash-pure, it will require
an ongoing effort to patch the build scripts that come from upstream. It
may be that there are better uses of Debian developers' time.
(
Log in to post comments)