Arch Linux

Please read this before reporting a bug:

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

REPEAT: Do NOT report bugs for outdated packages!

FS#24953 - [zsh] /etc/profile should not replace /etc/zprofile and conflicts between /etc files and docs.

Attached to Project: Arch Linux
Opened by David J. Haines (dhaines) - Wednesday, 29 June 2011, 16:02 GMT
Last edited by Allan McRae (Allan) - Friday, 16 November 2012, 11:45 GMT
Task Type Bug Report
Category Upstream Bugs
Status Closed
Assigned To Pierre Schmitz (Pierre)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 6
Private No



The PKGBUILD for zsh includes "--enable-zprofile=/etc/profile," the inclusion of which breaks zsh, according to the specifications laid out in zsh(1).

Essentially, /etc/profile is not supposed to be looked at by zsh, but rather by sh and bash. Zsh takes this into account by using /etc/profile (so as to allow zsh-specific syntax and commands in the file without breaking bash). Arch is supposed to rely on not changing things from their defaults (part of KISS), and this doesn't do that.

If you must change it from /etc/zprofile, at least call it /etc/zsh/zprofile.

Accompanying this issue is the fact that zsh's manpages need to be updated to reflect the Arch-specific changes, lest users not be able to use system-wide init files. The PKGBUILD puts some stuff in /etc/zsh/, while the manpages refer to /etc/.

Essentially, the package as it stands defies the documentation. One of them needs to be fixed.
This task depends upon

Closed by  Allan McRae (Allan)
Friday, 16 November 2012, 11:45 GMT
Reason for closing:  Fixed
Additional comments about closing:  only upstream documentation issue remains
Comment by Fabian Homborg (alfa) - Friday, 05 August 2011, 16:48 GMT
Some info:
See  FS#8946  :
"Again, zsh is built with --enable-zprofile=/etc/profile so profile is sourced when you use a login shell." - Xavier (shining)
/etc/profile is provided by filesystem, and by default sources /etc/bash.bashrc ONLY when $BASH is set (at least in filesystem 2011.04-1),
so this should be zsh compatible.

If you want zsh configuration in /etc/profile you should add similar lines using $ZSH_NAME or something like it.

The documentation however, is another thing.

EDIT: Attached default profile from filesystem 2011.04-1
   profile (0.5 KiB)
Comment by Rémy Oudompheng (remyoudompheng) - Sunday, 21 August 2011, 12:29 GMT
If zsh allows changing the name of /etc/zprofile and does not automatically modifies its documentation to match the compilation options, it is an upstream bug.
Comment by David J. Haines (dhaines) - Thursday, 25 August 2011, 14:47 GMT
Why not just keep the default for zsh (using /etc/zshprofile) and add an /etc/zshprofile that sources /etc/profile. Different administrators may want zsh to use a different profile-like file than bash, and that'd let them do it.
Comment by Mark (voidzero) - Thursday, 25 August 2011, 19:11 GMT
I was about to report this bug when I found it has already been opened. zsh should not be configured to use /etc/profile. Instead, archlinux could provide an /etc/zsh/zprofile which contains something like "emulate sh -c 'source /etc/profile'". The current approach breaks archlinux philosophy and package standards. If you want an uncommon location for zprofile, create an aur package, "this' jus' silly".
Comment by Mark (voidzero) - Thursday, 01 September 2011, 23:43 GMT
Hi, me again. I love it when there are made no decisions on easy to fix bugs.

So, to help the discussion forward, let's not "reimplement the wheel". These people were in the same boat as we,
though, they were already in this boat in 2008.

Comment by Nick Bowler (nbowler) - Thursday, 08 September 2011, 20:14 GMT
Furthermore, the stock /etc/profile is rather broken wrt. zsh.

Looking at the version here:

* It unconditionally clobbers a number of environment variables that may
have been set by the user's zshenv (lines 7, 24, 27).
* It uses an unadorned * glob, which is an error by default in zsh
if there are no matches (line 12).
* It does not enable sh compatibility mode before sourcing other scripts in
/etc/profile.d (line 13).

Please don't force zsh to use the same startup scripts as bash. I was quite
surprised to discover that the reason my shell was not working properly was
because my zprofile was not being run! I have not encountered any other
distro which does this.

As a workaround, putting the following at the top of /etc/profile restores sane

if test x"$ZSH_VERSION" != x; then
. /etc/zsh/zprofile

Comment by Alexander F. Rødseth (xyproto) - Sunday, 11 November 2012, 21:28 GMT
Is this still an issue?
Comment by David J. Haines (dhaines) - Monday, 12 November 2012, 14:36 GMT
It looks like the central issue has been resolved by use of /etc/zsh/*. The documentation issue remains. I'll post a bug report upstream, if it's not already there.