From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id f49c6cd6 for ; Sat, 26 Jan 2019 18:13:35 +0000 (UTC) Received: (qmail 21203 invoked by alias); 26 Jan 2019 18:13:25 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 44019 Received: (qmail 11383 invoked by uid 1010); 26 Jan 2019 18:13:25 -0000 X-Qmail-Scanner-Diagnostics: from mail-it1-f179.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.100.2/25112. spamassassin: 3.4.2. Clear:RC:0(209.85.166.179):SA:0(-1.9/5.0):. Processed in 2.207693 secs); 26 Jan 2019 18:13:25 -0000 X-Envelope-From: dana@dana.is X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | 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== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:message-id:date:to; bh=UITziKmJu56+8pM8zIxRyIiz/2naCY1PgfeZBO7gISg=; b=kQSNcJO2vaPx6s/mwo/Udc9N0V6InNZWWYXe3iP5NRVEZJob3yegxg+uDdTEvCQCvZ XSf+Fi7FJvlXgdxQamV3XRvVSU/8EdrML/ZtFMHxQU/9Lbd+uYKEe1UYyC5H08P/NDxV QvRdikc9lTMHrTIgYC7DC0674WhoF+JHG598tX8Abq6QLzd1J6Gw1O96PIYg0MdK3R9Y /IVy0HduwmjgSokHT/XRBP8dSewfm3exC1LGG9dkB25B8jR/Lo+wy770WxrRQWrOhWHG AKHyq5mz57ZLBqTibikn+aZSZKbYoVc4Nu9GOUACEfB2AjdGprkonVzc/yw4p6L+R9Oj cuLQ== X-Gm-Message-State: AJcUukcPFRqwv3nxPmrNv4qaNIis3RrDHUnKRMc54Ifaydii+PqKyn2b BdNUkCdy+O5fwF1/J3R1ITbw+06UFPE= X-Google-Smtp-Source: ALg8bN4eGbsx+atkaicq8TlFrEfwkcDdAjIbgQzk6inzIo2m5wgzIxeSNXb2P4B/2sO3Cg1HOP6s0w== X-Received: by 2002:a24:b003:: with SMTP id d3mr7724703itf.55.1548526399833; Sat, 26 Jan 2019 10:13:19 -0800 (PST) From: dana Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Mac OS X Mail 12.0 \(3445.100.39\)) Subject: [PATCH/RFC] Don't source .zlogout if privileged Message-Id: <448CAC98-5073-423F-B658-56580F4877FA@dana.is> Date: Sat, 26 Jan 2019 12:13:18 -0600 To: Zsh workers X-Mailer: Apple Mail (2.3445.100.39) 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))