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 41296
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Branden Archer <brarcher@xxxxxxxxxxx>, zsh-workers@xxxxxxx
- Subject: Re: Issue with resolving paths with zsh using \0 in variables
- Date: Wed, 14 Jun 2017 16:02:24 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=LI4IxRXvW4N3xiUYDTWxuDwUMMk2ANWAL3GCJFHFp20=; b=Zi07jqfBXOBtp5rjMdWG81cMncsEggq4OZ1ysCrMgxGJR1f2V3EQTYrorGq7GaOMbt 3Nfxm66k9WCq1YW+UT0tBwvd4L1oVl7MQyDynrU3r8eEvoZ7sjU/aM83h9BNsjyT5g/9 6Xw9KmWh8Sx/yw2DzjVD19/O1fIwSJFLtlO/r83k91Jnp1J2m4GF/FmOJBu9ZP4SDcDf KsPehJTRXqo4Vx/npymoXb10uGkiwSfcnK8jGTJ0uZz0d+rm0WyYkCOgupWeYfYmg3ik iy1n0V9E+DHdPvK3nqNFbHBU8Y6ZIqLSEwIK7iXpWKaC2sahlJ3pQkEzmXWXGo0ky+7/ 0c9w==
- 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 Jun 13, 3:32pm, 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.
I believe this is because zsh supports having nul-bytes in parameter
values, whereas bash treats the nul as terminating the string. This
is not something we can (or I think want) to special-case for file
paths.
Those files in /sys are documented to contain strings separated by
nul bytes, so as soon as you read one with "cat" you have already
made a coding error. Instead you should be doing something like
read -d $'\0' -E < location
Conversely, this --
} root~# echo "hi" > sub$(cat location)/myfile
} zsh: is a directory: subdir
-- probably is a bug, just not the bug you think it is; the error should
be that "subdir\0" is an illegal file name, rather than terminating the
path at the nul and botching the redirection.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author