From patchwork Thu Aug 3 10:28:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Matthias_A=C3=9Fhauer?= X-Patchwork-Id: 13339698 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95033C001DF for ; Thu, 3 Aug 2023 10:28:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233844AbjHCK2g (ORCPT ); Thu, 3 Aug 2023 06:28:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234048AbjHCK2X (ORCPT ); Thu, 3 Aug 2023 06:28:23 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB0951BFD for ; Thu, 3 Aug 2023 03:28:22 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-31765aee31bso631203f8f.1 for ; Thu, 03 Aug 2023 03:28:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691058501; x=1691663301; h=cc:to:fcc:content-transfer-encoding:mime-version:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=K8L6CLXAcrjTUtmEErrIJ6QOMMmLmOcIbzawBae09ak=; b=SpbuvcKwYqwUHCnS4PYfpKFNdpmZ88s77u79Rq7Qv0FUFwUeWko0SrFfG4O4QUBaIc VlzwOKuWb2easyddyKMT7JbeffjeWwho4fQhMzcP8KpkIGCUdD5q70JEZZQ0Mdz3XsN4 lotKgue+H8vLe+gaAD7MwVUkv3ektaL9P5Eoxr/G64FUjAhcjVgPYh16YThDRAjpMxNU MeiVH64WMRLI5xzsaTQavKp5quCU1G2CsaM7EsfSsigEhzNKtRLFjtmr4QFfoZ9qkqLm Is5mxDp8Il9h8Lw6fJyKF29VrYIv3Wwuqk2sqephW4NRr+HfEb9COcpSJ1xVTEPToJMc SjyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691058501; x=1691663301; h=cc:to:fcc:content-transfer-encoding:mime-version:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=K8L6CLXAcrjTUtmEErrIJ6QOMMmLmOcIbzawBae09ak=; b=CiwuZRwD1+BmoeBXVQ9yROnEoDqylmr4EXxdyIfdBGHr/moyJ8jr6ii6buerZqXk5D acp3chhRzdZgD8XTIoAcMz9OQPN+I9VlvTNX9mVmxU9YMObmjd6F8YzZqvPmnvgpmXmN j/y4dendGWGVliRkWZw0YCh2BBC95MdgpPw/+JA1RSlO1F8uzBCNQkOdrF9PfHUqPEZl cTpa7TgilvNy9QXiJUKWUQYAqryWSPc7Ej2c4yRE8F6zjQ3brS8sY0W1X4iCKl1gEDus Zc1mgRmjLgsLqw1YMTuDCJOsQQIEOXscdKGOBav5co3EI/FrUzmYABPlVPVyF0GI5Nsh FK8g== X-Gm-Message-State: ABy/qLZhNz3BbWcatQJarK75LxxfAMyq1NsVQT4d9X/oK1NeWz9wKb2m upeKVH6sYdiZDsBUHN64CyGaN83SXEM= X-Google-Smtp-Source: APBJJlGTwXKf2KDmcV/hRrTjhelnFeAuAxXhzwxVaQ+1hJzXuuFQcD8H1Ygoyx4T1puXx7Tprp2O3A== X-Received: by 2002:adf:e848:0:b0:30a:f030:8637 with SMTP id d8-20020adfe848000000b0030af0308637mr6829793wrn.22.1691058500622; Thu, 03 Aug 2023 03:28:20 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id z8-20020adfec88000000b0031773a8e5c4sm21371307wrn.37.2023.08.03.03.28.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Aug 2023 03:28:20 -0700 (PDT) Message-ID: <6ed968e128897ad75fb09a69395ee3571bb40677.1691058498.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Thu, 03 Aug 2023 10:28:16 +0000 Subject: [PATCH 1/3] compat: make path_lookup() available outside mingw.c MIME-Version: 1.0 Fcc: Sent To: git@vger.kernel.org Cc: Louis Strous , Pranit Bauva , Johannes Schindelin , Denton Liu , Tanushree Tumane , Jeff Hostetler , Miriam Rubio , Junio C Hamano , Matthias =?utf-8?q?A=C3=9Fhauer?= , =?utf-8?q?Matthias_A?= =?utf-8?q?=C3=9Fhauer?= Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: =?utf-8?q?Matthias_A=C3=9Fhauer?= From: =?UTF-8?q?Matthias=20A=C3=9Fhauer?= Rename it to mingw_path_lookup() to avoid leading future contributors to believe this would be portable. This is in preparation for a patch to teach locate_in_PATH() and exists_in_PATH() in run-command.c to work on windows. Signed-off-by: Matthias Aßhauer --- compat/mingw.c | 20 ++++++++------------ compat/mingw.h | 6 ++++++ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/compat/mingw.c b/compat/mingw.c index d06cdc6254f..5d3368b1705 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -1316,11 +1316,7 @@ static char *lookup_prog(const char *dir, int dirlen, const char *cmd, return NULL; } -/* - * Determines the absolute path of cmd using the split path in path. - * If cmd contains a slash or backslash, no lookup is performed. - */ -static char *path_lookup(const char *cmd, int exe_only) +char *mingw_path_lookup(const char *cmd, int exe_only) { const char *path; char *prog = NULL; @@ -1515,7 +1511,7 @@ static int is_msys2_sh(const char *cmd) if (ret >= 0) return ret; - p = path_lookup(cmd, 0); + p = mingw_path_lookup(cmd, 0); if (!p) ret = 0; else { @@ -1533,7 +1529,7 @@ static int is_msys2_sh(const char *cmd) static char *sh; if (!sh) - sh = path_lookup("sh", 0); + sh = mingw_path_lookup("sh", 0); return !fspathcmp(cmd, sh); } @@ -1646,7 +1642,7 @@ static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **deltaen strace_env = getenv("GIT_STRACE_COMMANDS"); if (strace_env) { - char *p = path_lookup("strace.exe", 1); + char *p = mingw_path_lookup("strace.exe", 1); if (!p) return error("strace not found!"); if (xutftowcs_path(wcmd, p) < 0) { @@ -1801,7 +1797,7 @@ pid_t mingw_spawnvpe(const char *cmd, const char **argv, char **deltaenv, int fhin, int fhout, int fherr) { pid_t pid; - char *prog = path_lookup(cmd, 0); + char *prog = mingw_path_lookup(cmd, 0); if (!prog) { errno = ENOENT; @@ -1812,7 +1808,7 @@ pid_t mingw_spawnvpe(const char *cmd, const char **argv, char **deltaenv, if (interpr) { const char *argv0 = argv[0]; - char *iprog = path_lookup(interpr, 1); + char *iprog = mingw_path_lookup(interpr, 1); argv[0] = prog; if (!iprog) { errno = ENOENT; @@ -1841,7 +1837,7 @@ static int try_shell_exec(const char *cmd, char *const *argv) if (!interpr) return 0; - prog = path_lookup(interpr, 1); + prog = mingw_path_lookup(interpr, 1); if (prog) { int exec_id; int argc = 0; @@ -1890,7 +1886,7 @@ int mingw_execv(const char *cmd, char *const *argv) int mingw_execvp(const char *cmd, char *const *argv) { - char *prog = path_lookup(cmd, 0); + char *prog = mingw_path_lookup(cmd, 0); if (prog) { mingw_execv(prog, argv); diff --git a/compat/mingw.h b/compat/mingw.h index 209cf7cebad..af1ff4be320 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -626,3 +626,9 @@ void open_in_gdb(void); * Used by Pthread API implementation for Windows */ int err_win_to_posix(DWORD winerr); + +/* + * Determines the absolute path of cmd using the split path in path. + * If cmd contains a slash or backslash, no lookup is performed. + */ +char *mingw_path_lookup(const char *cmd, int exe_only); From patchwork Thu Aug 3 10:28:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Matthias_A=C3=9Fhauer?= X-Patchwork-Id: 13339700 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CABCCC001DF for ; Thu, 3 Aug 2023 10:28:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235278AbjHCK2j (ORCPT ); Thu, 3 Aug 2023 06:28:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234507AbjHCK2Y (ORCPT ); Thu, 3 Aug 2023 06:28:24 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B00A2109 for ; Thu, 3 Aug 2023 03:28:23 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3fe12820bffso7860025e9.3 for ; Thu, 03 Aug 2023 03:28:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691058501; x=1691663301; h=cc:to:fcc:content-transfer-encoding:mime-version:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=cV/5ooSiOeSiBEP29cxcMJLnbS/fejhlBcxpxe2OT9E=; b=gDT9U+zfWeQ1RX4KPdomU5jNqhdAQuiTV9P2i1m8jWJ9fgjqltWil6eLtlxoy1TtJF ddNOq/zt2JgRQEkkJQuICkIIa67R1tbyb4JWTrSqkojzsAseGt2W4XVUNSrjTyt9sPPj Jq+QXpH0IH/PvlF3gb6BLpYfwK0jWpRZDSygwD6Bpdb4ZiZx4C2IgeDK76B8sVoKDs/v 86q35H1o7wjVGmt2nTbkXWQz2BbOARUxdzKapaUH0h2EaIZM7Uq5uMJJ5UzFjWbFdflO 35iWPMvy/2MpZLMdMGwOj+9MNZ26TglKOag3jyDXhR/gZyreW6QHQork9eXsPeD2oHLV 4MIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691058501; x=1691663301; h=cc:to:fcc:content-transfer-encoding:mime-version:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cV/5ooSiOeSiBEP29cxcMJLnbS/fejhlBcxpxe2OT9E=; b=VN0VV2EZzGhoH1lk2eeZJi8GtxQSk1476sHiIuqPCq+pg74dqGILpm3L+AI60Pthsg Vn+FvKnK9HCq2Xns6uSsz277fb4c8yKzcTAO9OhFAvAHX/QgfiWyYX/ssjKKQk8N83w0 +pP2PJ+ZyNJxvrvOztGwM6v+2mOSw5FagjLU+Tb+QkZqGFHCIvz5zw7xhFYrKnMlHQ6a hdWiM+bMI1ou9OaeT+FSbEwRXHvjSxYue9ODaaZOX8ywDt3UsxsqTL0VvVTzBBNfj/Cj DqpKRF1Imb1ZBrr/VQcRTx5kX7rc7mZ8xNXD61sy7H1ewHkR+VIrkyqkHKk9SsduIbxv QCSA== X-Gm-Message-State: ABy/qLbuf2FwvIW7mYt/S2b1VWtEM/8N8X4r8lSWmWsLmIpPGhf71FTt T3acHh9mwc8Ikh9eELU3tFKgaj4KFvo= X-Google-Smtp-Source: APBJJlGg8Fit3LQE4LiC3M9GSYU5SB7y0WuAKfifRB0PpYpQlkSYl1KQwyaCP//krD4nEr/p+1JKBQ== X-Received: by 2002:a1c:6a0a:0:b0:3f5:878:c0c2 with SMTP id f10-20020a1c6a0a000000b003f50878c0c2mr6791928wmc.3.1691058501206; Thu, 03 Aug 2023 03:28:21 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id n4-20020a05600c294400b003fbe4cecc3bsm3965091wmd.16.2023.08.03.03.28.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Aug 2023 03:28:21 -0700 (PDT) Message-ID: In-Reply-To: References: Date: Thu, 03 Aug 2023 10:28:17 +0000 Subject: [PATCH 2/3] run-command: teach locate_in_PATH about Windows MIME-Version: 1.0 Fcc: Sent To: git@vger.kernel.org Cc: Louis Strous , Pranit Bauva , Johannes Schindelin , Denton Liu , Tanushree Tumane , Jeff Hostetler , Miriam Rubio , Junio C Hamano , Matthias =?utf-8?q?A=C3=9Fhauer?= , =?utf-8?q?Matthias_A?= =?utf-8?q?=C3=9Fhauer?= Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: =?utf-8?q?Matthias_A=C3=9Fhauer?= From: =?UTF-8?q?Matthias=20A=C3=9Fhauer?= since 5e1f28d206 (bisect--helper: reimplement `bisect_visualize()` shell function in C, 2021-09-13) `git bisect visualize` uses exists_in_PATH() to check wether it should call `gitk`, but exists_in_PATH() relies on locate_in_PATH() which currently only understands POSIX-ish PATH variables (a list of paths, separated by colons) on native Windows executables we encounter Windows PATH variables (a list of paths that often contain drive letters (and thus colons), separated by semicolons). Luckily we do already have a function that can lookup executables on windows PATHs: mingw_path_lookup(). Teach locate_in_PATH() to use mingw_path_lookup() on Windows. Reported-by: Louis Strous Signed-off-by: Matthias Aßhauer --- run-command.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/run-command.c b/run-command.c index 60c94198664..8f518e37e27 100644 --- a/run-command.c +++ b/run-command.c @@ -182,13 +182,10 @@ int is_executable(const char *name) * Returns the path to the command, as found in $PATH or NULL if the * command could not be found. The caller inherits ownership of the memory * used to store the resultant path. - * - * This should not be used on Windows, where the $PATH search rules - * are more complicated (e.g., a search for "foo" should find - * "foo.exe"). */ static char *locate_in_PATH(const char *file) { +#ifndef GIT_WINDOWS_NATIVE const char *p = getenv("PATH"); struct strbuf buf = STRBUF_INIT; @@ -217,6 +214,9 @@ static char *locate_in_PATH(const char *file) strbuf_release(&buf); return NULL; +#else + return mingw_path_lookup(file,0); +#endif } int exists_in_PATH(const char *command) From patchwork Thu Aug 3 10:28:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Matthias_A=C3=9Fhauer?= X-Patchwork-Id: 13339699 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85640C00528 for ; Thu, 3 Aug 2023 10:28:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235128AbjHCK2i (ORCPT ); Thu, 3 Aug 2023 06:28:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234460AbjHCK2Y (ORCPT ); Thu, 3 Aug 2023 06:28:24 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62219211E for ; Thu, 3 Aug 2023 03:28:23 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-31757edd9edso623740f8f.2 for ; Thu, 03 Aug 2023 03:28:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691058501; x=1691663301; h=cc:to:fcc:content-transfer-encoding:mime-version:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=gFlEMxijSUn53x3INOGBdqUaKZQQxsdGpoJxtWOxCcM=; b=bGhWHwr4AgWGnzuAr3AMZWaVwF4re27ASTAVLXNJDZVIzQbG6sNBghUMCaBjSQJ3+N rQvBDHtX/SN6T+Ejo36CikG4xHVIzEwhsh0JemNgWb2gQSqs+3RuyGKp7LsFpzAeRB0+ hjzMmrHlxnbUsubwMYV6SDnJ9v6er3d2tC9krmnSpNSd8cRRlDPsTspv7lYyGlN+uILV cJ3Wy/GiTXtTxP3ofvp2ZZ/sPJG6v78vLs4WZ3j8MbCe+aw2mwurFolhZzzf8Z8alnko jh0eGgpd+ZQa069q2t1OiHsxdY5V8FoPgoqGmoReOFZUb+Vi+XAQ6154wdu2LO/1xH3N PArg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691058501; x=1691663301; h=cc:to:fcc:content-transfer-encoding:mime-version:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gFlEMxijSUn53x3INOGBdqUaKZQQxsdGpoJxtWOxCcM=; b=N/q6tLYPGwOuQZek9Wd9Wd7oMuCm5ck/9oyszMU8aNFBSNEAtUTmdRbJsKLzsOrm4o p0MmlimAPc7b9uMcUuBx7Wldg58H7cD3Q7LvYz3Gj1/Ap97oCLp+UfVfjASYVG/g0cSy MSvjPfmC5LOf0DRaEwc42Oc3BLM2t6QvPKQeSKbxavtWgoidf9VsNcD2STc27g3raS66 bpYR004kIpMkaMd3yfuAD2ObIjqWMNDbC6Cyr6kcr3yOJ2h0V5j9xycyfc/svnZjJe62 9Dug+ILQVllWpx45vv1Kl67nSzhEUe0lDn8LsENygczkPa3lW2DHJsabTnaD248XFpx/ C8vQ== X-Gm-Message-State: ABy/qLYoXrQuLCUe7XR/90xypIXuurSQRu64nfvB5oiE25NZyZo37srt gTPhw1YFw0EqjSjKxsMcDa6e8Yy51jc= X-Google-Smtp-Source: APBJJlHh/h6/HmmaQ3z7MV23JlWSOTYQQtt6WE3t4i7BoP1zrPOjOFshpHOIhiLbBQbN5EzE0NuCsg== X-Received: by 2002:adf:e441:0:b0:317:5e91:5588 with SMTP id t1-20020adfe441000000b003175e915588mr6466602wrm.3.1691058501681; Thu, 03 Aug 2023 03:28:21 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id v9-20020adfe4c9000000b00314374145e0sm12143546wrm.67.2023.08.03.03.28.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Aug 2023 03:28:21 -0700 (PDT) Message-ID: In-Reply-To: References: Date: Thu, 03 Aug 2023 10:28:18 +0000 Subject: [PATCH 3/3] docs: update when `git bisect visualize` uses `gitk` MIME-Version: 1.0 Fcc: Sent To: git@vger.kernel.org Cc: Louis Strous , Pranit Bauva , Johannes Schindelin , Denton Liu , Tanushree Tumane , Jeff Hostetler , Miriam Rubio , Junio C Hamano , Matthias =?utf-8?q?A=C3=9Fhauer?= , =?utf-8?q?Matthias_A?= =?utf-8?q?=C3=9Fhauer?= Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: =?utf-8?q?Matthias_A=C3=9Fhauer?= From: =?UTF-8?q?Matthias=20A=C3=9Fhauer?= This check has involved more environment variables than just `DISPLAY` since 508e84a790 (bisect view: check for MinGW32 and MacOSX in addition to X11, 2008-02-14), so let's update the documentation accordingly. Signed-off-by: Matthias Aßhauer --- Documentation/git-bisect.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/git-bisect.txt b/Documentation/git-bisect.txt index fbb39fbdf5d..82b1d5ac6c5 100644 --- a/Documentation/git-bisect.txt +++ b/Documentation/git-bisect.txt @@ -204,9 +204,9 @@ as an alternative to `visualize`): $ git bisect visualize ------------ -If the `DISPLAY` environment variable is not set, 'git log' is used -instead. You can also give command-line options such as `-p` and -`--stat`. +If none of the environment variables `DISPLAY`, `SESSIONNAME`, `MSYSTEM` and +`SECURITYSESSIONID` is set, 'git log' is used instead. You can also give +command-line options such as `-p` and `--stat`. ------------ $ git bisect visualize --stat