zsh-workers
 help / color / mirror / code / Atom feed
* Zsh - possible bug report
@ 2017-09-10 13:00 Simon Guilliams
  2017-09-10 16:50 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Guilliams @ 2017-09-10 13:00 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 808 bytes --]

Hello,

I have found a behavior of zsh I cannot explain. I don't know if it is a
bug and I hope this is not a duplicate.

$ cat print-argv0.c
> #include <stdio.h>
> int main(int ac, char **av)
> {
> if (ac > 0)
> fputs(av[0], stdout);
> }
> $ cc print-argv0.c
> $ zsh -f -c "exec -a '' ./a.out | hexdump -vC"
> 00000000  9b 9b                                             |..|
> 00000002
> $ zsh -f -c "exec -a \"\" ./a.out | hexdump -vC"
> 00000000  9c 9c                                             |..|
> 00000002


Zsh makes argv[0] hold two bytes, 0x9b9b or 0x9c9c depending on quotes or
double-quotes.
Bash does make argv[0] an empty string.

$ bash -c "exec -a '' ./a.out | hexdump -vC"
> $ bash -c "exec -a \"\" ./a.out | hexdump -vC"
> $


Why does this happen? Is this expected behavior?

Thank you

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-10 16:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-10 13:00 Zsh - possible bug report Simon Guilliams
2017-09-10 16:50 ` Peter Stephenson

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).