Thanks for the report, but I can't see why a line like:

if [ ! -z "$PREV_VER" -a $(dpkg --compare-versions "$PREV_VER" lt '4~'; echo 
$?) -eq 0 ]

should fail under dash (which is even the default shell on Debian). You are trying to upgrade 4.2 to 4.2 in this case. Then it should run like:

if [ ! -z "4.2" -a $(dpkg --compare-versions "4.2" lt '4~'; echo $?) -eq 0 ]

and it works perfectly fine under dash. :-?
Could you please verify that /bin/sh links /bin/dash and what is the dash version via dpkg -l ?

On Sat, May 08, 2021 at 09:30:30AM +0200, Paul Menzel wrote:
Package: nis
Version: 4.2
Severity: normal

Dear Debian folks,


I encountered this in Ubuntu [1], but they use the Debian package.

With `/bin/sh` being dash and not Bash, the postinst script fails.

```
$ sudo apt reinstall nis
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
Need to get 14.2 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://de.ports.ubuntu.com/ubuntu-ports hirsute/universe ppc64el nis all 4.2 [14.2 kB]
Fetched 14.2 kB in 0s (110 kB/s)
(Reading database ... 420369 files and directories currently installed.)
Preparing to unpack .../apt/archives/nis_4.2_all.deb ...
update-rc.d: error: unable to read /etc/init.d/nis
Unpacking nis (4.2) over (4.2) ...
Setting up nis (4.2) ...
/var/lib/dpkg/info/nis.postinst: 76: [: -eq: unexpected operator
```

Using `/bin/bash` in the shebang of the postinst script, and doing `dpkg -a --configure` worked around this issue.


Kind regards,

Paul


[1]: https://bugs.launchpad.net/ubuntu/+source/nis/+bug/1927540
[2]: 
https://salsa.debian.org/debian-nis-team/nis/-/blob/master/debian/postinst#L76


--
Francesco P. Lovergine

Reply via email to