Bug 201866 - shells/zsh looks for zshrc in /etc but not in /usr/local/etc
Summary: shells/zsh looks for zshrc in /etc but not in /usr/local/etc
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Adam Weinberger
Depends on:
Reported: 2015-07-25 02:50 UTC by Georgy
Modified: 2016-06-24 14:16 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback?
xmj: merge-quarterly?


Note You need to log in before you can comment on or make changes to this bug.
Description Georgy 2015-07-25 02:50:05 UTC
FreeBSD ext 10.1-RELEASE-p10 FreeBSD 10.1-RELEASE-p10 #0: Wed May 13 06:54:13 UTC 2015     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

Name           : zsh
Version        : 5.0.8_2
Installed on   : Fri Jul 24 12:38:09 PDT 2015
Origin         : shells/zsh
Architecture   : freebsd:10:x86:64
Prefix         : /usr/local
Categories     : shells
Licenses       : ZSH
Maintainer     : bapt@FreeBSD.org
WWW            : http://www.zsh.org/
Comment        : The Z shell
Options        :
	DEBUG          : off
	DOCS           : on
	EXAMPLES       : on
	GDBM           : off
	MAILDIR        : on
	MEM            : off
	PCRE           : off
	SECURE_FREE    : on
	STATIC         : off
Annotations    :
	repo_type      : binary
	repository     : FreeBSD
Flat size      : 14.2MiB

fresh zsh installed via pkg from url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest",

same applies for port built with default options

zsh configuration
zsh version               : 5.0.8
host operating system     : amd64-portbld-freebsd10.1
source code location      : .
compiler                  : cc
preprocessor flags        : -I/usr/local/include -DBOOL_DEFINED -DLIBICONV_PLUG
executable compiler flags : -O2 -pipe  -DLIBICONV_PLUG -fstack-protector -fno-strict-aliasing
module compiler flags     : -O2 -pipe  -DLIBICONV_PLUG -fstack-protector -fno-strict-aliasing -fPIC
executable linker flags   :  -L/usr/local/lib -Wl,--as-needed -Wl,-rpath=/usr/local/lib -fstack-protector  -rdynamic
module linker flags       :  -L/usr/local/lib -Wl,--as-needed -Wl,-rpath=/usr/local/lib -fstack-protector  -shared
library flags             : -lncursesw  -lm  -lc
installation basename     : zsh
binary install path       : /usr/local/bin
man page install path     : /usr/local/man
info install path         : /usr/local/info
functions install path    : /usr/local/share/zsh/5.0.8/functions

truss output | grep zshrc
47392: 0.088842979 access("/home/user/.zshrc",0)	 = 0 (0x0)
47392: 0.091282846 stat("/etc/zshrc.zwc",0x7fffffffe698) ERR#2 'No such file or directory'		<<<<
47392: 0.091590850 stat("/etc/zshrc",0x7fffffffe620) ERR#2 'No such file or directory'			<<<<
47392: 0.091796885 open("/etc/zshrc",O_NOCTTY,037777777777) ERR#2 'No such file or directory'	<<<<
47392: 0.092122349 stat("/home/user/.zshrc.zwc",0x7fffffffe698) ERR#2 'No such file or directory'
47392: 0.092377134 stat("/home/user/.zshrc",{ mode=-rw-r--r-- ,inode=2251,size=10404,blksize=10752 }) = 0 (0x0)
47392: 0.092649099 open("/home/user/.zshrc",O_NOCTTY,037777777777) = 3 (0x3)
47392: 0.105137094 access("/home/user/.zshrc",4)	 = 0 (0x0)
47392: 0.105282506 access("/home/user/.zshrc.global",4) ERR#2 'No such file or directory'

upon launch zsh tries to read /etc/zshrc and does not try to read /usr/local/etc/zshrc despite having --sysconfdir=${PREFIX}/etc in CONFIGURE_ARGS in the /usr/ports/shells/zsh/Makefile file.

same applies to zshrc.zwc and zshenv files.

Seems sysconfdir configure directive is not applied or not honored.

adding  --enable-etcdir=${PREFIX}/etc to CONFIGURE_ARGS fixes the situation.
Comment 1 Baptiste Daroussin freebsd_committer 2015-12-04 23:27:43 UTC
Fixed, thanks, sorry it took long
Comment 2 commit-hook freebsd_committer 2015-12-04 23:28:17 UTC
A commit references this bug:

Author: bapt
Date: Fri Dec  4 23:27:24 UTC 2015
New revision: 403014
URL: https://svnweb.freebsd.org/changeset/ports/403014

  Update to zsh 5.2
  While here:
  - ensure zsh looks ${PREFIX}/etc for zshrc [1]
  - hook the testsuite to our test framework

  PR:		201866
  Submitted by:	Georgy <delycid@gmail.com>

Comment 3 Baptiste Daroussin freebsd_committer 2015-12-09 12:30:40 UTC
Reopen given that change has been backed out and pass it to new maintainer
Comment 4 Johannes Jost Meixner freebsd_committer 2016-03-08 09:54:05 UTC
This might be a good candidate for merging into the quarterly branch.
Comment 5 Lars Engels freebsd_committer 2016-03-08 10:12:08 UTC
Please re-add the feature or remove the same changes that were made in editors/vim some months ago, so that the same rule applies to all ports.

Or just add an UPDATING entry, a pkg-message or whatever and make the zsh port more useful and user friendly.
Comment 6 Adam Weinberger freebsd_committer 2016-03-08 22:50:25 UTC
(In reply to Johannes Jost Meixner from comment #4)
The commit was backed out; there's nothing to MFH here at this time.
Comment 7 Adam Weinberger freebsd_committer 2016-03-08 22:54:36 UTC
(In reply to Lars Engels from comment #5)
I think the Right Thing is for zsh to look for appropriate configuration files in ${PREFIX}/etc and /etc, but zsh has to be taught how to do that (and I haven't had time to do that yet).

But then also, which one has priority? I don't think that forcing only /usr/local/etc is any better than forcing only /etc, as it's just going to cause confusion.
Comment 8 Ben Woods freebsd_committer 2016-06-23 21:03:43 UTC
I have asked the question to the zsh mailing list here as to whether it is feasible to allow zsh to search multiple directories for its startup/shutdown configuration scripts:
Comment 9 commit-hook freebsd_committer 2016-06-24 14:13:43 UTC
A commit references this bug:

Author: adamw
Date: Fri Jun 24 14:13:28 UTC 2016
New revision: 417423
URL: https://svnweb.freebsd.org/changeset/ports/417423

  Switch zsh back to looking for system-wide files under ${PREFIX}/etc,
  rather than /etc. Add an option, ETCDIR, to switch it back to /etc.
  Also includes a couple whitespace cleanups. PORTREVISION bump, and a
  note in UPDATING.

  PR:		201866

Comment 10 Adam Weinberger freebsd_committer 2016-06-24 14:16:44 UTC
I've committed the change back in, and added an option, ETCDIR, to let people switch it back if they need to. Also added a pkg-message and an UPDATING entry about it.

Johannes, I think I'm not going to merge it to quarterly. 2016Q3 will be branching very soon, and I'd like it to get vetted in latest first.

Thanks to everyone involved for being so patient.