FS#15771 - Install scripts fail when default shell (/bin/sh) is not bash
Attached to Project:
Pacman
Opened by Richard Gill (riri) - Monday, 03 August 2009, 13:23 GMT
Last edited by Xavier (shining) - Tuesday, 18 August 2009, 08:54 GMT
Opened by Richard Gill (riri) - Monday, 03 August 2009, 13:23 GMT
Last edited by Xavier (shining) - Tuesday, 18 August 2009, 08:54 GMT
|
Details
Summary and Info:
On my system, I prefer to have a minimal shell (such as /bin/dash) as a default shell (/bin/sh). When doing this, packages which include an install script fail because of a non portable shift instruction. Steps to Reproduce: # cd /bin # rm sh # ln -s dash sh # #reinstalling pacman shows the problem # pacman -S pacman Proposed solutions: Either force bash use when launching the shell command, or provide a shell selection setting in pacman.conf. However, the first solution is to prefer as reviewing all packages would be a mess. I've not taken a look in pacman source files, but I can imagine an 'exec' of '/bin/sh', which should be changed for '/bin/bash'. |
This task depends upon
Closed by Xavier (shining)
Tuesday, 18 August 2009, 08:54 GMT
Reason for closing: Duplicate
Additional comments about closing: FS#13803
Tuesday, 18 August 2009, 08:54 GMT
Reason for closing: Duplicate
Additional comments about closing:
It is also not an Arch bug. Arch supports /bin/sh being bash and so can use bashisms for its install scripts. However, if there are bashisms in the Arch .install scripts and these can be made usable by other shells, I think that such request would be implemented.
Bashisms should be removed if possible from install scripts as Allan mentioned- I would support having a different default /bin/sh but there was a lot of (perceived) resistance last time I tried that. If Ubuntu can do it though...
FS#13803For people who tried using dash a few months ago, I had the same problem, but now this seems ok (at least all init scripts work out of the box). The only remaining problem is with packages.
As I already said in the other two links above, with the current pacman code, the 3 lines at the end of most scriptlets containing the shift can be simply removed.
That means you can fix ALL scriptlets with one simple sed line.
Now if you find other compatibility problems, just open a specific bug report for each problematic package (ideally with a patch)
A setting in pacman.conf is stupid, what would it do? The only thing which makes sense would be to have pacman call explicitely /bin/bash, as you already said. The thread on the ML contains a patch which does that, and also suggestions for improving that patch.
But if we need to do that just because of a shift command which is not even used, it's a pity...
I understand that adding a configuration for one invalid command (used or not) is not really interesting :) However, it's more a way to be more souple, because:
* people wanting an alternate default shell do not have to worry about their shell's compatibility (as long as it's Bourne compatible)
* package maintainers do not have to worry about the default system shell, as long as pacman dicts the shell to use (what would be distro specific) so bash enforcement could be done, while the restriction does not apply to the default shell.
It's not so stupid, it's just another way to see how pacman could apply to any distro, or even to Arch when bash won't be the 'preferred' shell.
I won't check and modify the whole repository database, making a patch for each. The better I can do is to make this check and the patches for packages I use. But each time I'll install a faulty package, I'll have to make another patch, and then reinstall the software (hoping the patch will be applied before my next update). That's not IMHO a good way, but laking other solution, I'll take it.
FS#13803actually has patches for core and extra, but it is probably outdated now.It would be good to know if this was made automatically, or if it also needed some manual fixes (I didn't even look at the patches yet).
And maybe we can do a check by just sourcing all scriptlets in ABS with dash and look for errors.
In any cases, we need to get at least on Arch dev involved..
But I think the discussion can continue on
FS#13803and this one can be closed.I'm not a massive user of Arch - and so do not use ABS (yet). I'll follow the discussion on
FS#13803though.