Date: Fri, 05 Apr 2024 09:33:52 +0000 From: bugzilla-noreply@freebsd.org To: ports-bugs@FreeBSD.org Subject: [Bug 278184] shells/bash: /etc/profile is not loaded Message-ID: <bug-278184-7788@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D278184 Bug ID: 278184 Summary: shells/bash: /etc/profile is not loaded Product: Ports & Packages Version: Latest Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: Individual Port(s) Assignee: ehaupt@FreeBSD.org Reporter: thomas.dreibholz@gmail.com Flags: maintainer-feedback?(ehaupt@FreeBSD.org) Assignee: ehaupt@FreeBSD.org Bash does not load /etc/profile since some time. Instead, it expects ${LOCALBASE}/etc/profile. This is possibly intended behaviour now, but may = come unexpected to a user using a Bash shell on a system with system-wide profile settings. Just making a symlink /etc/profile -> /usr/local/etc/profile (as suggested = by https://forums.freebsd.org/threads/what-happened-to-etc-profile.78406/) also does not properly lead to the expected behaviour, since this leads to loadi= ng /etc/profile twice: The issue is that /etc/profile (at least in 14.0-RELEAS= E) is trying to avoid this recursion by checking whether it tries to load itse= lf. But since "/usr/local/etc/profile" is not equal to "/etc/profile", this che= ck fails. If the profile settings are just setting variables, this is probably= not an issue (just a bit of wasted time). However, if making output like a login banner (e.g. using the "td-system-tools" package, which installs /usr/local/etc/profile.d/system-info.sh for this purpose), the output is ma= de twice. A work around is to have a script /usr/local/etc/profile, which checks whet= her it is called by /etc/profile (/etc/profile sets a variable _loaded; if it is set, then just do not try to load /etc/profile again): if [ "${_loaded}" =3D "" ] ; then if [ -e /etc/profile ] ; then . /etc/profile fi fi May be such a /usr/local/etc/profile script should be installed by the Bash package as default, to get the probably expected user behaviour of getting = the system-wide profile settings with Bash shell as well? --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-278184-7788>