FS#67990 - append_path not defined when Zsh is loading `/etc/profiled.d/` scripts

Attached to Project: Arch Linux
Opened by Joshua Ellis (JP-Ellis) - Friday, 25 September 2020, 01:16 GMT
Last edited by Doug Newgard (Scimmia) - Friday, 25 September 2020, 01:23 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To No-one
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

# Description

When Bash loads, the scripts within `/etc/profiled.d/` are loaded within the `/etc/profile` script which defines `append_path`. Zsh on the other hand sources this script directory from `/etc/zsh/zshenv` which does *not* define this append_path function.

This is causing an issue with a [recent update](https://github.com/archlinux/svntogit-packages/commit/14b4244f492b77f59e2f03f6774d12615da5ec73#diff-8d0411b338c83cd8cd8ad9d9db127101) to the perl package as it is making using of `append_path`. I'm not sure whether this is a bug from the Perl package to assume the function exists, or whether it is a bug in Zsh not to load /etc/profile first.


## Additional info

### Package Versions

- zsh 5.8-1
- perl 5.32.0-3

### Steps to reproduce

Launch zsh
This task depends upon

Closed by  Doug Newgard (Scimmia)
Friday, 25 September 2020, 01:23 GMT
Reason for closing:  Not a bug
Additional comments about closing:  Use the forums, IRC, or mailing lists for support
Comment by Doug Newgard (Scimmia) - Friday, 25 September 2020, 01:21 GMT
perlbin.sh is being sourced from /etc/profile, so append_path *must* be available. How in the world are you sourcing things in /etc/profile.d/ if not from /etc/profile?

Edit: you're doing it from /etc/zsh/zshenv? That file doesn't exist by default on Arch. You're doing things wrong.
Comment by Eli Schwartz (eschwartz) - Friday, 25 September 2020, 03:13 GMT
The zsh package only provides /etc/zsh/zprofile which does one thing and only one thing -- source /etc/profile (and let that handle profile.d scripts).

Furthermore, according to Google and https://unix.stackexchange.com/questions/71253/what-should-shouldnt-go-in-zshenv-zshrc-zlogin-zprofile-zlogout , zshenv is sourced on every single shell start, like bash does for .bashrc, whereas zprofile is (like the name suggests) sourced only once, on login, just like bash does for .bash_profile and /etc/profile itself. So not only is this your bug, not Arch's bug, for manually sourcing profile.d directly, and not only is it a waste of time since the package's default configs do this for you... you're using the documented-incorrect file to do these one-time-only updates.

Loading...