Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#57323 - [filesystem] sourcing /etc/profile.d/locale.sh from /etc/profile fails

Attached to Project: Arch Linux
Opened by Ivan Gut (ivanarch) - Thursday, 01 February 2018, 13:15 GMT
Last edited by Doug Newgard (Scimmia) - Friday, 02 February 2018, 15:12 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To No-one
Architecture All
Severity Very Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description: there's a small problem with file /etc/profile.d/locale.sh that is sourced from /etc/profile

The last command in /etc/profile/locale.sh is:
[ -n "$LC_IDENTIFICATION" ] && export LC_IDENTIFICATION

The problem is that the very last command fails if the LC_IDENTIFICATION environ var is undefined or empty.

Additional info:
* package version(s): 2017.10-2

Steps to reproduce:
The original 26th line of /etc/profile is:
test -r "$profile" && . "$profile"

To detect the bug modify that line to:
test -r "profile" && if . "$profile" ; then echo "INFO: $profile sourced succesfully" ; else echo "ERROR: $profile source failed" ; fi

Solution:
Add a last line with a command that always exist successfully, for example the command "true".
This task depends upon

Closed by  Doug Newgard (Scimmia)
Friday, 02 February 2018, 15:12 GMT
Reason for closing:  Not a bug
Comment by Doug Newgard (Scimmia) - Thursday, 01 February 2018, 16:07 GMT
Why is this a problem?
Comment by loqs (loqs) - Thursday, 01 February 2018, 17:54 GMT
$ printenv LC_IDENTIFICATION

locale from filesystem 2017.10-2 (core)
$ ./locale.sh
$ echo $?
1
locale from filesystem 2018.1-2 (testing)
$ ./locale.sh
$ echo $?
0
Comment by Doug Newgard (Scimmia) - Thursday, 01 February 2018, 18:06 GMT
Just realized the last post wasn't from the OP. Question stands, why is this a problem?
Comment by Eli Schwartz (eschwartz) - Friday, 02 February 2018, 02:38 GMT
This should never be an issue unless e.g. your *interactive* shell uses `set -e` which seems rather broken...
Comment by Ivan Gut (ivanarch) - Friday, 02 February 2018, 09:26 GMT
Doug, this is not really a problem if working with unmodified /etc/profile and the associated scripts never fail their executions; the locale environment sourced succesfully anyways.

But I modified the /etc/profile to do some checks, with some commands that can rasonably fail, for example testing the exit code of sourcing various scripts in a for loop. If these scripts failed, I get noticed.

Example code:

## /etc/profile
## Executed by login shells.

userlog ()
{
logger --tag "user:$UID" --id $$ --priority "${PRIO:-user.info}" "$@"
}
...
...
...

for P in /etc/profile.d/*.sh ; do
if . "$P" ; then
userlog "INFO: File sourced: '$P'"
else
PRIO='user.warning' userlog "WARNING: Failed sourcing file: '$P'"
fi
done
unset P
...
...
...
Comment by Evangelos Foutras (foutrelis) - Friday, 02 February 2018, 13:37 GMT
This issue should fix itself when the current filesystem package leaves [testing]:

https://git.archlinux.org/svntogit/packages.git/tree/trunk/locale.sh?h=packages/filesystem

EDIT: Basically what loqs pasted. :P

Loading...