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 80E0D15808B for ; Sat, 5 Oct 2024 04:15:25 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 70840E29C1; Sat, 5 Oct 2024 04:15:24 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (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 52057E29C1 for ; Sat, 5 Oct 2024 04:15:24 +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 43E04340813 for ; Sat, 5 Oct 2024 04:15:23 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 9C24E1F42 for ; Sat, 5 Oct 2024 04:15:21 +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: <1723911377.4d72028326dfea6d8360dad441e80cd52cafb5b9.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: 4d72028326dfea6d8360dad441e80cd52cafb5b9 X-VCS-Branch: master Date: Sat, 5 Oct 2024 04:15:21 +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: 6a85d51d-485c-4cae-96c9-e6a6f95dd4db X-Archives-Hash: fb3777d93c35f7bd50bef3a307ac7bca commit: 4d72028326dfea6d8360dad441e80cd52cafb5b9 Author: Kerin Millar plushkava net> AuthorDate: Sun Aug 11 17:47:25 2024 +0000 Commit: Sam James gentoo org> CommitDate: Sat Aug 17 16:16:17 2024 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=4d720283 Abort sourcing for ksh93 In the case of ksh93, the commonly implemented behaviour of "local" can be approximated with "typeset". However, to use typeset in this way requires the use of the function f { ...; } syntax instead of the POSIX-compatible f() compound-command syntax. As things stand, there is no sense in allowing for functions.sh to be sourced by ksh93. Signed-off-by: Kerin Millar plushkava.net> functions.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/functions.sh b/functions.sh index 1c8721f..b618054 100644 --- a/functions.sh +++ b/functions.sh @@ -24,6 +24,7 @@ # GENFUN_MODULES : which of the optional function collections must be sourced # IFS : warn() operands are joined by its first character # INVOCATION_ID : used by from_unit() +# KSH_VERSION : used to detect ksh93, which is currently unsupported # PORTAGE_BIN_PATH : used by from_portage() # POSIXLY_CORRECT : if unset/empty, quote_args() may emit dollar-single-quotes # RC_OPENRC_PID : used by from_runscript() @@ -42,6 +43,12 @@ warn() printf '%s: %s\n' "${0##*/}" "$*" >&2 } +case ${KSH_VERSION} in 'Version AJM 93'*) + # The ksh93 shell has a typeset builtin but no local builtin. + warn "gentoo-functions does not currently support ksh93" + return 1 +esac + if [ "${YASH_VERSION}" ] && set +o | grep -qxF 'set -o posixlycorrect'; then # The yash shell disables the local builtin in its POSIXly-correct mode. warn "gentoo-functions does not support yash in posixlycorrect mode"