[Bug 1078124] New: Logging into graphical desktop (kde) should not source .bashrc
http://bugzilla.opensuse.org/show_bug.cgi?id=1078124 Bug ID: 1078124 Summary: Logging into graphical desktop (kde) should not source .bashrc Classification: openSUSE Product: openSUSE Distribution Version: Leap 42.3 Hardware: Other OS: Other Status: NEW Severity: Normal Priority: P5 - None Component: Basesystem Assignee: bnc-team-screening@forge.provo.novell.com Reporter: christian.herenz@astro.su.se QA Contact: qa-bugs@suse.de Found By: --- Blocker: --- I am very confused about the fact, that lines in ${HOME}/.bashrc can break the start up of the graphical desktop (KDE in my case) in openSUSE. In https://bugzilla.opensuse.org/show_bug.cgi?id=1004769 it was suggested to file a bug against base, which I do here. In above bug it is described how adding a line in the .bashrc that appends another directory to the PATH variable completely causes the plasma desktop not to start any more. However, a non-interactive login shell, that should be spawned upon logging into a graphical desktop should be completely ignorant of the contents of ${HOME}/.bashrc. Afaik, the standard practice is to source ${HOME}/.profile and there the use has the option to control whether the local bashrc should be sourced or not. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1078124
Christian Herenz
http://bugzilla.opensuse.org/show_bug.cgi?id=1078124
Roeland Jansen
http://bugzilla.opensuse.org/show_bug.cgi?id=1078124
http://bugzilla.opensuse.org/show_bug.cgi?id=1078124#c1
Christian Herenz
# There are 3 different types of shells in bash: the login shell, normal shell # and interactive shell. Login shells read ~/.profile and interactive shells # read ~/.bashrc; in our setup, /etc/profile sources ~/.bashrc - thus all # settings made here will also take effect in a login shell.
Therefore, there is no way to use .bashrc in its intended way, as a configuration file for interactive non-login shells, as all changes made to .bashrc will also affect login shells. I also tried to find how this is implementeted: The relevant part in /etc/profile is: if test -z "$_SOURCED_FOR_SSH" ; then # # System BASH specials, maybe also good for other shells # Note that ksh always reads /etc/ksh.kshrc # if test "$is" != ksh -a "$is" != zsh ; then test -r /etc/bash.bashrc && . /etc/bash.bashrc fi if test -n "$restricted" ; then readonly _HOMEBASHRC=true fi if test "$is" = "bash" -a -z "$_HOMEBASHRC" ; then # loop detection readonly _HOMEBASHRC=true test -r $HOME/.bashrc && . $HOME/.bashrc fi The variable $_SOURCED_FOR_SSH is defined from /etc/bash.bashrc: if test \( -n "$SSH_CONNECTION" -o -n "$SUDO_COMMAND" \) -a -z "$PROFILEREAD" ; then _SOURCED_FOR_SSH=true . /etc/profile > /dev/null 2>&1 unset _SOURCED_FOR_SSH fi So, if I understand above logic correctly, ${HOME}/.bashrc is always sourced in /etc/profile, except when connecting via SSH or doing a sudo (cases which will invoke /etc/bash.bashrc). Thus in a standard non-login shell "test -z "$_SOURCED_FOR_SSH" " evaluates to true and ~/.bashrc is sourced. Best regards, Christian -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1078124
http://bugzilla.opensuse.org/show_bug.cgi?id=1078124#c2
Jon Brightwell
systemd --switched-root --system --deserialize 27 `-sddm `-sddm-helper --socket /tmp/sddm-auth366a4f38-dd02-4289-a79c-78919a31b534 >--id 1 --start /usr/bin/startkde --user test- `-bash --login -c exec "${@}" - /etc/X11/xdm/sys.xsession `-bash --login -c exec "${@}" - /etc/X11/xdm/sys.xsession `-pstree -Aas 2188
from this script in .bashrc
a=`date` b=`pstree -Aas $PPID` echo $a$`\n` "$b" $'\n' >> /tmp/somerandomfile
-- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1078124
http://bugzilla.opensuse.org/show_bug.cgi?id=1078124#c3
--- Comment #3 from Christian Herenz
http://bugzilla.opensuse.org/show_bug.cgi?id=1078124
http://bugzilla.opensuse.org/show_bug.cgi?id=1078124#c4
--- Comment #4 from Jon Brightwell
http://bugzilla.opensuse.org/show_bug.cgi?id=1078124
http://bugzilla.opensuse.org/show_bug.cgi?id=1078124#c5
Jon Brightwell
http://bugzilla.opensuse.org/show_bug.cgi?id=1078124
http://bugzilla.opensuse.org/show_bug.cgi?id=1078124#c6
Ruediger Oertel
http://bugzilla.opensuse.org/show_bug.cgi?id=1078124
http://bugzilla.opensuse.org/show_bug.cgi?id=1078124#c9
--- Comment #9 from Christian Herenz
http://bugzilla.opensuse.org/show_bug.cgi?id=1078124
http://bugzilla.opensuse.org/show_bug.cgi?id=1078124#c10
--- Comment #10 from Christian Herenz
Sorry, your argument about other users opening bugs, which can clearly resolved by pointing to the relevant with a WONTFIX, makes absolutely no sense to me. Right now opensuse does it in a way that is clearly not documented (only in the /etc/skel/.bashrc) - all other documentation that (bash manpage, bash manual, SLES documentation) clearly outlines how it should work.
Of course there is an workaround for your abuse of ~/.bashrc as a configuration file, something like
[ -z "$PS1" ] && return
Put this at the at of your .bashrc and nothing will be executed from this file in your login shell. (this could be mentioned in the default /etc/skel/.bashrc). But this a openSUSE'ism ! Other *nix don't need this, and every software documentation (let me remind you, that this basically rendered openSUSE for tech-unexpeirenced anaconda users unusable). Your comment about fixing the .profile makes no sense either, as there is no distinction between .profile and .bashrc anymore, since you source both in a login-shell. Exactly, this is the bug. If this gets fixed in the intended way, users for which stuff breaks should move their lines that they want to be executed in a login shell to .profile! -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1078124
http://bugzilla.opensuse.org/show_bug.cgi?id=1078124#c11
--- Comment #11 from Christian Herenz
http://bugzilla.opensuse.org/show_bug.cgi?id=1078124
http://bugzilla.opensuse.org/show_bug.cgi?id=1078124#c13
Keith Hizal
http://bugzilla.opensuse.org/show_bug.cgi?id=1078124
http://bugzilla.opensuse.org/show_bug.cgi?id=1078124#c14
--- Comment #14 from Dr. Werner Fink
I'm not sure if this is a side effect of this bug or not, but attempting to put "exec fish" into the bashrc causes no desktop environment to load, Xorg or Wayland.
Ahmm ... why you're breaking the bash start/login chain? There is always a method to break a system yes. If you want an other use shell then please use the system tools which are /etc/shells (see man 5 shell) and the command chsh (see man 1 chsh). See the scripts below /etc/X11/xdm for usage of exec within (ba)sh code to either handle file descriptors or replace the current shell with an other final program. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1078124
http://bugzilla.opensuse.org/show_bug.cgi?id=1078124#c15
--- Comment #15 from Dr. Werner Fink
participants (1)
-
bugzilla_noreply@novell.com