zsh-workers
 help / color / mirror / code / Atom feed
From: Stephane Chazelas <stephane@chazelas.org>
To: "Jun. T" <takimoto-j@kba.biglobe.ne.jp>
Cc: zsh-workers@zsh.org
Subject: Re: read -d $'\200' doesn't work with set +o multibyte (and [PATCH])
Date: Sun, 18 Dec 2022 17:58:43 +0000	[thread overview]
Message-ID: <20221218175843.sa7fmdonpoouqkpg@chazelas.org> (raw)
In-Reply-To: <5D83D776-4F97-499D-8848-A680F712DD31@kba.biglobe.ne.jp>

2022-12-18 19:51:22 +0900, Jun. T:
[...]
> In the web page Stehane mentioned:
> https://austingroupbugs.net/view.php?id=243#c6091
> 
> "When the current locale is not the C or POSIX locale,
> pathnames can contain bytes that do not form part of a valid
> character, and therefore portable applications need to ensure
> that the current locale is the C or POSIX locale when using
> read with arbitrary pathnames as input."
> 
> But I'm not familiar with this type of documents.
[...]

In the POSIX terminology, "application" identifies users of the
API. So sh/read users/scripts, code that use the "read" utility
here while "implementation" identifies a compliant
implementation of the API supplier, so a sh implementation like
zsh in sh emulation.

Here, it says that applications (scripts) wanting to use "read"
to read a file path into a variable should use:

IFS= LC_ALL=C read -rd '' file

I argued there in comments below
(https://austingroupbugs.net/view.php?id=243#c6093,
https://austingroupbugs.net/view.php?id=243#c6095) that with
IFS= read -d '', read implementations in practice don't seem to
need LC_ALL=C to do the right thing.

-- 
Stephane


  reply	other threads:[~2022-12-18 17:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-09 15:42 read -d $'\200' doesn't work with set +o multibyte Stephane Chazelas
2022-12-09 20:05 ` Oliver Kiddle
2022-12-10  9:06   ` read -d $'\200' doesn't work with set +o multibyte (and [PATCH]) Stephane Chazelas
2022-12-13 11:12     ` Jun T
2022-12-14 21:42       ` Oliver Kiddle
2022-12-15 12:37         ` Jun. T
2022-12-16  8:29           ` Oliver Kiddle
2022-12-18 10:51             ` Jun. T
2022-12-18 17:58               ` Stephane Chazelas [this message]
2022-12-15  2:01     ` Oliver Kiddle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221218175843.sa7fmdonpoouqkpg@chazelas.org \
    --to=stephane@chazelas.org \
    --cc=takimoto-j@kba.biglobe.ne.jp \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).