FS#13803 - Using /bin/dash as /bin/sh breaks package installing.
Attached to Project:
Arch Linux
Opened by Ramil (gravicappa) - Saturday, 14 March 2009, 13:49 GMT
Last edited by Roman Kyrylych (Romashka) - Saturday, 23 January 2010, 16:49 GMT
Opened by Ramil (gravicappa) - Saturday, 14 March 2009, 13:49 GMT
Last edited by Roman Kyrylych (Romashka) - Saturday, 23 January 2010, 16:49 GMT
|
Details
Description:
When /bin/sh is a symlink do /bin/dash instead of /bin/bash install scripts of some package fail. Although it is written somewhere on forums that it is safe to use dash as /bin/sh interpreter. Packages that was caught failing (listed with error message): coreutils # Syntax error: "(" unexpected e2fsprogs # same fakeroot # shift: 28: can't shift that many gnupg2 # Syntax error: "(" unexpected util-linux-ng # same kernel26 # shift: 145: can't shift that many libbonobo # shift: 22: can't shift that many libidn # Syntax error: "(" unexpected syslog-ng # shift: 13: can't shift that many tar # Syntax error: "(" unexpected Steps to reproduce: - install dash - make /bin/sh a symlink to /bin/dash - try to upgrade by sudo pacman -Syu or install one of packages listed above. |
This task depends upon
Closed by Roman Kyrylych (Romashka)
Saturday, 23 January 2010, 16:49 GMT
Reason for closing: Deferred
Additional comments about closing: 3 new bugreports were opened, 2 are closed already.
Saturday, 23 January 2010, 16:49 GMT
Reason for closing: Deferred
Additional comments about closing: 3 new bugreports were opened, 2 are closed already.
You are welcome to submit patches or bug reports for packages which fail under dash, however
extra.diff.bz2 (10.1 KiB)
they are probably outdated by now
fix-broken (0.3 KiB)
fix-all-broken (0.1 KiB)
I got the same error than this bug report mentions directly in the first one (autoconf). The fact is that 2 kinds of errors occur :
* using array variables, almost for info filelists (this can be easily modified to a portable syntax manually (see commented lines below) :
#filelist=(first.info second.info)
filelist='first.info second.info'
post_install() {
#for file in ${filelist[@]}; do
for file in $filelist; do # or with braces : ${filelist}
...
}
pre_remove() {
#for file in ${filelist[@]}; do
for file in $filelist; do
...
}
* using the shift instruction alone on its line when no argument is specified by pacman : $# -lt 1 - if any argumnt, this could be changed in
if [ $# -gt 0 ]; then
op=$1
shift
$op "$@" # note the "$@" instead of $*, which is a better practice (better management of quoting)
fi
this's more verbose, but the action is still their, and ok if arguments are specified or not to the script
I can try to make a script to do the two mentionned transformations (if all the repos can be checked and modified with that, it would be cool).
However, maybe their are other quirks, I did not tried all install scripts with dash -c ". /var/lib/pacman/local/package_name/install"
388 packages need fixed. So I suggest we start there. I will open separate bug reports for packages in core, extra and community (i.e. 3 bug reports).
I completely overlooked there were so many scripts using arrays, for the info files, and that this was not compatible.
And even if someone commit all these changes, it would still need all packages to be rebuilt. Considering the number of affected packages, it will take ages.
So yeah, maybe pacman should just call /bin/bash :P
I also don't think pacman should call bash, sh *should* be fine... Do the packaging guidelines on the wiki mention not to use bashisms?
Just now, I've removed the legacy lines from scripts in community.