From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1296 invoked by alias); 8 Dec 2017 12:23:56 -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: 42094 Received: (qmail 25148 invoked by uid 1010); 8 Dec 2017 12:23:56 -0000 X-Qmail-Scanner-Diagnostics: from mail-wr0-f177.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.128.177):SA:0(-1.9/5.0):. Processed in 2.718161 secs); 08 Dec 2017 12:23:56 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: stephane.chazelas@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=eMqOSrw6X8CZE+hLBYUIhEk6deJNd3agcMAOv1izhtM=; b=VP4ve7HznkBf5oKVc9ntFgfnqv4VFui+6LcCqOVMU9A5aAW7Spikl89psXcEjDpwni cXJjYOjijVmBWVOzjEQuz6AaLtZEQtT23ex2wbLGG9T+upX3IrLeb3rD6OmAOvpgYqel KwW1Pvj9GMycJJepJLmABHkNPuXW7wz8LBD2dDWTOr6dDXGXFZaPw4Lfc6TCvHT3C2Ca 75zpohUAA0ps0DTtrtsxJHDEnD2H2Yy2JVnRRyf6aw+ttS3oz8S8BW8DqFrTl3IgNEa1 8h5f9wjQWdQsKsUn1VO/TyfZtDBk1ahtpMlcQxYa8z0gBko6dalp2Wu1jHPX19TIXNyA pkPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=eMqOSrw6X8CZE+hLBYUIhEk6deJNd3agcMAOv1izhtM=; b=UGADt/fPqvENR0PtQnGPg6oKqc/5irPDtfaZ1pS4s8pdoX9xN2IZtJMeCD7ydvlu+B tgIznYz3WfsIoJWWnjsZ/6i7x23vILct6XVJviKvbYr4hRj2MUhJeNJp0mwSB3ZgF3dZ QhuUVgT5KbAk/nSx/8D9vW5Q4/413uM5vX1AVBMPpgdvBJPkfRIs79ePpta7SfhdV+nz kyLDRDzAc4ppiNGcxttIHFog8qV/p+LFi6r2fi9TBrRGiWfBv/jHFAA95jIDLH8gkQZk RCIF0UWSXPpTXhSbxRSepI8vSj064Y0QQICKmZ96BGMhko96WD9VhvZ8MmP/MXD9yUmU NHKw== X-Gm-Message-State: AJaThX5aEtHH12dOPuQGZwsEn0wgWbZ95SoUaMW7QF2AZbUMi3KDwLiV 3F4bKVyMbBKyVY00H8TmUvPoYg== X-Google-Smtp-Source: AGs4zMY0J4PDe4oQa9gwY48IuBy9QMIfwkuCN1bUaR3eoUYM3sPcVAN/NgiBOO1oh6w70OPtA3Jffg== X-Received: by 10.223.157.137 with SMTP id p9mr27278587wre.92.1512735829005; Fri, 08 Dec 2017 04:23:49 -0800 (PST) Date: Fri, 8 Dec 2017 12:23:46 +0000 From: Stephane Chazelas To: Zsh hackers list Subject: Re: $userdirs empty in non-interactive shells Message-ID: <20171208122345.GA28235@chaz.gmail.com> Mail-Followup-To: Zsh hackers list References: <20171207112950.GA8258@chaz.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171207112950.GA8258@chaz.gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) 2017-12-07 11:29:50 +0000, Stephane Chazelas: [...] > > /* We don't maintain a hash table in non-interactive shells. */ > > if (!interact) > > return; [...] If I remove that code, that breaks one of the tests: > --- /tmp/zsh.ztst.2996/ztst.out 2017-12-07 21:31:18.051388484 +0000 > +++ /tmp/zsh.ztst.2996/ztst.tout 2017-12-07 21:31:18.047388673 +0000 > @@ -1,4 +1,4 @@ > ~/install/cvs/zsh/Test/options.tmp > -~/install/cvs/zsh/Test/options.tmp/tmpcd ~/install/cvs/zsh/Test/options.tmp > -~/install/cvs/zsh/Test/options.tmp/tmpcd ~/install/cvs/zsh/Test/options.tmp/tmpcd ~/install/cvs/zsh/Test/options.tmp > -~/install/cvs/zsh/Test/options.tmp/tmpcd ~/install/cvs/zsh/Test/options.tmp/tmpcd ~/install/cvs/zsh/Test/options.tmp > +~cdablevar2 ~/install/cvs/zsh/Test/options.tmp > +~cdablevar2 ~cdablevar2 ~/install/cvs/zsh/Test/options.tmp > +~cdablevar2 ~cdablevar2 ~/install/cvs/zsh/Test/options.tmp > Test ./E01options.ztst failed: output differs from expected as shown above for: > dirs > pushd $mydir/tmpcd > dirs > pushd $mydir/tmpcd > dirs > setopt pushdignoredups > pushd $mydir/tmpcd > dirs > unsetopt pushdignoredups > popd >/dev/null > popd >/dev/null > Was testing: PUSHD_IGNOREDUPS option > ./E01options.ztst: test failed. That's because an earlier test does a cd a: cd cdablevar2 under setopt cdablevars with cdablevar2 containing that same tmpcd directory, and so an entry is added in that hash. That's one case where an earlier test has side effects on later tests. While the documentation doesn't mentions that that "hashing" only happens in interactve shells, the test code acknowleges it to some extent: ># Test various shell options. ># Interactive options not tested here: [...] ># AUTO_NAME_DIRS (named directory table not maintained) That also means: $ zsh -fc 'cd ~bin; dirs' /bin $ zsh -fic 'cd ~bin; dirs' ~bin BTW, I just realised that named dirs in variables took precedence over user home dirs: $ zsh -fc 'cd -P -- ~bin && pwd' /bin $ bin=/tmp zsh -fc 'cd -P -- ~bin && pwd' /tmp Is that intentional? I can't say I like the idea. It would need to be disabled in "sh" emulation if we wanted to be POSIX compliant in that regard (but then there are a few other namespace clashes that would need to be addressed like for keywords, special variables if we wanted to go all the way there). -- Stephane