patch to 15.0 /etc/profile and /etc/profile.d for Bourne errors during login
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
patch to 15.0 /etc/profile and /etc/profile.d for Bourne errors during login
/etc/profile "contains system-wide defaults used by all Bourne (and related) shells".
This is mostly true. Most of /etc/profile and its children in /etc/profile.d is strictly compliant to Bourne. A few non-Bourne idioms have crept in. The patches below prevent Bourne shell from throwing errors during login.
Code:
--- /etc/profile.orig 2021-08-30 18:05:00.000000000 +0000
+++ /etc/profile 2023-01-03 20:28:31.530389919 +0000
@@ -2,9 +2,9 @@
# all Bourne (and related) shells.
# Set the values for some environment variables:
-export MINICOM="-c on"
-export HOSTNAME="`cat /etc/HOSTNAME`"
-export LESSOPEN="|lesspipe.sh %s"
+export MINICOM ; MINICOM="-c on"
+export HOSTNAME ; HOSTNAME="`cat /etc/HOSTNAME`"
+export LESSOPEN ; LESSOPEN="|lesspipe.sh %s"
# Setting a default $LESS was something inherited from SLS many years ago,
# but apparently the previous setting of "-M" causes display issues with
# some programs (i.e. git log). Adding "-R" as well fixes this, but some
@@ -12,11 +12,11 @@
# actually "-r" that's the dangerous one). Anyway, it might be best to just
# leave this unset by default. Uncomment it if you like, or set up your
# own definition or aliases on a per-account basis.
-#export LESS="-M -R"
+#export LESS ; LESS="-M -R"
# If the user doesn't have a .inputrc, use the one in /etc.
if [ ! -r "$HOME/.inputrc" ]; then
- export INPUTRC=/etc/inputrc
+ export INPUTRC ; INPUTRC=/etc/inputrc
fi
# Set the default system $PATH:
@@ -59,7 +59,7 @@
PS1='%n@%m:%~%# '
elif [ "$SHELL" = "/bin/ash" ]; then
PS1='$ '
-else
+elif [ "$SHELL" = "/bin/bash" ]; then
PS1='\u@\h:\w\$ '
fi
PS2='> '
Code:
--- /etc/profile.d/coreutils-dircolors.sh.orig 2021-09-27 17:59:53.000000000 +0000
+++ /etc/profile.d/coreutils-dircolors.sh 2023-01-03 20:44:15.796769438 +0000
@@ -29,7 +29,13 @@
# when it encounters whitespace. The '=' flag will fix this.
# see zshexpn(1) man-page regarding SH_WORD_SPLIT.
alias ls='/bin/ls ${=LS_OPTIONS}'
-else
+elif [ "$SHELL" = "/bin/bash" ] ; then
+ alias ls='/bin/ls $LS_OPTIONS'
+elif [ "$SHELL" = "/bin/pdksh" ] ; then
+ alias ls='/bin/ls $LS_OPTIONS'
+elif [ "$SHELL" = "/bin/ksh" ] ; then
+ alias ls='/bin/ls $LS_OPTIONS'
+elif [ "$SHELL" = "/bin/ash" ] ; then
alias ls='/bin/ls $LS_OPTIONS'
fi
Code:
--- /etc/profile.d/lang.sh.orig 2022-03-14 14:47:01.722115263 +0000
+++ /etc/profile.d/lang.sh 2023-01-03 20:47:08.156749226 +0000
@@ -3,14 +3,17 @@
# For a list of locales which are supported by this machine, type:
# locale -a
+export LANG
+export LC_COLLATE
+
# en_US is the Slackware default locale:
-#export LANG=en_US
+#LANG=en_US
# 'C' is the old Slackware (and UNIX) default, which is 127-bit
# ASCII with a charmap setting of ANSI_X3.4-1968. These days,
# it's better to use en_US or another modern $LANG setting to
# support extended character sets.
-#export LANG=C
+#LANG=C
# There is also support for UTF-8 locales, but be aware that
# some programs may possibly misbehave under UTF-8. In those
@@ -23,10 +26,10 @@
#
# UTF-8 locales will include "UTF-8" in the output.
#
-export LANG=en_US.UTF-8
+LANG=en_US.UTF-8
# Another option for en_US:
-#export LANG=en_US.ISO8859-1
+#LANG=en_US.ISO8859-1
# One side effect of the newer locales is that the sort order
# is no longer according to ASCII values, so the sort order will
@@ -34,7 +37,7 @@
# can break scripts, we'll stick with traditional ASCII sorting.
# If you'd prefer the sort algorithm that goes with your $LANG
# setting, comment this out.
-export LC_COLLATE=C
+LC_COLLATE=C
# End of /etc/profile.d/lang.sh
Code:
--- /etc/profile.d/libglib2.sh.orig 2021-09-01 17:51:06.000000000 +0000
+++ /etc/profile.d/libglib2.sh 2023-01-03 20:48:36.914253884 +0000
@@ -16,10 +16,10 @@
# Determine if the locale is UTF-8:
if locale charmap 2> /dev/null | grep -q UTF-8 ; then
- export G_FILENAME_ENCODING="@locale"
+ export G_FILENAME_ENCODING ; G_FILENAME_ENCODING="@locale"
fi
# It doesn't hurt to export this since G_FILENAME_ENCODING takes priority
# over G_BROKEN_FILENAMES:
-export G_BROKEN_FILENAMES=1
+export G_BROKEN_FILENAMES ; G_BROKEN_FILENAMES=1
Code:
--- /etc/profile.d/vdpau.sh.orig 2015-03-14 21:20:20.000000000 +0000
+++ /etc/profile.d/vdpau.sh 2023-01-03 20:51:04.886095376 +0000
@@ -1,22 +1,24 @@
#!/bin/sh
# Disable debugging output of the vdpau backend
-export VDPAU_LOG=0
+export VDPAU_LOG ; VDPAU_LOG=0
+
+export VDPAU_DRIVER
# Use the vdpau backend of the nvidia binary driver
-#export VDPAU_DRIVER="nvidia"
+#VDPAU_DRIVER="nvidia"
# Use the vdpau backend of the nouveau driver
-#export VDPAU_DRIVER="nouveau"
+#VDPAU_DRIVER="nouveau"
# Use the vdpau backend of the r300 driver
-#export VDPAU_DRIVER="r300"
+#VDPAU_DRIVER="r300"
# Use the vdpau backend of the r600 driver
-#export VDPAU_DRIVER="r600"
+#VDPAU_DRIVER="r600"
# Use the vdpau backend of the radeonsi driver
-#export VDPAU_DRIVER="radeonsi"
+#VDPAU_DRIVER="radeonsi"
# Use the va-api/opengl backend
-#export VDPAU_DRIVER="va_gl"
+#VDPAU_DRIVER="va_gl"
True, you found some bashismes, BUT from what I know - and I use Linux since really long time (and not necessarily Slackware), the variables export fully compatible with the Bourne Shell should be something like this
Code:
VDPAU_LOG=0
export VDPAU_LOG
Please note that the variable is exported after it's set.
On contrary, you do something like this
Code:
export VDPAU_LOG ; VDPAU_LOG=0
I do not think this is correct.
Even IF this works (which I sincerely doubt), God knows what shell you use if it accepts this....
Last edited by LuckyCyborg; 01-05-2023 at 05:56 AM.
Distribution: Slackware64 {15.0,-current}, FreeBSD, stuff on QEMU
Posts: 459
Rep:
I'm a little curious about the coreutils-dircolors.sh patch.
I know the list of shells in the "elif" statements comes from /etc/profile, but it seems a bit counter-intuitive to leave other shells without an ls alias (particularly dash, which, although a counter-intuitive choice for an interactive shell, comes with a full installation of Slackware; /bin/ash is now a symlink to /bin/dash anyway). pdksh was the original Slackware *ksh, but it doesn't seem to have been provided for over twenty years.
I looked all the way back to SLS to see if I could blame that false statement on somebody else. ;-) It still doesn't strike me as something I'd write, but who knows -- it's old in any case.
This is probably the only patch that's needed:
Code:
--- /etc/profile.orig 2021-08-30 13:05:00.000000000 -0500
+++ /etc/profile 2023-01-05 13:50:32.436240429 -0600
@@ -1,5 +1,6 @@
# /etc/profile: This file contains system-wide defaults used by
-# all Bourne (and related) shells.
+# the GNU Bourne-Again SHell (/bin/bash) and others that are
+# sufficiently compatible.
# Set the values for some environment variables:
export MINICOM="-c on"
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.