:: Re: [DNG] Danger: Debian POSIX host…
Kezdőlap
Delete this message
Reply to this message
Szerző: Peter Duffy
Dátum:  
Címzett: dng
Tárgy: Re: [DNG] Danger: Debian POSIX hostility
On Tue, 2020-09-22 at 02:20 +0200, marc wrote:
> > One thing about this which strikes me as a bit ironic is debian's use of
> > the dash shell, made to be POSIX-compliant, and so causing endless
> > problems for scripts using bash's additional non-POSIX functionality,
> > but not specifying bash explicitly in the shebang line.
>
> Hmm - that might require some background: I'd venture that
> most of these scripts were written when sh was just a symlink
> to bash, and dash didn't exist, nevermind as a debian
> package.
>
> The word decree is too strong, but at some point debian
> system scripts were supposed to be written to be /bin/dash
> compatible, but instead of changing all existing system scripts
> to start with /bin/bash, and only replacing them
> with /bin/sh once full checked/rewritten, they were kept
> at /bin/sh as people hoped for the best - a quick win.
>
> I, for one, never bought into the reasoning for migrating
> system scripts away from bash to sh. The argument that
> bash is too large struck me as odd - there were critical
> dependencies on perl and python with a much larger dependency
> graph, and much bigger startup costs...
>
> More importantly I think it is good that one uses the same language
> that one types into the terminal every day when extending the
> distribution - that makes a sysadmin equal to the distribution maintainer,
> instead of specialising that into a different caste...
>
> regards
>
> marc


I was bitten by this when the company which I worked for (about 8 years
ago) decided to move their development environment from Red Hat to
Ubuntu - it turned out that the two were so incompatible that we ended
up having to provide each user with separate Red Hat and Ubuntu PCs. But
we still had to make the development system work under both
environments.

Most of the development process was driven by a big suite of
shellscripts. The first we knew that there was a problem was when the
builds under Ubuntu failed with no indication of why. It turned out that
they used bash features - the one which really hit us was the use of
"==" in test expressions (illegal in dash). For some reason (can't
remember why), we couldn't change the shebang, so had to work through
all the scripts and find workarounds for the bash features. It wasn't a
nice task.

My main feeling was one of frustration: bash's new features were
introduced as an improvement, not as a deliberate violation of
standards. Ubuntu/Debian's defaulting to dash just seemed like an act of
puritanism.

The situation became even worse when it was decided to revert to using
bash as the default interactive shell, but keep /bin/sh pointing to
dash. So an admin script would be written, and work fine (in bash) - and
then be set up as a cron task, whereupon it would fail (because it was
now running under dash). OK, the fix was easy - just specify the exact
shell in the shebang - but remembering to do that took some effort for a
while.