hello,
when i invoke update-menu on a debian jessie system without the bash
shell being installed the following error is shown:
# update-menus -d -v
sh: 1: exec: /bin/bash: not found
Unknown error, message=exec /bin/bash -o pipefail -c 'dpkg-query --show
--showformat="\${status} \${provides} \${package}\n" | sed -n -e
"/installed\|triggers-awaited\|triggers-pending
/{s/^.*\(installed\|triggers-awaited\|triggers-pending\) *//; s/[, ][,
]*/\n/g; p}"'
when setting an alternative to the dash shell it results in this error:
# update-menus -d -v
update-menus[22707]: Dpkg is not locking dpkg status area, good.
update-menus[22707]: Reading installed packages list...
/bin/bash: 0: Illegal option -o pipefail
Unknown error, message=exec /bin/bash -o pipefail -c 'dpkg-query --show
--showformat="\${status} \${provides} \${package}\n" | sed -n -e
"/installed\|triggers-awaited\|triggers-pending
/{s/^.*\(installed\|triggers-awaited\|triggers-pending\) *//; s/[, ][,
]*/\n/g; p}"'
this is caused by an hardcoded dependency on the bash shell that is not
mentioned in the packages dependency list.
best regards,
gabriel
# uname -a
Linux 3.16-2-amd64 #1 SMP Debian 3.16.3-2 (2014-09-20) x86_64 GNU/Linux
# dpkg -s libc6 | grep '^Version'
Version: 2.19-11
Hello Gabriel,
bash is marked 'Essential: yes' so according to Debian policy, packages
ust not add dependencies on bash.
See policy 3.5:
Packages are not required to declare any dependencies they have on
other packages which are marked `Essential' (see below), and should
not do so unless they depend on a particular version of that
package.[1]
And 10.4:
If a shell script requires non-SUSv3 features from the shell
interpreter other than those listed above, the appropriate shell must
be specified in the first line of the script (e.g., `#!/bin/bash') and
the package must depend on the package providing the shell (unless the
shell package is marked "Essential", as in the case of `bash').
In this instance, bash is required because I do not know how to implement
the equivalent of '-o pipefail' with a POSIX shell.
Cheers,
Hi Bill, thanks for pointing this out. I did not know how to ipmlement pipefail in a POSIX conformal way either and searching on the internet didn't give me any results of interest for this situation. But in general I think it should be possible to circumvent the pipefail here by storing the results of the dpkg query in some sort of structure and process it with C++-style string routines. I'm not sure whether I'll find the time to do the programming for that but would you be interested at all? Cheers, Gabriel
Yes, it is rather a shame POSIX sh does not provide a simple way to get the return status of the first pipe element. Sure, if this is not too wordy. Cheers, Bill.