Arch Linux

Please read this before reporting a bug:

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!

FS#66339 - [java-runtime-common] ash profile script doesn't check if $PATH variable contains jvm path

Attached to Project: Arch Linux
Opened by Jakub Nowak (MrQubo) - Tuesday, 21 April 2020, 14:55 GMT
Last edited by freswa (frederik) - Tuesday, 21 April 2020, 16:55 GMT
Task Type Bug Report
Category Packages: Extra
Status Assigned
Assigned To Levente Polyak (anthraxx)
Architecture All
Severity Very Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 2
Private No



The `` script adds new path to the $PATH env variable but it doesn't check if this path isn't already there.
The `profile_jre.csh` doesn't check this as well.

Note that `/etc/profile` from `core/filesystem` ( does this properly using `appendpath()`.

I'm using tmux and the jvm path ends up in $PATH twice.
This task depends upon

Comment by Levente Polyak (anthraxx) - Thursday, 23 April 2020, 18:33 GMT
what does tmux have to do with that? I'm using tmux as well and only end up with a single /usr/lib/jvm/default/bin in my $PATH. None of the profile scripts do such checks, only login shells are supposed to read the profile, once.
Comment by Jakub Nowak (MrQubo) - Friday, 24 April 2020, 17:56 GMT
How are you starting tmux? I've just checked it on a completely fresh archlinux and after I start it by simply invoking `tmux` command the jvm path is duplicated.
Comment by Jakub Nowak (MrQubo) - Friday, 24 April 2020, 17:58 GMT
Do you suggest I should report this as an issue to tmux developers?
Comment by Levente Polyak (anthraxx) - Friday, 24 April 2020, 20:56 GMT
try something like

set -g default-shell /usr/bin/zsh
set -g default-command /usr/bin/zsh

in your config?
Comment by Jakub Nowak (MrQubo) - Saturday, 25 April 2020, 08:56 GMT
Oh, I've always used only `default-shell` but it seems that `default-shell` should only be used when using tmux as login shell. `default-command` fixed the issue of duplicate path entries for me.

I still think that it will be more robust to check if the path isn't already present in the $PATH env variable as default `/etc/profile` does.
Comment by B (4xfn) - Thursday, 31 December 2020, 18:09 GMT
I use login shells by default because of some logic in .bash_logout/.zlogout that should run after each shell and also noticed the duplicate /usr/lib/jvm/default/bin PATH entries coming from /etc/profile.d/ To avoid this the perl package uses the `append_path` method from the /etc/profile script: so using `append_path /usr/lib/jvm/default/bin` instead of `export PATH=${PATH}:/usr/lib/jvm/default/bin` should fix this issue.
Comment by Scott B (arglebargle) - Friday, 10 December 2021, 16:24 GMT
re: "None of the profile scripts do such checks, only login shells are supposed to read the profile, once."

@anthraxx /etc/profile's 'append_path' function exists now to solve exactly this issue, it's available to every script run from /etc/profile.d.

I made the following edits to on my local machine:

-export PATH=${PATH}:/usr/lib/jvm/default/bin
+append_path '/usr/lib/jvm/default/bin'
+export PATH