-
-
Notifications
You must be signed in to change notification settings - Fork 730
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
Filenames with unusual characters break check_executables_have_shebangs #508
Comments
it should call would you like to attempt a patch? the relevant code is here: pre-commit-hooks/pre_commit_hooks/check_executables_have_shebangs.py Lines 28 to 41 in 5372f44
but actually now that I look at the script, it shouldn't ever try to open files with weird quoting, how are you calling this script? |
Indeed, with $ git ls-files -z --stage -- tests/demo/doc/mañana.txt tests/demo/doc/manana.txt
100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 tests/demo/doc/manana.txt100644 5ab9dcdd36df0f76f202227ecb7ae8a5baaa456b 0 tests/demo/doc/mañana.txt Thanks! Then I can send a PR, we just have to split on
It's opened by pre-commit-hooks/pre_commit_hooks/check_executables_have_shebangs.py Lines 44 to 48 in 5372f44
We are simply calling Here is the config: https://github.com/copier-org/copier/blob/master/.pre-commit-config.yaml#L54 |
would you be interested in working on a patch to fix this? |
Yes, I'll send one tomorrow. In the meantime if you have any hint/advice, please tell me! |
you'll want to add feel free to copy that implementation here if there isn't already something doing similar in |
The
check_executables_have_shebangs
gets file paths with the output of the following git command:I'm not sure about Linux, but on Windows, when the filename contains an unusual character (sorry about the choice of "unusual" to describe the character, I don't want to speculate on encoding issues), the character is escaped with integer sequences, and git wraps the file path in double-quotes (because of the backslashes I guess):
The resulting path variable becomes
"tests/demo/doc/ma\303\261ana.txt"
, and then the script tries toopen
it, which fails of course because of the quotes and escaping:To fix the quotes issue, the pre-commit script could try to remove them with a
.strip('"')
call.For the character escaping, I have no idea! Do you 😄 ?
Ref: copier-org/copier#224 (comment)
The text was updated successfully, but these errors were encountered: