-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Git Bash] Impossible to run a bash script from Windows Explorer if the path/name contains non-ASCII characters #2189
Comments
Probably the place to start looking is the install scripts in the build-extra repo to see how the 'double clicking' is set up. I couldn't tell (personal ignorance ;-) if you are using the default windows mechanism for file associations etc to get the script to run, or if it was via a Git for Windows specific action mechanism (a right click option). As a guess you are getting some character conversion issue between all the different apps/OSes/layers, such that you have, say, a windows characters being passed as if it is utf-8 or some such confusion. |
Steps to reproduce
|
I can run the script from the console in any case: User@User-PC MINGW64 /c/#Bash/New Folder/рџ’§
$ ./water\ ^Xрџ’§.sh
Hello there! I see a little not presentable view of the output of the console, but the script works. Another example: User@User-PC MINGW64 /c/#Bash/New Folder/CatГЎlogo
$ ./hello.sh
Hello there! |
The ability to run bash scripts from Windows' Explorer is very useful and convenient. In this case, a bash script behaves like a normal program(an |
@TestPolygon sorry for the long wait. This should be fixed in the next version of Git for Windows. To make sure, please download the 64-bit package from https://dev.azure.com/johannes-schindelin/git/_build/results?buildId=4912&view=artifacts, unpack |
drive.google.com, dropbox.com, mega.nz or any other file sharing service? |
@dscho that link requires a microsoft login. The download is probably only accessible to you. |
Well, boo.
In the meantime, it made it into the Git for Windows SDK. Try this: https://github.com/git-for-windows/git-sdk-64/raw/master/usr/bin/msys-2.0.dll |
There also has been a new snapshot in the meantime, if it is easier for you to run the Git for Windows installer. |
Running by double click works well now, but by drag and drop does not work well. How to reproduce
#!/bin/bash
# Shows args count
args_count=$#
echo "Args count: $args_count"
# List of sorted args
printf "%s\n" "$(printf "%s\n" "$@" | sort -n)"
sleep 2
If the bash script has "bad" character(s)* in its name or/and path, the script does not work at all when you drag and drop file(s) on it. When only the files (that you drag and drop on the script) have "bad" character(s) in its name or/and path it seems to work. *For example: éá脚本💧 |
I tried this with https://wingit.blob.core.windows.net/files/Git-prerelease-2.24.0.windows.2.14.g8715ee2266-64-bit.exe and it worked for me with the file name Not sure when I will get to debug this, though. |
It doesn't work on my machine.
It's an example set of "bad" chars. The existence of any (one) char of this set in the name or path of the script will break the work. |
Probably locale dependent. While umlauts aren't ASCII, they are on a buch of DOS/Windows codepages.(850,858,859,865,1252,...) |
Internally, Cygwin already uses __utf8_mbtowc(), even if it still claims to use the "ASCII" charset. But the `MB_CUR_MAX` value (which is not actually a constant, but dependent on the current locale) was still 1, which broke the initial `globify()` call while parsing the the command-line in `build_argv()` for non-ASCII arguments. This fixes git-for-windows/git#2189 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Internally, Cygwin already uses __utf8_mbtowc(), even if it still claims to use the "ASCII" charset. But the `MB_CUR_MAX` value (which is not actually a constant, but dependent on the current locale) was still 1, which broke the initial `globify()` call while parsing the the command-line in `build_argv()` for non-ASCII arguments. This fixes git-for-windows/git#2189 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Internally, Cygwin already uses __utf8_mbtowc(), even if it still claims to use the "ASCII" charset. But the `MB_CUR_MAX` value (which is not actually a constant, but dependent on the current locale) was still 1, which broke the initial `globify()` call while parsing the the command-line in `build_argv()` for non-ASCII arguments. This fixes git-for-windows/git#2189 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Internally, Cygwin already uses __utf8_mbtowc(), even if it still claims to use the "ASCII" charset. But the `MB_CUR_MAX` value (which is not actually a constant, but dependent on the current locale) was still 1, which broke the initial `globify()` call while parsing the the command-line in `build_argv()` for non-ASCII arguments. This fixes git-for-windows/git#2189 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Internally, Cygwin already uses __utf8_mbtowc(), even if it still claims to use the "ASCII" charset. But the `MB_CUR_MAX` value (which is not actually a constant, but dependent on the current locale) was still 1, which broke the initial `globify()` call while parsing the the command-line in `build_argv()` for non-ASCII arguments. This fixes git-for-windows/git#2189 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Internally, Cygwin already uses __utf8_mbtowc(), even if it still claims to use the "ASCII" charset. But the `MB_CUR_MAX` value (which is not actually a constant, but dependent on the current locale) was still 1, which broke the initial `globify()` call while parsing the the command-line in `build_argv()` for non-ASCII arguments. This fixes git-for-windows/git#2189 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Internally, Cygwin already uses __utf8_mbtowc(), even if it still claims to use the "ASCII" charset. But the `MB_CUR_MAX` value (which is not actually a constant, but dependent on the current locale) was still 1, which broke the initial `globify()` call while parsing the the command-line in `build_argv()` for non-ASCII arguments. This fixes git-for-windows/git#2189 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Internally, Cygwin already uses __utf8_mbtowc(), even if it still claims to use the "ASCII" charset. But the `MB_CUR_MAX` value (which is not actually a constant, but dependent on the current locale) was still 1, which broke the initial `globify()` call while parsing the the command-line in `build_argv()` for non-ASCII arguments. This fixes git-for-windows/git#2189 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Internally, Cygwin already uses __utf8_mbtowc(), even if it still claims to use the "ASCII" charset. But the `MB_CUR_MAX` value (which is not actually a constant, but dependent on the current locale) was still 1, which broke the initial `globify()` call while parsing the the command-line in `build_argv()` for non-ASCII arguments. This fixes git-for-windows/git#2189 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Internally, Cygwin already uses __utf8_mbtowc(), even if it still claims to use the "ASCII" charset. But the `MB_CUR_MAX` value (which is not actually a constant, but dependent on the current locale) was still 1, which broke the initial `globify()` call while parsing the the command-line in `build_argv()` for non-ASCII arguments. This fixes git-for-windows/git#2189 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Internally, Cygwin already uses __utf8_mbtowc(), even if it still claims to use the "ASCII" charset. But the `MB_CUR_MAX` value (which is not actually a constant, but dependent on the current locale) was still 1, which broke the initial `globify()` call while parsing the the command-line in `build_argv()` for non-ASCII arguments. This fixes git-for-windows/git#2189 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
After being buried in my inbox for a long time, I stumbled over this again. At this stage I have to admit defeat: I won't be able to set aside enough time to investigate this issue properly. I do not know whether this issue still reproduces with |
Internally, Cygwin already uses __utf8_mbtowc(), even if it still claims to use the "ASCII" charset. But the `MB_CUR_MAX` value (which is not actually a constant, but dependent on the current locale) was still 1, which broke the initial `globify()` call while parsing the the command-line in `build_argv()` for non-ASCII arguments. This fixes git-for-windows/git#2189 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Internally, Cygwin already uses __utf8_mbtowc(), even if it still claims to use the "ASCII" charset. But the `MB_CUR_MAX` value (which is not actually a constant, but dependent on the current locale) was still 1, which broke the initial `globify()` call while parsing the the command-line in `build_argv()` for non-ASCII arguments. This fixes git-for-windows/git#2189 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Internally, Cygwin already uses __utf8_mbtowc(), even if it still claims to use the "ASCII" charset. But the `MB_CUR_MAX` value (which is not actually a constant, but dependent on the current locale) was still 1, which broke the initial `globify()` call while parsing the the command-line in `build_argv()` for non-ASCII arguments. This fixes git-for-windows/git#2189 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Internally, Cygwin already uses __utf8_mbtowc(), even if it still claims to use the "ASCII" charset. But the `MB_CUR_MAX` value (which is not actually a constant, but dependent on the current locale) was still 1, which broke the initial `globify()` call while parsing the the command-line in `build_argv()` for non-ASCII arguments. This fixes git-for-windows/git#2189 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Internally, Cygwin already uses __utf8_mbtowc(), even if it still claims to use the "ASCII" charset. But the `MB_CUR_MAX` value (which is not actually a constant, but dependent on the current locale) was still 1, which broke the initial `globify()` call while parsing the the command-line in `build_argv()` for non-ASCII arguments. This fixes git-for-windows/git#2189 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Internally, Cygwin already uses __utf8_mbtowc(), even if it still claims to use the "ASCII" charset. But the `MB_CUR_MAX` value (which is not actually a constant, but dependent on the current locale) was still 1, which broke the initial `globify()` call while parsing the the command-line in `build_argv()` for non-ASCII arguments. This fixes git-for-windows/git#2189 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Internally, Cygwin already uses __utf8_mbtowc(), even if it still claims to use the "ASCII" charset. But the `MB_CUR_MAX` value (which is not actually a constant, but dependent on the current locale) was still 1, which broke the initial `globify()` call while parsing the the command-line in `build_argv()` for non-ASCII arguments. This fixes git-for-windows/git#2189 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Internally, Cygwin already uses __utf8_mbtowc(), even if it still claims to use the "ASCII" charset. But the `MB_CUR_MAX` value (which is not actually a constant, but dependent on the current locale) was still 1, which broke the initial `globify()` call while parsing the the command-line in `build_argv()` for non-ASCII arguments. This fixes git-for-windows/git#2189 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Internally, Cygwin already uses __utf8_mbtowc(), even if it still claims to use the "ASCII" charset. But the `MB_CUR_MAX` value (which is not actually a constant, but dependent on the current locale) was still 1, which broke the initial `globify()` call while parsing the the command-line in `build_argv()` for non-ASCII arguments. This fixes git-for-windows/git#2189 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Internally, Cygwin already uses __utf8_mbtowc(), even if it still claims to use the "ASCII" charset. But the `MB_CUR_MAX` value (which is not actually a constant, but dependent on the current locale) was still 1, which broke the initial `globify()` call while parsing the the command-line in `build_argv()` for non-ASCII arguments. This fixes git-for-windows/git#2189 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Internally, Cygwin already uses __utf8_mbtowc(), even if it still claims to use the "ASCII" charset. But the `MB_CUR_MAX` value (which is not actually a constant, but dependent on the current locale) was still 1, which broke the initial `globify()` call while parsing the the command-line in `build_argv()` for non-ASCII arguments. This fixes git-for-windows/git#2189 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Internally, Cygwin already uses __utf8_mbtowc(), even if it still claims to use the "ASCII" charset. But the `MB_CUR_MAX` value (which is not actually a constant, but dependent on the current locale) was still 1, which broke the initial `globify()` call while parsing the the command-line in `build_argv()` for non-ASCII arguments. This fixes git-for-windows/git#2189 and is needed to let Git's t7400.108(submodule with UTF-8 name) pass, which otherwise fails with: ++ git submodule add './å äö' fatal: repo URL: '"./å äö"' must be absolute or begin with ./|../ Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Internally, Cygwin already uses __utf8_mbtowc(), even if it still claims to use the "ASCII" charset. But the `MB_CUR_MAX` value (which is not actually a constant, but dependent on the current locale) was still 1, which broke the initial `globify()` call while parsing the the command-line in `build_argv()` for non-ASCII arguments. This fixes git-for-windows/git#2189 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Internally, Cygwin already uses __utf8_mbtowc(), even if it still claims to use the "ASCII" charset. But the `MB_CUR_MAX` value (which is not actually a constant, but dependent on the current locale) was still 1, which broke the initial `globify()` call while parsing the the command-line in `build_argv()` for non-ASCII arguments. This fixes git-for-windows/git#2189 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Internally, Cygwin already uses __utf8_mbtowc(), even if it still claims to use the "ASCII" charset. But the `MB_CUR_MAX` value (which is not actually a constant, but dependent on the current locale) was still 1, which broke the initial `globify()` call while parsing the the command-line in `build_argv()` for non-ASCII arguments. This fixes git-for-windows/git#2189 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Description
I cannot properly run the .sh script by clicking on it if the path to the script contains non-ASCII character(s). The script does not work at all (I see only immediately closing of a console.).
I have Windows 10, 64-bit, Git-2.21.0 64-bit.
For example:
The content of the script:
I can properly run the script in the console (git-bash.exe) in any way.
But, if I run the script from the Windows' Explorer by double-clicking on it:
Examples of the pathes:
Good:
C:\script.sh
C:\#Bash\New folder\script.sh
C:\#Bash\Pokmon.sh
"Bad":
C:\#Bash\Pokémon.sh
DiacriticC:\#Bash\Catálogo\script.sh
ESC:\#Bash\Новая папка\script.sh
RUC:\#Bash\New folder\脚本.sh
ZNC:\#Bash\Surrogate Pair 💧\script.sh
EmojiI would like to be able to run scripts by double-clicking if the path contains non-ASCII characters, at least characters from BMP (Basic Multilingual Plane).
The text was updated successfully, but these errors were encountered: