From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 2256E158010 for ; Fri, 17 Feb 2023 01:33:43 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 27621E0849; Fri, 17 Feb 2023 01:33:42 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 08E30E0839 for ; Fri, 17 Feb 2023 01:33:41 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 003A334114B for ; Fri, 17 Feb 2023 01:33:41 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 4E1668B4 for ; Fri, 17 Feb 2023 01:33:39 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1676597608.ded20c5e676c093c592ebadb1d83d41989a4ef5d.sam@gentoo> Subject: [gentoo-commits] proj/gentoo-functions:master commit in: / X-VCS-Repository: proj/gentoo-functions X-VCS-Files: functions.sh X-VCS-Directories: / X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: ded20c5e676c093c592ebadb1d83d41989a4ef5d X-VCS-Branch: master Date: Fri, 17 Feb 2023 01:33:39 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 2e019b71-ac72-414d-ad24-cd15c9c5865e X-Archives-Hash: a72ab26d151720f483b2f4afa0a3880a commit: ded20c5e676c093c592ebadb1d83d41989a4ef5d Author: Kerin Millar plushkava net> AuthorDate: Thu Feb 16 14:15:36 2023 +0000 Commit: Sam James gentoo org> CommitDate: Fri Feb 17 01:33:28 2023 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=ded20c5e Explicitly define IFS for invocations of the read builtin This is appropriate for library code because there is no telling what the value of IFS will be at any given moment. Also, POSIX does not forbid implementations of sh(1) from inheriting the value of IFS from the parent process, though this defect will be addressed by Issue 8. See https://austingroupbugs.net/view.php?id=884 for further details. Signed-off-by: Kerin Millar plushkava.net> Signed-off-by: Sam James gentoo.org> functions.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/functions.sh b/functions.sh index 22e6ef9..df72d4a 100644 --- a/functions.sh +++ b/functions.sh @@ -379,6 +379,9 @@ get_bootparam() # Similarly, the empty string must not be allowed to match. case $1 in ''|*,*) return 1 ;; esac + # Reset the value of IFS because there is no telling what it may be. + IFS=$(printf ' \n\t') + if [ "${TEST_GENFUNCS}" = 1 ]; then read -r cmdline else @@ -505,7 +508,7 @@ else # size operand is not portable. genfun_cols=$( stty size 2>/dev/null | { - if read -r _ cols _; then + if IFS=' ' read -r _ cols _; then printf '%s\n' "${cols}" fi }