From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18255 invoked by alias); 14 Jun 2017 23:01:50 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 41296 Received: (qmail 12315 invoked from network); 14 Jun 2017 23:01:50 -0000 X-Qmail-Scanner-Diagnostics: from mail-vk0-f50.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.213.50):SA:0(-0.0/5.0):. Processed in 1.474019 secs); 14 Jun 2017 23:01:50 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.213.50 as permitted sender) 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== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=LI4IxRXvW4N3xiUYDTWxuDwUMMk2ANWAL3GCJFHFp20=; b=pvwDeANBTjSKzBDT7OZU+6YD8jhKygVbWq75vsjWd2A2fvaqnssyaSyRWRokyrKvIQ z+TQ8c5ybraItkZnY1yvzTOUTTOwzDymULeIeiIzbv+rZFHheHHIQ2+awQPxOUzrLLMf xtuziPzZgzs1TfyrjL8usMGojRH4MMcmbnRYs2gPn1C6pVx70+IMkfgndBYLb/4rSlAP ZJUBoUsumkrPDHJNUoWV8hZlFuUTP7sZ6q5fFf/Y6vvOZGAiMmkqQmvZWy64Oq6qhWnA 7/7r0o5hBTFeF8TQpiQAzmW/FyQLZHvEzrJu88fgI3v83i93I/deuijjaT3JI+Cprfka OMOg== X-Gm-Message-State: AKS2vOyNyQf+eB9EkHn5C7YyVJPCyQm/sjnV7o9XUyQ7AZpHis852P98 Jcd1kqyHrhrVsm8u X-Received: by 10.31.110.74 with SMTP id j71mr1196076vkc.59.1497481303521; Wed, 14 Jun 2017 16:01:43 -0700 (PDT) From: Bart Schaefer Message-Id: <170614160224.ZM20305@torch.brasslantern.com> Date: Wed, 14 Jun 2017 16:02:24 -0700 In-Reply-To: Comments: In reply to Branden Archer "Issue with resolving paths with zsh using \0 in variables" (Jun 13, 3:32pm) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Branden Archer , zsh-workers@zsh.org Subject: Re: Issue with resolving paths with zsh using \0 in variables MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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.