Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#43896 - [jdk7-openjdk] 7.u75_2.5.4-1 Usage of "sudo" in install script

Attached to Project: Arch Linux
Opened by Anton S (fluffylime) - Friday, 20 February 2015, 15:48 GMT
Last edited by Guillaume ALAUX (galaux) - Sunday, 01 March 2015, 16:40 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Guillaume ALAUX (galaux)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

While removing package jdk7-openjdk I noticed that a error was produced at post_remove stage. Inspecting the install script (it's located in split-package java7-openjdk) revealed the root of the error - sudo was used to perform some actions (copy-paste error, I guess).

Additional info:
* package version(s) => 7.u75_2.5.4-1

Steps to reproduce:
1. login as root into an arch machine/container without sudo
2. pacman -Sy jdk7-openjdk
3. pacman -Rsn jdk7-openjdk

Here are relevant pacman output and part of the jdk7-openjdk.install script:

=== pacman -Rsn jdk7-openjdk ===
checking dependencies...

Packages (13) java-environment-common-2-2 java-runtime-common-2-2 jre7-openjdk-7.u75_2.5.4-1 jre7-openjdk-headless-7.u75_2.5.4-1 lcms2-2.6-1
libcups-2.0.2-1 libjpeg-turbo-1.4.0-1 libpng-1.6.16-1 libtiff-4.0.3-5 nspr-4.10.8-1 nss-3.17.4-1 sqlite-3.8.8.2-1
jdk7-openjdk-7.u75_2.5.4-1

Total Removed Size: 110.43 MiB

:: Do you want to remove these packages? [Y/n]
/tmp/alpm_WUQW8A/.INSTALL: line 45: sudo: command not found
/tmp/alpm_WUQW8A/.INSTALL: line 47: sudo: command not found
error: command failed to execute correctly
( 1/13) removing jdk7-openjdk [########################################################] 100%
=== cut ===

=== tail -n 8 b/java7-openjdk/jdk7-openjdk.install ===
pre_remove() {
if [ "x$(fix_default)" = "x${THIS_JDK}" ]; then
/usr/bin/archlinux-java unset
if [ -x /usr/lib/jvm/${THIS_JDK}/jre/bin/java ]; then
/usr/bin/archlinux-java set ${THIS_JDK}/jre
fi
fi
}
=== end ===
This task depends upon

Closed by  Guillaume ALAUX (galaux)
Sunday, 01 March 2015, 16:40 GMT
Reason for closing:  Fixed
Additional comments about closing:  Fixed in upcoming version of packages for OpenJDK7 and 8
Comment by Anton S (fluffylime) - Friday, 20 February 2015, 15:55 GMT
Oh, sorry, I've put a quote of already fixed install script in the description... Here goes the original:

=== tail -n 8 a/java7-openjdk/jdk7-openjdk.install ===
pre_remove() {
if [ "x$(fix_default)" = "x${THIS_JDK}" ]; then
sudo /usr/bin/archlinux-java unset
if [ -x /usr/lib/jvm/${THIS_JDK}/jre/bin/java ]; then
sudo /usr/bin/archlinux-java set ${THIS_JDK}/jre
fi
fi
}
=== end ===

I've attached a patch that fixes this error.
Comment by Guillaume ALAUX (galaux) - Sunday, 01 March 2015, 16:39 GMT
Fixed in trunk. As these scripts are run as root anyway, these sudo are superfluous but are not a security issue. I am thus not going to push a new version just for this, the fixes will be shipped in the next OpenJDK7 and OpenJDK8 release.
Thanks for this.

Loading...