Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH/RFC] Don't source .zlogout if privileged
- X-seq: zsh-workers 44019
- From: dana <dana@xxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: [PATCH/RFC] Don't source .zlogout if privileged
- Date: Sat, 26 Jan 2019 12:13:18 -0600
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=UITziKmJu56+8pM8zIxRyIiz/2naCY1PgfeZBO7gISg=; b=HI1D8TCxF9rxvbBVi69Qfpu9YJY2d+BSmVFNddNlJ+hiyTzrHi5JujB38JVRkDt5/u 3shPdREHrAaIavuoIORVt4Xn7xrAOL4iK1qUAohIzwoENaqhBTMXTfY8yP946Ll8rmDh 1fwMHyIf9On3vzGVvbLeK6YbLdY3pMd06dmMgcb73IGSCX+Fn0lfZRxvlZSXuocV67m6 VsqiK7C76XPG0tgFwaAkAuOneNxvfvUW/wlN1Pv22VESRnhuwOIJoa2GQQCn0BIfxE7s YIMi146KNENfj7dRh3nMdIcwDHHwrcRkyqe/GyCR3t7P7on+Nfu6eV2p0lQkBv3jNxuu HXrA==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
I noticed whilst formulating a reply to users/23847 that the shell still
sources the user .zlogout even when the privileged option is set. The ML
archive doesn't go back far enough for me to see what the rationale was for
that, but i'm guessing maybe it's because the feature was borrowed from ksh,
and ksh doesn't have a logout file. (In fact, the option didn't originally
affect zsh-specific init files at all, since it was only used for ksh
emulation.) But shouldn't the same logic apply? Or is there a particular
reason to treat it differently?
(If it *is* desirable behaviour, i'll send a different patch documenting that
more explicitly)
dana
diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index bc182eb7b..379ee2a06 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -2377,7 +2377,7 @@ for failure and act accordingly, for example:
example(unsetopt privileged || exit)
-The tt(PRIVILEGED) option disables sourcing user startup files.
+The tt(PRIVILEGED) option disables sourcing user startup/shutdown files.
If zsh is invoked as `tt(sh)' or `tt(ksh)' with this option set,
tt(/etc/suid_profile) is sourced (after tt(/etc/profile) on interactive
shells). Sourcing tt(~/.profile) is disabled and the contents of the
diff --git a/Src/builtin.c b/Src/builtin.c
index 8dcdcc024..01fca6f7c 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -5791,7 +5791,7 @@ zexit(int val, int from_where)
saveandpophiststack(1, writeflags);
savehistfile(NULL, 1, writeflags);
}
- if (islogin && !subsh) {
+ if (islogin && !subsh && unset(PRIVILEGED)) {
sourcehome(".zlogout");
#ifdef GLOBAL_ZLOGOUT
if (isset(RCS) && isset(GLOBALRCS))
Messages sorted by:
Reverse Date,
Date,
Thread,
Author