This is similar to Bug 247933. pathnames.h defines: > /* The default login shell startup file. */ > #define SYS_PROFILE "/etc/profile" This is base, but I would expect to use SYS_PROFILE from LOCALBASE/etc/profile. Especially because /etc/profile is Bourne shell in FreeBSD only. Patch the header file and maybe provide an option to symlink from /etc/profile to LOCALBASE/etc/profile for the ease of migration. This would cleanly decouple this port from base.
As metioned, /etc/profile cannot be a Bash script, had this with "source ..." because it is not sh compatible. At best, profile stays in /usr/local/etc only.
There is a non default ports option for using system wide (SYSBASHRC) configuration in LOCALBASE/etc/bash.bashrc and LOCALBASE/etc/bash.bash_logout.
This is not what I mean. I am referring to: > #define SYS_PROFILE "/etc/profile" From a ports perspective, this should be LOCALBASE/etc/profile.
Created attachment 216473 [details] Using LOCALBASE/etc/profile instead of /etc/profile Got you. Can you try this patch? It worked for me: $ for i in /etc /usr/local/etc; do printf 'echo "Hello from %s/profile"\n' $i > $i/profile; done $ bash -l Hello from /usr/local/etc/profile
Note: This change requires a mention in ports/UPDATING
(In reply to Emanuel Haupt from comment #5) Works for me: 219 openat(AT_FDCWD,"/usr/local/etc/profile",O_RDONLY,00) ERR#2 'No such file or directory' 220 openat(AT_FDCWD,"/root/.bash_profile",O_RDONLY,00) ERR#2 'No such file or directory' 221 openat(AT_FDCWD,"/root/.bash_login",O_RDONLY,00) ERR#2 'No such file or directory' 222 openat(AT_FDCWD,"/root/.profile",O_RDONLY,00) ERR#2 'No such file or directory' Not that readline suffers from the same issue: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=247933
A commit references this bug: Author: ehaupt Date: Thu Jul 16 17:14:53 UTC 2020 New revision: 542373 URL: https://svnweb.freebsd.org/changeset/ports/542373 Log: Cleanly decouple bash from base by reading `profile` from $LOCALBASE/etc/ instead of from /etc. Document this change in UPDATING and provide a migration strategy. PR: 247934 (based on) Submitted by: Michael Osipov <michael.osipov@siemens.com> Changes: head/UPDATING head/shells/bash/Makefile
Change implemented. Thank you again for your input.
Hi, this information needs to go into pkg-message or somesuch - those of us who use packages will never see UPDATING and this caused headscratching across our user base. I'm not arguing against the change - it makes sense - but I've always thought of a drop-in replacement for sh for interactive use, and given the heritage always expected (and got used to) it to read /etc/profile in the same way. Had I been here earlier, I'd have joined the bikeshedding with "Also, a two-stage change might have made sense, with the default initially being old behavior". Alas, too late now. My 2 cents. /Eirik
(In reply to Eirik Oeverby from comment #9) a pkg message makes sense, but the /etc/profile heritage is a GNU one, not a BSD one as far as I remember.