Bug#988227: nis: /var/lib/dpkg/info/nis.postinst: 76: [: -eq: unexpected operator

2021-05-08 Thread Paul Menzel

Dear Francesco,


Am 08.05.21 um 14:19 schrieb Francesco P. Lovergine:

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.


That was only to reproduce the issue. Originally I upgrade from 3.17.1-5.

2021-05-06 08:52:34 upgrade nis:ppc64el 3.17.1-5 4.2


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. :-?


With `set -xe` in `/var/lib/dpkg/info/nis.postinst`:

$ sudo /var/lib/dpkg/info/nis.postinst configure 4.2
+ umask 022
+ PREV_VER=4.2
+ dpkg --compare-versions 4.2 lt 4~
+ [ ! -z 4.2 -a -eq 0 ]
/var/lib/dpkg/info/nis.postinst: 78: [: -eq: unexpected operator
+ rm -f /etc/init.d/nis

Could you please verify that /bin/sh links /bin/dash and what is the 
dash version via dpkg -l ?


```
$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Jan  5 17:47 /bin/sh -> dash
$ dpkg -l dash
Desired=Unknown/Install/Remove/Purge/Hold
| 
Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend

|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name   Version 
Architecture Description

+++-==---=
ii  dash 
0.5.11+git20200708+dd9ef66+really0.5.11+git20200708+dd9ef66-5ubuntu1 
ppc64el  POSIX-compliant shell

```


Kind regards,

Paul



Bug#988227: nis: /var/lib/dpkg/info/nis.postinst: 76: [: -eq: unexpected operator

2021-05-08 Thread Francesco P. Lovergine

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



Bug#988227: nis: /var/lib/dpkg/info/nis.postinst: 76: [: -eq: unexpected operator

2021-05-08 Thread Paul Menzel

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