From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] apply: canonicalize modes read from patches
Date: Thu, 15 Aug 2024 07:52:47 -0700 [thread overview]
Message-ID: <xmqqcym9vnwg.fsf@gitster.g> (raw)
In-Reply-To: <20240805060010.GA120016@coredump.intra.peff.net> (Jeff King's message of "Mon, 5 Aug 2024 02:00:10 -0400")
Jeff King <peff@peff.net> writes:
> +test_expect_success POSIXPERM 'patch mode for deleted file is canonicalized' '
This test seems to fail under "--stress" and I need to borrow a
brain better clued than mine. It appears to be fooled by mtime that
is not updated immediately and failing match_stat check, but since
the index file is written on the other side of the second resolution
boundary, racy-git double-checking code does not trigger, or
something like that.
Here is how it fails:
expecting success of 4129.13 'patch mode for deleted file is canonicalized':
test_when_finished "git reset --hard" &&
echo content >non-canon &&
git add non-canon &&
chmod 666 non-canon &&
cat >patch <<-\EOF &&
diff --git a/non-canon b/non-canon
deleted file mode 100660
--- a/non-canon
+++ /dev/null
@@ -1 +0,0 @@
-content
EOF
git apply --index patch 2>err &&
test_must_be_empty err &&
git ls-files -- non-canon >staged &&
test_must_be_empty staged &&
test_path_is_missing non-canon
++ test_when_finished 'git reset --hard'
++ test 0 = 0
++ test_cleanup='{ git reset --hard
} && (exit "$eval_ret"); eval_ret=$?; :'
++ echo content
++ git add non-canon
++ chmod 666 non-canon
++ cat
++ git apply --index patch
error: last command exited with $?=1
not ok 13 - patch mode for deleted file is canonicalized
#
# test_when_finished "git reset --hard" &&
# echo content >non-canon &&
# git add non-canon &&
# chmod 666 non-canon &&
#
# cat >patch <<-\EOF &&
# diff --git a/non-canon b/non-canon
# deleted file mode 100660
# --- a/non-canon
# +++ /dev/null
# @@ -1 +0,0 @@
# -content
# EOF
# git apply --index patch 2>err &&
# test_must_be_empty err &&
# git ls-files -- non-canon >staged &&
# test_must_be_empty staged &&
# test_path_is_missing non-canon
#
1..13
$ echo $?
1
$ git -C trash\ directory.t4129-apply-samemode.stress-failed/.git ls-files --debug non-canon
non-canon
ctime: 1723701364:980719772
mtime: 1723701364:980719772
dev: 65024 ino: 1980747
uid: 110493 gid: 89939
size: 8 flags: 0
: git t/master; stat trash\ directory.t4129-apply-samemode.stress-failed/non-canon
File: trash directory.t4129-apply-samemode.stress-failed/non-canon
Size: 8 Blocks: 8 IO Block: 4096 regular file
Device: 254,0 Inode: 1980747 Links: 1
Access: (0666/-rw-rw-rw-) Uid: (110493/ jch) Gid: (89939/primarygroup)
Access: 2024-08-15 06:54:43.808293635 -0700
Modify: 2024-08-14 22:56:04.980719772 -0700
Change: 2024-08-14 22:56:05.020719706 -0700
Birth: 2024-08-14 22:56:04.980719772 -0700
$ stat trash\ directory.t4129-apply-samemode.stress-failed/.git/index
File: trash directory.t4129-apply-samemode.stress-failed/.git/index
Size: 432 Blocks: 8 IO Block: 4096 regular file
Device: 254,0 Inode: 1980724 Links: 1
Access: (0600/-rw-------) Uid: (110493/ jch) Gid: (89939/primarygroup)
Access: 2024-08-14 22:56:05.044719667 -0700
Modify: 2024-08-14 22:56:05.008719726 -0700
Change: 2024-08-14 22:56:05.016719713 -0700
Birth: 2024-08-14 22:56:04.996719746 -0700
next prev parent reply other threads:[~2024-08-15 14:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-01 22:57 quiltimport mode detection oddity Andrew Morton
2024-08-02 0:33 ` Junio C Hamano
2024-08-02 1:07 ` Andrew Morton
2024-08-02 3:51 ` Jeff King
2024-08-02 5:33 ` Andrew Morton
2024-08-02 14:57 ` Junio C Hamano
2024-08-05 6:00 ` [PATCH] apply: canonicalize modes read from patches Jeff King
2024-08-15 14:52 ` Junio C Hamano [this message]
2024-08-15 15:30 ` [PATCH] t4129: fix racy index when calling chmod after git-add Jeff King
2024-08-15 16:41 ` 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=xmqqcym9vnwg.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/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).