{"thread":{"id":"61752","subject":"BUG: \"git var GIT_SHELL_PATH\" is broken on Windows","startedAt":"2024-07-08T10:07:17Z","lastAt":"2024-07-08T13:09:05Z","messageCount":3,"participants":["Phillip Wood","brian m. carlson","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"498231","messageId":"cc267962-ca2d-4c4a-9ed8-d40c4d282522@gmail.com","threadId":"61752","inReplyTo":null,"subject":"BUG: \"git var GIT_SHELL_PATH\" is broken on Windows","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2024-07-08T10:07:17Z","receivedAt":"2024-07-08T10:07:17Z","isPatch":false,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Running \"git var GIT_SHELL_PATH\" on Windows prints \"/bin/sh\" which is \nnot very helpful when the path to the shell is actually \n\"C:\\Users\\gitlab_runner\\scoop\\apps\\mingit-busybox\\2.45.2\\mingw64\\bin\\ash.exe\"\n\nSupport for GIT_SHELL_PATH was added to \"git var\" in 1e65721227 (var: \nadd support for listing the shell, 2023-06-27) with the aim of making it \npossible for external programs to learn the location of the shell used \nto run the command returned by \"git var GIT_EDITOR\". As the commit \nmessage notes this is especially helpful on Windows where the shell \nisn't necessarily in $PATH. Unfortunately the implementation simply \nprints SHELL_PATH which is unused on Windows. As 776297548e (Do not use \nSHELL_PATH from build system in prepare_shell_cmd on Windows, \n2012-04-17) explains the location of the shell depends on git's \ninstallation prefix. For the git-for-windows builds it looks like the \nshell is always in \"$GIT_EXEC_PATH/../../bin/\" but I'm not sure if that \nis universally true.\n\nIt is possible to work around the bug by doing\n\n     git -c 'alias.run-editor=!$(git var GIT_EDITOR)' run-editor\n\nbut it would be good to fix \"git var GIT_SHELL_PATH\" or at least \ndocument that it is broken on Windows\n\nBest Wishes\n\nPhillip\n"},{"id":"498236","messageId":"ZovDPbgBS7WJIipz@tapette.crustytoothpaste.net","threadId":"61752","inReplyTo":"cc267962-ca2d-4c4a-9ed8-d40c4d282522@gmail.com","subject":"Re: BUG: \"git var GIT_SHELL_PATH\" is broken on Windows","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2024-07-08T10:45:17Z","receivedAt":"2024-07-08T10:45:19Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2024-07-08 at 10:07:17, Phillip Wood wrote:\n> Running \"git var GIT_SHELL_PATH\" on Windows prints \"/bin/sh\" which is not\n> very helpful when the path to the shell is actually\n> \"C:\\Users\\gitlab_runner\\scoop\\apps\\mingit-busybox\\2.45.2\\mingw64\\bin\\ash.exe\"\n> \n> Support for GIT_SHELL_PATH was added to \"git var\" in 1e65721227 (var: add\n> support for listing the shell, 2023-06-27) with the aim of making it\n> possible for external programs to learn the location of the shell used to\n> run the command returned by \"git var GIT_EDITOR\". As the commit message\n> notes this is especially helpful on Windows where the shell isn't\n> necessarily in $PATH. Unfortunately the implementation simply prints\n> SHELL_PATH which is unused on Windows. As 776297548e (Do not use SHELL_PATH\n> from build system in prepare_shell_cmd on Windows, 2012-04-17) explains the\n> location of the shell depends on git's installation prefix. For the\n> git-for-windows builds it looks like the shell is always in\n> \"$GIT_EXEC_PATH/../../bin/\" but I'm not sure if that is universally true.\n> \n> It is possible to work around the bug by doing\n> \n>     git -c 'alias.run-editor=!$(git var GIT_EDITOR)' run-editor\n> \n> but it would be good to fix \"git var GIT_SHELL_PATH\" or at least document\n> that it is broken on Windows\n\nUgh.  This was indeed supposed to work, but I no longer have access to a\nWindows machine, so we'd need someone who does have one to write up a\npatch.\n-- \nbrian m. carlson (they/them or he/him)\nToronto, Ontario, CA\n"},{"id":"498247","messageId":"cbdae028-db3d-b43e-57ef-52182452f49d@gmx.de","threadId":"61752","inReplyTo":"ZovDPbgBS7WJIipz@tapette.crustytoothpaste.net","subject":"Re: BUG: \"git var GIT_SHELL_PATH\" is broken on Windows","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2024-07-08T13:08:52Z","receivedAt":"2024-07-08T13:09:05Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Phillip & brian,\n\nOn Mon, 8 Jul 2024, brian m. carlson wrote:\n\n> On 2024-07-08 at 10:07:17, Phillip Wood wrote:\n> > Running \"git var GIT_SHELL_PATH\" on Windows prints \"/bin/sh\" which is not\n> > very helpful when the path to the shell is actually\n> > \"C:\\Users\\gitlab_runner\\scoop\\apps\\mingit-busybox\\2.45.2\\mingw64\\bin\\ash.exe\"\n> >\n> > Support for GIT_SHELL_PATH was added to \"git var\" in 1e65721227 (var: add\n> > support for listing the shell, 2023-06-27) with the aim of making it\n> > possible for external programs to learn the location of the shell used to\n> > run the command returned by \"git var GIT_EDITOR\". As the commit message\n> > notes this is especially helpful on Windows where the shell isn't\n> > necessarily in $PATH. Unfortunately the implementation simply prints\n> > SHELL_PATH which is unused on Windows. As 776297548e (Do not use SHELL_PATH\n> > from build system in prepare_shell_cmd on Windows, 2012-04-17) explains the\n> > location of the shell depends on git's installation prefix. For the\n> > git-for-windows builds it looks like the shell is always in\n> > \"$GIT_EXEC_PATH/../../bin/\" but I'm not sure if that is universally true.\n> >\n> > It is possible to work around the bug by doing\n> >\n> >     git -c 'alias.run-editor=!$(git var GIT_EDITOR)' run-editor\n> >\n> > but it would be good to fix \"git var GIT_SHELL_PATH\" or at least document\n> > that it is broken on Windows\n>\n> Ugh.  This was indeed supposed to work, but I no longer have access to a\n> Windows machine, so we'd need someone who does have one to write up a\n> patch.\n\nFunnily enough, the test suite specifically tested for the faulty `sh`\nsuffix.\n\nAlso, pro-tip: With GitHub Actions and\nhttps://github.com/mxschmitt/action-tmate you can fix compile errors and\nother problems directly on the hosted runners, including Windows ones. If\nyou do not have any access to Windows machines anymore, that's how you can\ngain it back. I use this, too, to ensure that my patches work on macOS as\nintended, as I do not have access to any other macOS machine.\n\nAs to the issue at hand, I offer\nhttps://lore.kernel.org/git/pull.1760.git.1720443778074.gitgitgadget@gmail.com\nto address it.\n\nCiao,\nJohannes\n"}]}