From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20459 invoked by alias); 7 Jan 2011 22:56:33 -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: 28593 Received: (qmail 3645 invoked from network); 7 Jan 2011 22:56:22 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at spodhuis.org does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d200912; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=7M+UvE9AsHL5oKatEnZ4LzmEr7h9JzT4+4CB+f+xaz0=; b=YxsNjaiJ+HLh72NBFR7B0kkkveJKMP8lGxF5su82874QyZmwULjRmOdEPQl4jrXRtM+M9f9SdmvL70ImHSF0SbHwOYudDeSOp4ypD8FzeS+qRWS8lLN7BrnoVx+Xj6VdrNlOVLbeNgiqrZdZIcxxsL3NAkB8vvWfC8ELmXSVjGg=; Date: Fri, 7 Jan 2011 17:56:16 -0500 From: Phil Pennock To: Christian Neukirchen Cc: zsh-workers@zsh.org Subject: Re: exec -a and parameter expansion Message-ID: <20110107225616.GA99800@redoubt.spodhuis.org> Mail-Followup-To: Christian Neukirchen , zsh-workers@zsh.org References: <8739p4wekt.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8739p4wekt.fsf@gmail.com> On 2011-01-07 at 23:09 +0100, Christian Neukirchen wrote: > trying to write a script that sets argv[0] for a child process, I tried > using exec -a and noticed this difference: > > % zsh -c 'exec -a $OSTYPE ps ax' |grep ax > 3755 pts/19 RN+ 0:00 ?OSTYPE ax > > % bash -c 'exec -a $OSTYPE ps ax' |grep ax > 3876 pts/19 RN+ 0:00 linux-gnu ax > > I expected the latter output for zsh too. (And I can't explain the "?".) In part it depends upon the OS, locale and what happens for unprintable characters for you. For me, that's hex [92 77 94 69], shown as [\ M ^ E]. > Is this a bug? Yes. Looks like another one I introduced, I never tested the interaction of "exec -a foo" with a variable as foo. Unfortunately, my understanding of zsh's internal parse state is weak enough that I don't know the fix. Somewhere in the BINF_EXEC handling, I *think* that some kind of unmeta() is needed, but my naive approaches have not worked. -Phil