Package: tzdata
Version: 2022g-1
Severity: normal
X-Debbugs-Cc: ni...@thykier.net
In the postinst, there is the following snippet:
> #! /bin/sh
> set -e
> [...]
# Update the time zone
echo $AREA/$ZONE > "$DPKG_ROOT/etc/timezone"
ln -nsf /usr/share/zoneinfo/$AREA/$ZONE "$DPKG_ROOT/etc/localtime.dpkg-new"
&& \
mv -f "$DPKG_ROOT/etc/localtime.dpkg-new" "$DPKG_ROOT/etc/localtime"
which restorecon >/dev/null 2>&1 && restorecon
"$DPKG_ROOT/etc/localtime"
I think there is a bug in the `which restorecon ...` construct that can
cause termination of the postinst rather than conditional call to
`restorecon`.
As far as I can tell, the construct will "fail" when restorecon is present:
```
which foo >/dev/null 2>&1 && foo ; echo $?
1
```
With `set -e`, this would trigger the postinst to fail and abort the
installation.
I think this case calls for a `if ...; then .. fi` construct or a `!
which ... && ...`.
I feel this ought to be an RC bug. However, given I found this with
(manual) static analysis and no one else complained, I guess this case
is basically never triggered. That is why I have reported as non-RC.
Thanks,
~Niels