All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] osxkeychain: lock for exclusive execution
@ 2024-05-10  8:07 Koji Nakamaru via GitGitGadget
  2024-05-10 15:02 ` Bo Anderson
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Koji Nakamaru via GitGitGadget @ 2024-05-10  8:07 UTC (permalink / raw)
  To: git; +Cc: Bo Anderson, Koji Nakamaru, Koji Nakamaru

From: Koji Nakamaru <koji.nakamaru@gree.net>

Resolves "failed to store: -25299" when "fetch.parallel 0" is configured
and there are many submodules.

The error code -25299 (errSecDuplicateItem) may be returned by
SecItemUpdate() in add_internet_password() if multiple instances of
git-credential-osxkeychain run in parallel. This patch introduces an
exclusive lock to serialize execution for avoiding this and other
potential issues.

Signed-off-by: Koji Nakamaru <koji.nakamaru@gree.net>
---
    osxkeychain: lock for exclusive execution

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1729%2FKojiNakamaru%2Ffeature%2Fosxkeychian_exlock-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1729/KojiNakamaru/feature/osxkeychian_exlock-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1729

 contrib/credential/osxkeychain/git-credential-osxkeychain.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/contrib/credential/osxkeychain/git-credential-osxkeychain.c b/contrib/credential/osxkeychain/git-credential-osxkeychain.c
index 6a40917b1ef..0884db48d0a 100644
--- a/contrib/credential/osxkeychain/git-credential-osxkeychain.c
+++ b/contrib/credential/osxkeychain/git-credential-osxkeychain.c
@@ -414,6 +414,9 @@ int main(int argc, const char **argv)
 	if (!argv[1])
 		die("%s", usage);
 
+	if (open(argv[0], O_RDONLY | O_EXLOCK) == -1)
+		die("failed to lock %s", argv[0]);
+
 	read_credential();
 
 	if (!strcmp(argv[1], "get"))

base-commit: 0f3415f1f8478b05e64db11eb8aaa2915e48fef6
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2024-05-15 19:41 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-10  8:07 [PATCH] osxkeychain: lock for exclusive execution Koji Nakamaru via GitGitGadget
2024-05-10 15:02 ` Bo Anderson
2024-05-10 20:01   ` Jeff King
2024-05-10 20:33     ` brian m. carlson
2024-05-10 22:07       ` Jeff King
2024-05-10 23:12         ` brian m. carlson
2024-05-10 20:40     ` Junio C Hamano
2024-05-10 22:09       ` Jeff King
2024-05-10 22:50         ` Junio C Hamano
     [not found] ` <C0C8F71D-2A01-4C31-9EB6-AB31FA17C3AB@boanderson.me>
2024-05-10 18:26   ` Koji Nakamaru
2024-05-11 11:55 ` [PATCH v2 0/2] " Koji Nakamaru via GitGitGadget
2024-05-11 11:55   ` [PATCH v2 1/2] " Koji Nakamaru via GitGitGadget
2024-05-12  4:09     ` Junio C Hamano
2024-05-12  6:47       ` Koji Nakamaru
2024-05-11 11:55   ` [PATCH v2 2/2] osxkeychain: state[] seen=1 to skip unnecessary store operations Koji Nakamaru via GitGitGadget
2024-05-12  4:09     ` Junio C Hamano
2024-05-12  7:05       ` Koji Nakamaru
2024-05-15 19:21   ` [PATCH v3 0/2] osxkeychain: lock for exclusive execution Koji Nakamaru via GitGitGadget
2024-05-15 19:21     ` [PATCH v3 1/2] osxkeychain: exclusive lock to serialize execution of operations Koji Nakamaru via GitGitGadget
2024-05-15 19:21     ` [PATCH v3 2/2] osxkeychain: state to skip unnecessary store operations Koji Nakamaru via GitGitGadget
2024-05-15 19:41     ` [PATCH v3 0/2] osxkeychain: lock for exclusive execution Koji Nakamaru

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.