FS#72953 - [josm] new runtime flags required

Attached to Project: Community Packages
Opened by lnnz (lnnz) - Wednesday, 08 December 2021, 17:11 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:03 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Jaroslav Lichtblau (Dragonlord)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 6
Private No

Details

Description:
The josm package has new runtime flags required by the upstream developers. These are only required for some functionality, and the lack of them does not make the package unusable.

Additional info:
* package version(s): 18303-1
* config and/or log files etc.
* link to upstream bug report, if any: https://josm.openstreetmap.de/ticket/21649

Steps to reproduce:

* open josm
* open history on a way
* press Help
* bug report window appears and Help window does not load
This task depends upon

Closed by  Buggy McBugFace (bugbot)
Saturday, 25 November 2023, 20:03 GMT
Reason for closing:  Moved
Additional comments about closing:  https://gitlab.archlinux.org/archlinux/p ackaging/packages/josm/issues/1
Comment by lnnz (lnnz) - Wednesday, 08 December 2021, 17:13 GMT Comment by lnnz (lnnz) - Wednesday, 08 December 2021, 17:17 GMT
Runtime flag required by upstream is:

--add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED
Comment by Taylor Smock (taylor.smock) - Sunday, 10 April 2022, 09:48 GMT
The fix did not fully solve the issue.
See https://josm.openstreetmap.de/ticket/21989 .
See also https://josm.openstreetmap.de/browser/josm/trunk/native/linux/tested/usr/bin/josm for a known good start script (Debian).
Comment by Taylor Smock (taylor.smock) - Wednesday, 25 May 2022, 14:26 GMT
Additional comment: I've got a ticket that makes the upstream start script more agnostic (see https://josm.openstreetmap.de/ticket/22088 ). Is there anything missing from your perspective that would make it easier to use the upstream start script?
Comment by Taylor Smock (taylor.smock) - Monday, 01 August 2022, 13:49 GMT
Can you please revert https://github.com/archlinux/svntogit-community/commit/ef93f762186a93115ac574fc708d13f6bf57cb8f? Specifically with respect to the `JOSM_ARGS` environment variable -- it does not work on machines using Java 8 as the default.

Also, adding `install -Dm755 $pkgname/native/linux/tested/usr/bin/josm "${pkgdir}"/usr/bin/josm` should remove the need for https://github.com/archlinux/svntogit-community/blob/packages/josm/trunk/PKGBUILD#L43-L56 (and the need to try to manually work around differences in Java versions).
Comment by NicoHood (NicoHood) - Wednesday, 31 August 2022, 18:54 GMT
Hi Taylor,
thanks a lot for helping us out!

I've tried your fixes and I get the error:
Error: Unable to access jarfile /usr/share/josm/josm.jar

The file does not exist, the correct path seems to be:
/usr/share/java/josm/josm.jar

Does this need to get fixed in josm or our package? What is your suggestion?

@jlichtblau Would it be okay for you, if I co-maintain the package? Where do you get the changelog from and why is it even in our svn? Is it important?
Comment by Taylor Smock (taylor.smock) - Wednesday, 31 August 2022, 19:03 GMT
No problem.

The script reads environment variables, so setting `JOSM_PATH=/usr/share/java/josm/josm.jar` in the environment (or in `/etc/default/josm`, sourced via `. "/etc/default/${JOSM_VERSION}"`) should work.

The path to JOSM is set with `JOSM_PATH="${JOSM_PATH:-/usr/share/${JOSM_VERSION}/${JOSM_VERSION}.jar}"`

The other env setting of interest might be for javafx, `JAVAFX_HOME="${JAVAFX_HOME:-/usr/share/openjfx/lib}"`.

I tried to make the script as configurable as possible for downstream users when I was fiddling with it a few months back.
Comment by Taylor Smock (taylor.smock) - Wednesday, 23 November 2022, 17:58 GMT
@NicoHood: I finally sat down and figured out everything that needed to be done for the Arch package. It wasn't as easy as I thought -- Arch puts the JavaFX modules in with the rest of the JVM modules, which leads to interesting error messages if JAVAFX_HOME is set to the path where the JavaFX modules are.

Anyway, if the attached patch is applied, JOSM will start and run properly.
Comment by Taylor Smock (taylor.smock) - Monday, 09 January 2023, 13:51 GMT
Ping
Comment by Eugene Dvoretsky (radioxoma) - Sunday, 05 March 2023, 10:12 GMT
Had to delete `JOSM_ARGS="--add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED"` from `/etc/conf.d/josm` to make it work again.
Comment by NicoHood (NicoHood) - Sunday, 04 June 2023, 15:58 GMT
Hi! Sorry for getting really late to this bug.

@Taylor: Why do we need to set the JOSM_PATH via sed in the startup script. Isnt adding it in the config better? That sounds more correct to me, however it does not work at all. I guess the reason is, that previously this config was loaded with the custom startup script. Doesnt it make sense to keep it?
```
[ -f /etc/conf.d/josm ] && . /etc/conf.d/josm
```

With your other fix I get the error at startup:
ls: cannot access '/usr/lib/jvm/default-runtime/lib/javafx*.jar': No such file or directory

This turns out, because the sed command is not written correct and the newline will expand. This is what the script contains:
```
JAVAFX_HOME="$(ls /usr/lib/jvm/default-runtime/lib/javafx*.jar | tr "
" ":" | sed 's/.$//')"
```

If I remove that, no error will occur. So is this "hack" even needed???

You have also added java-openjfx as a new dependency. Is that required? For me josm also starts without that dependency.
Comment by Taylor Smock (taylor.smock) - Monday, 05 June 2023, 12:22 GMT
> Why do we need to set the JOSM_PATH via sed in the startup script. Isnt adding it in the config better?
I'm not a disto packager, but I would think that it would be better to have sane defaults, in case the user deletes the config file.

> With your other fix I get the error at startup:
That is funny. It worked for me when I tested. Does `/usr/lib/jvm/default-runtime/lib/` exist? The only reason for the `JAVAFX_HOME="$(ls [...])"` was because I couldn't just set the `JAVAFX_HOME` variable to the directory; there were some issues with double loading modules.

> If I remove that, no error will occur. So is this "hack" even needed???
JavaFX is _not_ required by JOSM itself. Plugins may require JavaFX. Of note, there is the `javafx` plugin which pretty much just adds an audio player and some utility classes, and then Microsoft Streetside which uses JavaFX for cubemapping 360 images.

> You have also added java-openjfx as a new dependency. Is that required? For me josm also starts without that dependency.
So the answer is _technically_ no, it is not required for base functionality, but it is required for some plugins.
Comment by Malte (malteger) - Friday, 04 August 2023, 12:58 GMT
For me the startup script from the package currently in the repos is also not working, I get the following error:

```
Using /usr/bin/java to execute josm.
Error occurred during initialization of boot layer
java.lang.module.FindException: Module javafx.web not found
```

It works if I uncomment the last sed line in the PKGBUILD (the newline is expanded, but this works regardless.)

The error (`ls: cannot access '/usr/lib/jvm/default-runtime/lib/javafx*.jar': No such file or directory`) is caused by the failing glob. One can simplify that to a simple echo (as the glob does the expansion on itself), paired with `shopt -s noglob` there will only be an empty string if there are no matching files.
Thus

sed -i '5 aJAVAFX_HOME="$(shopt -s nullglob && echo /usr/lib/jvm/default-runtime/lib/javafx*.jar | tr " " ":")"' "${pkgdir}/usr/bin/josm"

in the PKGBUILD works also but should not generate an error (and fall back to the default in the start script, but I do not know if that causes any problems)

Maybe java-openjfx should at least be added to optdepends?
Comment by NicoHood (NicoHood) - Sunday, 15 October 2023, 07:10 GMT
Sorry for coming back late here and thanks for all the answers.

@taylor.smock
Why did you comment that line?

sed -i 's/--module-path ${JAVAFX_HOME} //' "${pkgdir}/usr/bin/josm"

@malteger thanks for that fix!

I've updated the package once more with those fixes. I will try to update the version itself now.
Comment by Taylor Smock (taylor.smock) - Monday, 16 October 2023, 12:34 GMT
I think I was trying to say `If the JavaFX modules were automatically loaded by the JVM, we could just remove the `--module-path ${JAVAFX_HOME}` line, here is the sed command`

Loading...