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 EEFD1159C9B for ; Fri, 2 Aug 2024 23:14:20 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 746CEE2A67; Fri, 2 Aug 2024 23:14:18 +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)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 107D1E2A68 for ; Fri, 2 Aug 2024 23:14:18 +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)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 769A5343028 for ; Fri, 2 Aug 2024 23:14:16 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 018F81EAB for ; Fri, 2 Aug 2024 23:14:13 +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: <1722640137.61045c5ff6a5939f81bc64190c0d3d137f40f8c2.sam@gentoo> Subject: [gentoo-commits] proj/gentoo-functions:master commit in: / X-VCS-Repository: proj/gentoo-functions X-VCS-Files: functions.sh test-functions X-VCS-Directories: / X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 61045c5ff6a5939f81bc64190c0d3d137f40f8c2 X-VCS-Branch: master Date: Fri, 2 Aug 2024 23:14:13 +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: dd109b80-d77a-47b8-a0c3-ed778814a370 X-Archives-Hash: 737e3f617414f9eb3eb43b81f33e581b commit: 61045c5ff6a5939f81bc64190c0d3d137f40f8c2 Author: Kerin Millar plushkava net> AuthorDate: Fri Aug 2 22:50:54 2024 +0000 Commit: Sam James gentoo org> CommitDate: Fri Aug 2 23:08:57 2024 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=61045c5f Have chdir() enforce POSIX interpretation 1047 POSIX-1.2024 (Issue 8) requires for the cd builtin to raise an error where given an empty directory operand. However, various implementations have yet to catch up. Given that it is a sensible change, let's have the chdir() function behave accordingly. Further, since doing so renders the test_chdir_noop test useless, get rid of it. The purpose that the test served is now subsumed by test_chdir. Closes: https://bugs.gentoo.org/937157 Signed-off-by: Kerin Millar plushkava.net> functions.sh | 13 ++++++++++--- test-functions | 17 +---------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/functions.sh b/functions.sh index 9b6220b..7dd4d8f 100644 --- a/functions.sh +++ b/functions.sh @@ -42,13 +42,20 @@ # chdir() { + if [ "$#" -eq 1 ]; then + case $1 in + '') + _warn_for_args chdir "$1" + return 1 + ;; + -) + set -- ./- + esac + fi if [ "${BASH}" ]; then # shellcheck disable=3044 shopt -u cdable_vars fi - if [ "$1" = - ]; then - set -- ./- - fi # shellcheck disable=1007,2164 CDPATH= cd -- "$@" } diff --git a/test-functions b/test-functions index 2ad76e8..db89e73 100755 --- a/test-functions +++ b/test-functions @@ -49,6 +49,7 @@ test_local() { test_chdir() { set -- \ + ge 1 '' \ ge 1 grandchild \ ge 1 var \ eq 0 -L \ @@ -77,21 +78,6 @@ test_chdir() { iterate_tests 3 "$@" } -test_chdir_noop() { - set -- \ - eq 0 '' - - callback() { - shift - test_description="chdir $(quote_args "$@")" - chdir "$@" \ - && test "$PWD" = "$OLDPWD" \ - || { cd - >/dev/null; false; } - } - - iterate_tests 3 "$@" -} - test_die() { set -- \ eq 1 0 \ @@ -891,7 +877,6 @@ elif ! GENFUN_MODULES="portage rc" . ./functions.sh; then else assign_tmpdir test_chdir || rc=1 - test_chdir_noop || rc=1 ( test_ebegin ) || rc=1; testnum=$((testnum + 1)) test_is_older_than || rc=1 test_get_bootparam || rc=1