/etc/profile.d/*.sh executed twice
-
- Warlord
- Posts: 787
- Joined: 04 Jan 2014, 04:27
- Distribution: Porteus 5.0 x64 OpenBox
- Location: NZ
- Contact:
/etc/profile.d/*.sh executed twice
Post#1 by rych » 23 Oct 2017, 07:30
/etc/profile.d/*.sh scripts sourced at the end of /etc/profile,
appear to be executed twice.
I know it because I amend the $PATH in a /etc/profile.d/myprofile.sh, and then in a fresh terminal echo $PATH displays my amendment twice.
rych
-
- Shogun
- Posts: 217
- Joined: 18 Aug 2013, 12:09
- Distribution: Slackware PartedMagic Xubuntu
- Location: The Netherlands
/etc/profile.d/*.sh executed twice
Post#2 by burdi01 » 25 Oct 2017, 09:33

burdi01
/etc/profile.d/*.sh executed twice
Post#3 by jssouza » 25 Oct 2017, 10:20
Code: Select all
guest@porteus:~$ cat .bash_profile
# Use settings from ~/.bashrc
if [ -f ~/.bashrc ]; then
source ~/.bashrc
figuest@porteus:~$ cat .bashrc
# Setup color scheme for list call <brokenman>
alias ll='/bin/ls --color=auto -lF'
alias la='/bin/ls --color=auto -axF'
alias ls='/bin/ls --color=auto -xF'
# Append any additional sh scripts found in /etc/profile.d/:
for y in /etc/profile.d/*.sh ; do [ -x $y ] && . $y; done
unset y
# Setup shell prompt for guest <wread and fanthom>
PS1='\[\033[01;36m\]\u@\h:\[\033[01;32m\]\w\$\[\033[00m\] '
PS2='> '
jssouza
-
- Shogun
- Posts: 217
- Joined: 18 Aug 2013, 12:09
- Distribution: Slackware PartedMagic Xubuntu
- Location: The Netherlands
/etc/profile.d/*.sh executed twice
Post#4 by burdi01 » 25 Oct 2017, 12:22
However for a user-extensible distribution like Porteus that is not a complete solution. Instead the profile.d scripts should cater for possible "cumulative" effects. E.g.:
Code: Select all
if ! echo "$PATH" | grep -qE "(^|.*:)mydir(:|$)" ; then
export $PATH="$PATH:mydir"
fi
Code: Select all
if ! echo "$LD_LIBRARY_PATH" | grep -qE "(^|.*:)mydir(:|$)" ; then
export $LD_LIBRARY_PATH="$LD_LIBRARY_PATH${LD_LIBRARY_PATH:+:}mydir"
fi

burdi01
-
- Warlord
- Posts: 787
- Joined: 04 Jan 2014, 04:27
- Distribution: Porteus 5.0 x64 OpenBox
- Location: NZ
- Contact:
/etc/profile.d/*.sh executed twice
Post#5 by rych » 28 Oct 2017, 04:31
I've removed these lines from .bashrc.
Code: Select all
# Append any additional sh scripts found in /etc/profile.d/:
for y in /etc/profile.d/*.sh ; do [ -x $y ] && . $y; done
unset y
rych
-
- Shogun
- Posts: 217
- Joined: 18 Aug 2013, 12:09
- Distribution: Slackware PartedMagic Xubuntu
- Location: The Netherlands
/etc/profile.d/*.sh executed twice
Post#6 by burdi01 » 28 Oct 2017, 09:50
As elaborated upon in section 6.2 "Bash Startup Files" of the Bash Reference Manual (which can be downloaded/read from e.g. https://www.gnu.org/software/bash/manual/bash.html) you may or may not be breaking something.Or am I now breaking something else?

burdi01
-
- Warlord
- Posts: 787
- Joined: 04 Jan 2014, 04:27
- Distribution: Porteus 5.0 x64 OpenBox
- Location: NZ
- Contact:
/etc/profile.d/*.sh executed twice
Post#7 by rych » 13 Feb 2021, 12:19
rych
burdi01
- Blaze
- DEV Team
- Posts: 3998
- Joined: 28 Dec 2010, 11:31
- Distribution: ⟰ Porteus current ☯ all DEs ☯
- Location: ☭ Russian Federation, Lipetsk region, Dankov
- Contact:
/etc/profile.d/*.sh executed twice
Post#9 by Blaze » 14 Feb 2021, 10:57

Thanks.
MS-7A12 » [AMD/ATI] Navi 23 [Radeon RX 6600] [1002:73ff] (rev c7) » Vengeance LPX 16GB DDR4 K2 3200MHz C16
Blaze
-
- Warlord
- Posts: 787
- Joined: 04 Jan 2014, 04:27
- Distribution: Porteus 5.0 x64 OpenBox
- Location: NZ
- Contact:
/etc/profile.d/*.sh executed twice
Post#10 by rych » 15 Feb 2021, 07:32
How did you fix this particular issue, which file to edit?
I'd like to finally upgrade from porteus 4. Would you advise to start using 5.0rc2 now as it could take another year to wait for Slackware to go to 15 and porteus to go to 5.0 release?
rych
- ncmprhnsbl
- DEV Team
- Posts: 4293
- Joined: 20 Mar 2012, 03:42
- Distribution: v5.0-64bit
- Location: australia
- Contact:
/etc/profile.d/*.sh executed twice
Post#11 by ncmprhnsbl » 15 Feb 2021, 09:28
same as what you did:
"removed these lines from (home/guest/) .bashrc."
Code: Select all
# Append any additional sh scripts found in /etc/profile.d/:
for y in /etc/profile.d/*.sh ; do [ -x $y ] && . $y; done
unset y

about rc2: there's been a lot of movement in slackware current since rc2 release(aug 2020), not least python and quite few key packages as well as our script rewrite to pygobject3 is further along ... so .. it's pretty likely an rc3 will be put out before slackware goes final or even beta.. at the moment, i'm watching the slackware current changelog: expecting a mass package rebuild for the latest glibc currently in testing..
ncmprhnsbl
- Blaze
- DEV Team
- Posts: 3998
- Joined: 28 Dec 2010, 11:31
- Distribution: ⟰ Porteus current ☯ all DEs ☯
- Location: ☭ Russian Federation, Lipetsk region, Dankov
- Contact:
/etc/profile.d/*.sh executed twice
Post#12 by Blaze » 18 Feb 2021, 18:25
Yepncmprhnsbl wrote: ↑15 Feb 2021, 09:28same as what you did:
"removed these lines from (home/guest/) .bashrc."
MS-7A12 » [AMD/ATI] Navi 23 [Radeon RX 6600] [1002:73ff] (rev c7) » Vengeance LPX 16GB DDR4 K2 3200MHz C16
Blaze
/etc/profile.d/*.sh executed twice
Post#13 by skladby » 23 Oct 2021, 19:50
- At login /etc/profile is read with the sourcing
- Also at login ~/.bashprofile is read which sources ~/.bashrc with the sourcing
- Then in any user invoked shell ~/.bashrc is read with the sourcing
Following in ~/.bashrc and therefore also ~/.bashprofile sourcing stops after "user.sh", i.e. "vdpau.sh", "vdpau-va-gl.sh", and "xdg.sh" are not sourced by ~/.bashrc and ~/.bashprofile. The reason is a wrong "break 2" instruction in "user.sh", breaking also out from the sourcing "for" loop, so all scripts following after "user.sh" in alphabetical order are not sourced. The break is only triggered if a logged-in user exists, i.e. not in /etc/profile - good for those who want to use freedesktop.org compliant "$XDG_RUNTIME_DIR" (defined in "xdg.sh"). This fragile construction should in general be replaced by a stable architecture. Currently the historical "parallelism" with csh seems to be valued higher - obviously without currently offering (t)csh anywhere in Porteus land (is it really needed?)
Note that "fully" restricts to those scripts / files in /etc/profile.d with "x" attribute set - the affected sourcing routines require it (is this really intended?).
skladby