git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Mentovai <mark@chromium.org>
To: Git Development <git@vger.kernel.org>
Cc: Derrick Stolee <stolee@gmail.com>
Subject: [PATCH] t7900: use pwd -P in macOS maintenance test
Date: Fri, 23 May 2025 15:37:22 -0400	[thread overview]
Message-ID: <20250523193722.68344-1-mark@chromium.org> (raw)

$pfx is the basis for the expectation that launchd plist paths formed by
`git maintenance start` will be compared against. These paths are formed
in `git maintenance` by builtin/gc.c launchctl_service_filename(), which
calls path.c interpolate_path() with real_home = 1, causing abspath.c
strbuf_realpath() to resolve a canonical absolute path. Since $pfx is
not determined according to the same realpath semantics, when t7900 is
run from a working directory that contains a symbolic link in its path,
the realpath operation will produce a different path than $pfx contains,
although both paths logically reference the same directory. The test
fails in this case.

Base $pfx on the physical working directory (pwd -P), with all symbolic
links fully resolved, so that the path that the test expects matches
what `git maintenance` generates, even when running from a working
directory whose path contains a symbolic link.

Signed-off-by: Mark Mentovai <mark@chromium.org>
---
 t/t7900-maintenance.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh
index 8cf89e285f49..677e92f1490e 100755
--- a/t/t7900-maintenance.sh
+++ b/t/t7900-maintenance.sh
@@ -882,7 +882,7 @@ test_expect_success 'stop preserves surrounding schedule' '
 
 test_expect_success 'start and stop macOS maintenance' '
 	# ensure $HOME can be compared against hook arguments on all platforms
-	pfx=$(cd "$HOME" && pwd) &&
+	pfx=$(cd "$HOME" && pwd -P) &&
 
 	write_script print-args <<-\EOF &&
 	echo $* | sed "s:gui/[0-9][0-9]*:gui/[UID]:" >>args
-- 
2.49.0


             reply	other threads:[~2025-05-23 19:37 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-23 19:37 Mark Mentovai [this message]
2025-05-23 20:08 ` [PATCH] t7900: use pwd -P in macOS maintenance test Eric Sunshine
2025-05-23 20:42   ` Junio C Hamano
2025-05-23 21:24     ` Eric Sunshine
2025-05-23 21:51       ` Junio C Hamano
2025-05-24  4:39         ` Mark Mentovai
2025-05-27 17:19           ` Junio C Hamano
2025-05-23 20:43   ` Mark Mentovai
2025-05-23 21:36     ` Eric Sunshine
2025-05-28 20:17 ` [PATCH v2] t: run tests from a normalized working directory Mark Mentovai
2025-05-28 23:08   ` Torsten Bögershausen
2025-05-30  5:04     ` Junio C Hamano
2025-05-31  5:46       ` Torsten Bögershausen
2025-06-01 16:38         ` Junio C Hamano
2025-06-02 16:08           ` Mark Mentovai
2025-06-02 21:32             ` Junio C Hamano
2025-06-03  5:02               ` Torsten Bögershausen
2025-06-03 13:15                 ` Mark Mentovai
2025-06-03 18:22                   ` Junio C Hamano

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=20250523193722.68344-1-mark@chromium.org \
    --to=mark@chromium.org \
    --cc=git@vger.kernel.org \
    --cc=stolee@gmail.com \
    /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.
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).