Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Zsh - possible bug report
- X-seq: zsh-workers 41660
- From: Simon Guilliams <simon.guilliams@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Zsh - possible bug report
- Date: Sun, 10 Sep 2017 15:00:28 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=x6ZYpxq0JlH5Y/BGaDAObawW7MAzB5L3Gu3wLIL2JaU=; b=iqKlWq3//+YHKzzf4J6hd9DL/eksRZCrEng0OJqfNSflRDzhpdo9XbaAnzMm9XKA+Y 00jcjubdU5Nwjq4+Qiqfrv8lqwAJlZBS3Y2mYD7aaNj3tTtMu4vIcSFBrgqnZadyj7oh INcVPtptjmx9Oohq2geZCgks56FeuE9LdTQPAFy7vNTDz2aV0k0dzy2HObqI9Ww46dUu F1ICrOEiH/GJBibMsCHo5CnlIvp+AF+1+Zfk/JwGkajvfCY2BedcVuBzeMWItqzzOQyu vZr7rD0bKl9Xz3RQJQB2YMLcjK0Ex3bA0uwf65SLV7mMpMO28HnEWUgyh3gt2Rtaehn7 3PEQ==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author