Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Issue with resolving paths with zsh using \0 in variables
- X-seq: zsh-workers 41286
- From: Eric Cook <llua@xxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Issue with resolving paths with zsh using \0 in variables
- Date: Tue, 13 Jun 2017 20:38:23 -0400
- In-reply-to: <CAADoZg3dsdn6yBrkUYQj3=w6ZKyqQDu5sG+kEas9c5yLNU1XPA@mail.gmail.com>
- 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
- References: <CAADoZg3dsdn6yBrkUYQj3=w6ZKyqQDu5sG+kEas9c5yLNU1XPA@mail.gmail.com>
On 06/13/2017 03:32 PM, Branden Archer wrote:
> This is an issue found when attempting to use paths in zsh where parts of
> the path are taken from data on the /sys filesystem. Namely, when cat'ing a
> file from the /sys filesystem it may return some data with a \0 at the end.
> If that variable is used to form a path the \0 interferes with the path
> resolution. Here is an example of this:
>
>
> root~# echo $ZSH_VERSION
> 5.3.1
> root~# mkdir subdir
> root~#
> root~# printf "dir\0" > location
> root~# touch subdir/myfile
> root~# echo "hi" > sub$(cat location)/myfile
> zsh: is a directory: subdir
> root~# echo "hi" > subdir/myfile
>
>
> It was found on bash that this did work, so it is believed that this is a
> valid use case. Namely, on bash the \0 at the end of the data returned
> from $(cat
> location) is ignored.
Silently mangling input isn't a valid usecase, even recently in
bash there is an warning that is displayed when it happens.
http://lists.gnu.org/archive/html/bug-bash/2017-04/msg00016.html
Messages sorted by:
Reverse Date,
Date,
Thread,
Author