From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 29571 invoked from network); 18 Dec 2022 17:59:20 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 18 Dec 2022 17:59:20 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1671386360; b=ZfcHiMYX/YG4bKbymEFfs2/2E5Pq1CiS2TZ3hBO2PD+8vU9jjozLye+N2r8YC5JugPks01t4Tc 4zdAwP/hyFzF58bQSk/L4gp/Mjzlpflqg5muvqYsWUDNBE8r98XWaaxOEEn7zhL1+Zk8xQODs2 HibGnF8gTph0TE6VUIKKSMyyvAxX+bOiUBKhz3uUIgU1xYc0np9u27DfSqmjPxKaiobLMxAP17 qV74XVbEvdGHEMpGnfcEEzwQgzLmcM3n8CnkkEdF7MYzuvyqbZEqXfsBYKUbD1tCe5gwQcZNDi p7NiNVRqA4+MKpc4+qbkRBfPe6pjf/eJKqkKf872qmWtJQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (relay2-d.mail.gandi.net) smtp.remote-ip=217.70.183.194; dmarc=none header.from=chazelas.org; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1671386360; bh=QZCTiHdMfllVpaG4vfK8kcCYOk+ewHZsQNF9qUP3DkM=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:DKIM-Signature; b=IXW+Fiiz2Pbnc9lSeS/692oWI+9qTyjqFlV+2olq/MGQqTOAq3BDcOyNRxg9hGVrj+oBDctSEn CoPzqyarr/sjkkuHmyAAJfdTGTuZjccchLrmWiy43tkPQWhEJCyrG1DWcarOtCPIzENv7dnVYu KF4EM2r9g6R2Eyp2UdUNP+pV2FB6COV4a7vLpSEWjtRqJGAxI8NWn+uCKCI9i7dRTlMJvcKNEP /DkJ/in6H6YbmEIq5tVnW/yBDg5ryJ+rWD8zLgfAxhx8+F4N7JzP0ie+BywKjW5SCsKbRxPJ5n dG/pVvB4p2DUVoUl9IKRm/nyhogIVc2+NZcOEIgGHXsAFQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=NX+Tr+T2HI6Kd5IxIFbWx0U6YJOiRdM471bqoIExOxA=; b=YFgvhKOTrU5GIXPMndaGg1BzkC lyVleGwYHySGV+2N2unY72pE/gm+3IDfzFU+x/wLahqsPzJJxGbSdSf+l32tvtfzIQOiIp9jorpCW Uk7f4vDYzjtfaVPpGdVneGFO9ChAGDvilqbBPhqNRzZ3DVh8DHzVBre/WN1d34pgwhVWtPdj7BsvH g3/lAcpQdrOtMW7OPdLL8FU8ei7yKV2XlX4hv3fnkHTZg1SsVHPOc5M3ASbq0obI6mIRWQKhzDUHD GOYnCzVVYT+lgZ6HyOArkSgNcCoJbJHayRLVUm+2e0QCo1hbERUCLCFoRxGEXkyICC4oOyEfj70PC K/e3HHvg==; Received: by zero.zsh.org with local id 1p6xwV-000L98-71; Sun, 18 Dec 2022 17:59:19 +0000 Authentication-Results: zsh.org; iprev=pass (relay2-d.mail.gandi.net) smtp.remote-ip=217.70.183.194; dmarc=none header.from=chazelas.org; arc=none Received: from relay2-d.mail.gandi.net ([217.70.183.194]:59129) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1p6xvy-000Kqc-F5; Sun, 18 Dec 2022 17:58:47 +0000 Received: (Authenticated sender: stephane@chazelas.org) by mail.gandi.net (Postfix) with ESMTPSA id 0ABD940004; Sun, 18 Dec 2022 17:58:44 +0000 (UTC) Date: Sun, 18 Dec 2022 17:58:43 +0000 From: Stephane Chazelas To: "Jun. T" Cc: zsh-workers@zsh.org Subject: Re: read -d $'\200' doesn't work with set +o multibyte (and [PATCH]) Message-ID: <20221218175843.sa7fmdonpoouqkpg@chazelas.org> Mail-Followup-To: "Jun. T" , zsh-workers@zsh.org References: <20221209154225.2z3lbtf422ypnmjx@chazelas.org> <99492-1670616302.663548@1brw.o7tP.wgJL> <20221210090626.mkv7bxeqnap6awah@chazelas.org> <1FF79E35-0103-4B80-BA4A-ECC6FD2ADF7E@kba.biglobe.ne.jp> <46661-1671054174.401235@OHsn.sB58.XThR> <18686-1671179384.136789@8qJu.Y1PF.BJgr> <5D83D776-4F97-499D-8848-A680F712DD31@kba.biglobe.ne.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5D83D776-4F97-499D-8848-A680F712DD31@kba.biglobe.ne.jp> X-Seq: 51240 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: 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