"Open terminal here" working directory ignored (gnome-terminal) #9953
Labels
bug
Confirmed bugs or reports that are very likely to be bugs
cli
good first issue
An issue intended for project-newcomers. Varies in difficulty.
os: linux
JabRef version
5.9 (latest release)
Operating system
GNU / Linux
Details on version and operating system
Linux xxx-XPS-13-9360 5.19.0-42-generic #43~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Apr 21 16:51:08 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
Checked with the latest development build
Steps to reproduce the behaviour
Bug
Look at org.jabref.gui.desktop.os.Linux, and note:
The problem is absolutePath (which is toString()'d) is handed is as an extra parameter, which leads to an unexpected version of the desired command.
It's hard to see this from Java debugging because if you dive right in and look at the byte array handed to the native method call ProcessImpl.forkAndExec() -- in your IDE for example -- it will look correct...e.g., "--working-directory=/whatever", because that's String's interpretation of it. But really, there's a 0 byte element in that array after the "=", which some native downstream code interprets as meaning "what's next is another parameter", and not a concatenation to the "=".
So what's really executed is this incorrect command:
gnome-terminal --working-directory= /whatever
Note the white-space. Very easy to reproduce this.
Fix
The fix is easy, do one of the following (obviously for the other shells too if applicable):
cmd = new String[] {"gnome-terminal", "--working-directory=" + absolutePath}; // concatonation, just one parameter
or...
cmd = new String[] {"gnome-terminal", "--working-directory", absolutePath}; // also accepted by gnome-terminal, no equals
Appendix
No response
The text was updated successfully, but these errors were encountered: