From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25024 invoked by alias); 6 Oct 2015 09:16:15 -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: X-Seq: 36802 Received: (qmail 7779 invoked from network); 6 Oct 2015 09:16:13 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-AuditID: cbfec7f5-f794b6d000001495-46-5613915af858 Date: Tue, 06 Oct 2015 10:15:49 +0100 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: syntax check of 'echo $HOME' crashes in ksh emulation mode Message-id: <20151006101549.3664bab3@pwslap01u.europe.root.pri> In-reply-to: <20151006093357.0c7a5214@pwslap01u.europe.root.pri> References: <1693579.IilOBOKrgc@kdudka.brq.redhat.com> <20151005174219.69ae85c4@pwslap01u.europe.root.pri> <151005104507.ZM19176@torch.brasslantern.com> <20151006093357.0c7a5214@pwslap01u.europe.root.pri> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrILMWRmVeSWpSXmKPExsVy+t/xK7pRE4XDDN7PU7E42PyQyYHRY9XB D0wBjFFcNimpOZllqUX6dglcGV9ePGctOMRR8fmZYgPjLbYuRg4OCQETiZO/pLoYOYFMMYkL 99YDhbk4hASWMkpMX7+TBcKZwSRx7NsaJghnK6PEwlU3WEC6WQRUJQ68LQPpZhMwlJi6aTYj iC0iIC5xdu15sBJhAXeJSatVQMK8AvYS67bPYwGxOQUcJN7uv8cOMfISo8SXaw/BEvwC+hJX /35igrjIXmLmlTOMEM2CEj8m3wOrYRbQkti8rYkVwpaX2LzmLTOILSSgLnHj7m72CYxCs5C0 zELSMgtJywJG5lWMoqmlyQXFSem5RnrFibnFpXnpesn5uZsYIQH7dQfj0mNWhxgFOBiVeHgl bgqFCbEmlhVX5h5ilOBgVhLh/cklHCbEm5JYWZValB9fVJqTWnyIUZqDRUmcd+au9yFCAumJ JanZqakFqUUwWSYOTqkGxsPMBxUnbVBtar017XBJTqhoTVnxDRWnC1m9k18svve0wXvFf7tF zrYWihVd7y2y2isd93a3FkdNP/HjCLPvvGOnvbQUz9Vb6MZ+dDnkqaZe9r3vuURON4fSrEUm 2z8sqRe8ufnun6ZQqz9LNXTWCjz8Jc3v8Jt985Gc81avc3IT+y+VZ8d8VmIpzkg01GIuKk4E AKMdSeZUAgAA On Tue, 6 Oct 2015 09:33:57 +0100 Peter Stephenson wrote: > On Mon, 5 Oct 2015 10:45:07 -0700 > Bart Schaefer wrote: > > Hrm. But we DO set HOME in ksh emulation if the -n option is not given. > > What is it about no_exec that changes things? > > Not importing environment variables. Digging deeper, I think where it's not doing the assignment is... /**/ mod_export void assignstrvalue(Value v, char *val, int flags) { if (unset(EXECOPT)) return; (i) Doesn't that leak val? Presumably if val is non-NULL it's permanently allocated, and I don't think we can guarantee that never happens. Indeed, as far as I can see in the case we're talking about it does happen. (ii) It's not clear how safe the above is, as this case shows. However, it's definitely not safe to skip the tests in assignstrvalue() either, and if we run them it's doing too much work for syntax checking and is likely to mess things up owing to previous non-execution. So this is all a bit nasty. (Just for once.) pws