From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: Trailing whitespace after $'\0' with external commands
Date: Sat, 11 Jan 2014 15:35:52 -0800 [thread overview]
Message-ID: <140111153552.ZM14759@torch.brasslantern.com> (raw)
In-Reply-To: <52D1C33A.7080803@gmx.com>
On Jan 11, 5:18pm, Eric Cook wrote:
} Subject: Trailing whitespace after $'\0' with external commands
}
} I've noticed trailing whitespace is ignored when it appears immediately
} after $'\0'. i am unsure if this is intended behavior or not.
}
} % zsh -c "/usr/bin/printf '<%s>' $'\0'' '; echo"
} <>
This is /usr/bin/printf behavior, not zsh behavior. Has nothing to do
with whitespace:
% zsh -fc "/usr/bin/printf '<%s>' $'\0''none of this'; echo"
<>
% zsh -fc "printf '<%s>' $'\0''none of this'; echo"
<none of this>
I can only conclude that ksh is not actually retaining the nul byte in
the argument list when calling /usr/bin/printf. There's an argument
(no pun intended) to be made for this behavior, in that it's impossible
for a string passed through the argv mechanism of execve and friends to
contain an embedded nul; the string will always end at that byte, so
ksh assumes it knows better than you and removes it so that the called
program (/usr/bin/printf in this case) can see the "whole" string.
Conversely, zsh is just doing *exactly* what you told it to do.
next prev parent reply other threads:[~2014-01-11 23:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-11 22:18 Eric Cook
2014-01-11 22:33 ` Eric Cook
2014-01-11 23:35 ` Bart Schaefer [this message]
2014-01-11 23:55 ` Eric Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=140111153552.ZM14759@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).