[sudo-users] sudo tag SUDO_1_9_1: in scripts/pp --probe gives inconsistent results on Redhat and Oracle Linux version 8.2
Andy W.
andreww35t at gmail.com
Wed Jun 24 13:10:26 MDT 2020
Hello,
Minor issue found during mkpkg rpm build script: I noticed that when
building sudo packages building RHEL/OL 8, the mkpkg and pp scripts fail
due to differing numbers of columns in the /etc/redhat-release file. It
appears that in major version 8 they took out the word "Server" from
/etc/redhat-release. I am sure there can be no way to anticipate all
messes that might be found in /etc/*release files. It is probably
impossible to get every case, but maybe have it fail gracefully or set safe
defaults if the characters in the "$pp_rpm_distro" variable do not match a
numeric pattern. Another idea might be to try the VERSION_ID property in
the /etc/os-release file before trying the /etc/redhat-release file.
The problematic awk is on line 5565 of the pp script
<https://github.com/sudo-project/sudo/blob/820d6ae207a0df8b85acf8f684cccfde72016445/scripts/pp#L5565>
as
of github commit 820d6ae207a0df8b85acf8f684cccfde72016445.
Here is the same awk just run in my shell on OL8.2/RHEL8.2 vs OL7.8/RHEL7.8
to demonstrate:
The bad (same result on both Oracle Linux and Redhat Linux both at v8.2):
$ cat /etc/redhat-release
> Red Hat Enterprise Linux release 8.2 (Ootpa)
> $ awk '
> /^Red Hat Enterprise Linux/ { print "rhel" $7; exit; }
> /^CentOS release/ { print "centos" $3; exit; }
> /^CentOS Linux release/ { print "centos" $4; exit; }
> /^Red Hat Linux release/ { print "rh" $5; exit; }
> ' /etc/redhat-release
> rhel(Ootpa)
> $ cat /etc/redhat-release |awk '{print "rhel" $7}'
> rhel(Ootpa)
>
The good on RHEL and OL 7.8 (Notice the 8 columns in /etc/redhat-release
instead of 7):
$ cat /etc/redhat-release
> Red Hat Enterprise Linux Server release 7.8 (Maipo)
> $ awk '
> /^Red Hat Enterprise Linux/ { print "rhel" $7; exit; }
> /^CentOS release/ { print "centos" $3; exit; }
> /^CentOS Linux release/ { print "centos" $4; exit; }
> /^Red Hat Linux release/ { print "rh" $5; exit; }
> ' /etc/redhat-release
> rhel7.8
> $ cat /etc/redhat-release |awk '{print "rhel" $7}'
> rhel7.8
>
>
It causes this failure when building the package with "./scripts/mkpkg
--enable-openssl --with-ldap --enable-python"
#<snip>
> Building for target x86_64
> error: line 3: Illegal char ')' (0x29) in: Release: 1.elrhel(Ootpa)
> pp: error Problem creating RPM packages
> pp: error Problem predicting RPM filename:
> sudo-1.9.1-1.elrhel(Ootpa).x86_64.rpm
> pp: error Errors during backend processing
> pp: error Errors during cleanup
> Building target platforms: x86_64
> Building for target x86_64
> error: line 3: Illegal char ')' (0x29) in: Release: 1.elrhel(Ootpa)
> pp: error Problem creating RPM packages
> pp: error Problem predicting RPM filename:
> sudo-logsrvd-1.9.1-1.elrhel(Ootpa).x86_64.rpm
> pp: error Errors during backend processing
> pp: error Errors during cleanup
> Building target platforms: x86_64
> Building for target x86_64
> error: line 3: Illegal char ')' (0x29) in: Release: 1.elrhel(Ootpa)
> pp: error Problem creating RPM packages
> pp: error Problem predicting RPM filename:
> sudo-python-1.9.1-1.elrhel(Ootpa).x86_64.rpm
> pp: error Errors during backend processing
> pp: error Errors during cleanup
> make: *** [Makefile:379: package] Error 1
TIA and fI hope it helps.
Thanks.
Andy West
Sysadmin
More information about the sudo-users
mailing list