question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Open console" with custom command seems to pass %DIR argument wrongly

See original GitHub issue

JabRef 5.0-dev, JabRef–master–latest.jar from 2019.03.23

System details: Arch Linux, i3 window manager, no desktop environment. Java version:

java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)

When using a custom command for “open terminal” the %DIR argument seems to be passed wrongly to the executed command. I’ve tested this with the following two configurations for the “Execute command” field for “Open console” in the settings, with details stated below:

A) “terminator --working-directory=%DIR” B) “thunar %DIR”

A) is fault tolerant, hence also opens if the argument passed after the option is invalid. As a result, the terminal window is opened in the home directory, which is default with Terminator on my system. The interesting thing is that JabRef logs the correct commands to the logs:

INFO  org.jabref.gui.desktop.JabRefDesktop - Executing command "terminator --working-directory=/correct/path/to/library/directory"

When executing this command that JabRef logs outside JabRef in another terminal it correctly opens Terminator at the specified location.

B) is purely for debugging, as Thunar is not fault tolerant here. Thunar reports this error in a UI popup:

Error when getting information for file "/path/to/jabref-master-latest-directory/
%DIR": No such file or directory.

“/path/to/jabref-master-latest-directory/” in the directory where the nightly build of JabRef (JabRef–master–latest.jar) is located. The funny detail is that JabRef logs the correct command here too:

INFO  org.jabref.gui.desktop.JabRefDesktop - Executing command "thunar /correct/path/to/library/directory"...

Hence, the log of JabRef differs from what Thunar seems to get as an argument from JabRef. If the logged command is executed outside JabRef. it again correctly opens Thunar at the specified location. Seems that something causes the log to be different from what actually is passed to the specified external program.

Steps to reproduce the behavior:

  1. In case the bug is Linux related: use JabRef on a Linux system.
  2. Configure the command to be used for “open terminal” to one of options A) or B) above and have the corresponding software installed (Terminator, Thunar) on your system.
  3. In any opened library in JabRef execute “open terminal” --> logs correct command, seems to execute different command.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
geekoverdosecommented, Mar 24, 2019

@deepakkumar96 Thanks, the code explains the issue well. My suggestion would be to do the %DIR replacement directly after whitespace normalization, before anything is “split” towards logging or execution.

1reaction
deepakkumar96commented, Mar 23, 2019

I’ll work on this issue whenever I get time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Displaying Windows command prompt output and redirecting ...
I was able to find a solution/workaround of redirecting output to a file and then to the console: dir > a.txt | type...
Read more >
Use command-line parameters to install Visual Studio
Learn how to use command-line parameters to control or customize your Visual Studio installation.
Read more >
django-admin and manage.py
Runs the command-line client for the database engine specified in your ENGINE setting, with the connection parameters specified in your USER , PASSWORD...
Read more >
Console Commands (Symfony Docs)
Its purpose is to check if some of the options/arguments are missing and interactively ask the user for those values. This is the...
Read more >
Command-Line Interface - Gradle User Manual
If you run gradle — mytask --profile=exampleValue , Gradle passes --profile as a task option. Executing tasks in multi-project builds. In a multi-project...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found