Community Packages

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#75345 - [sweethome3d] startup script is wrong

Attached to Project: Community Packages
Opened by Sergio Callegari (callegar) - Saturday, 16 July 2022, 14:55 GMT
Last edited by Muflone (muflone) - Sunday, 31 July 2022, 23:09 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Muflone (muflone)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

The sweethome3d startup script tries to detect the java version with

JAVA_VERSION="$(${JAVA_EXEC} -version 2>&1 | head -1 | cut -d' ' -f 3 | tr -d '"')"

however, when you have some environment variable that is picked up by java, such as _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on this detection logic fails poorly and JAVA_VERSION starts getting set to weird values such as '_JAVA_OPTIONS' because java outputs as the first line something about the picking up of the variable.

Something more robust than `head -1` is needed here.


Additional info:
* package version(s)
* config and/or log files etc.
* link to upstream bug report, if any

Steps to reproduce:
This task depends upon

Closed by  Muflone (muflone)
Sunday, 31 July 2022, 23:09 GMT
Reason for closing:  Fixed
Additional comments about closing:  fixed in 7.0.2-1
Comment by Simon Rose (Popkornium18) - Wednesday, 20 July 2022, 10:06 GMT
This can be fixed by replacing `head -1` with `grep '^openjdk version'`.
Comment by Muflone (muflone) - Sunday, 31 July 2022, 21:25 GMT
Hi

Could you please write here an example of failed detection and the whole java -version output?
Comment by Sergio Callegari (callegar) - Sunday, 31 July 2022, 22:03 GMT
> java -version
Picked up _JAVA_OPTIONS: -Dswing.aatext=TRUE -Dawt.useSystemAAFontSettings=on
openjdk version "18.0.2" 2022-07-19
OpenJDK Runtime Environment (build 18.0.2+9)
OpenJDK 64-Bit Server VM (build 18.0.2+9, mixed mode)
Comment by Sergio Callegari (callegar) - Sunday, 31 July 2022, 22:09 GMT
Not seeing the issue anymore... now `java -version 2>&1 | head -1 | cut -d' ' -f 3 | tr -d '"'` correctly returns 18.0.2 regardless of the antialiasing options.
Sorry for the noise...
Comment by Muflone (muflone) - Sunday, 31 July 2022, 23:08 GMT
replaced with

${JAVA_EXEC} -version 2>&1 | grep ' version ' | head -1 | cut -d' ' -f 3 | tr -d '"'

so it will use the first line containing the string ' version '
In my tests this works fine from jre6 to jre18 and from jdk11 to jdk18

Loading...