|Summary:||shells/bash: profile is not read from LOCALBASE|
|Product:||Ports & Packages||Reporter:||Michael Osipov <michael.osipov>|
|Component:||Individual Port(s)||Assignee:||Emanuel Haupt <ehaupt>|
|Severity:||Affects Some People||CC:||michael.osipov|
Description Michael Osipov 2020-07-12 17:05:35 UTC
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.
Comment 1 Michael Osipov 2020-07-15 07:32:11 UTC
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.
Comment 2 Emanuel Haupt 2020-07-15 14:37:27 UTC
There is a non default ports option for using system wide (SYSBASHRC) configuration in LOCALBASE/etc/bash.bashrc and LOCALBASE/etc/bash.bash_logout.
Comment 3 Michael Osipov 2020-07-15 15:22:13 UTC
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.
Comment 4 Emanuel Haupt 2020-07-15 16:42:01 UTC
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
Comment 5 Emanuel Haupt 2020-07-15 16:48:59 UTC
Note: This change requires a mention in ports/UPDATING
Comment 6 Michael Osipov 2020-07-15 18:13:20 UTC
(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
Comment 7 commit-hook 2020-07-16 17:15:13 UTC
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 <firstname.lastname@example.org> Changes: head/UPDATING head/shells/bash/Makefile
Comment 8 Emanuel Haupt 2020-07-16 17:17:13 UTC
Change implemented. Thank you again for your input.