summaryrefslogtreecommitdiff
path: root/doc/bugs/windows_isExecutable_fail.mdwn
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-01-20 13:39:07 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-01-20 14:48:16 -0400
commitce0693bea2f03ed979258baac7409f210633e397 (patch)
tree53c10d6cbb0e3b55466ca62f19dbaa0e58ec5aa5 /doc/bugs/windows_isExecutable_fail.mdwn
parent155ff5705916e5b3d4749fde901a3d40ce1c9740 (diff)
Windows: Fix running of the pre-commit-annex hook.
Diffstat (limited to 'doc/bugs/windows_isExecutable_fail.mdwn')
-rw-r--r--doc/bugs/windows_isExecutable_fail.mdwn27
1 files changed, 27 insertions, 0 deletions
diff --git a/doc/bugs/windows_isExecutable_fail.mdwn b/doc/bugs/windows_isExecutable_fail.mdwn
new file mode 100644
index 000000000..41e5b29a2
--- /dev/null
+++ b/doc/bugs/windows_isExecutable_fail.mdwn
@@ -0,0 +1,27 @@
+On Windows, isExecutable fails to detect a file that is indeed executable
+as such. This prevents git-annex from running the pre-commit-hook
+on Windows.
+
+getFileStatus yields a fileMode of 100666, which is
+clearly a dummy mode. Not surprising, since unix-compat is partial stubs
+on windows.
+
+Actually, isExecutable is ok (it needs to check unix modes because it is
+used on file modes coming out of git). But, getFileStatus is the wrong
+thing to be using on Windows to check if a hook exists and is executable.
+
+I don't see anything in Win32 or Win32-extras on hackage that can check
+executablility. Looking at git's source, it uses `access(path, X_OK) < 0`;
+haskell equivilant is System.Posix.Files.fileAccess, but the version
+in unix-compat has the same problem as checking getFileStatus's fileMode.
+
+I think it's reasonable to assume that if a hook exists on windows, it's
+intended to be executable, and try to run it. Actually, testing with
+msysgit, it runs hooks whether or not they have the execute bit set!
+So, done that now.
+
+However, now git-annex tries to run the hook but fails when it's a shell
+script because #!/bin/sh is useless on windows. It looks to me like msysgit
+runs "sh hook" to work around that, and it is in fact parsing the shebang
+line and dispatching the interpreter. Ugh. (Also, pre-commit.bat doesn't
+get run.) Ok, added this same hack to git-annex. [[done]] --[[Joey]]