* [PATCH v3] Improve the filemode trustability check
@ 2014-11-21 9:34 Torsten Bögershausen
0 siblings, 0 replies; only message in thread
From: Torsten Bögershausen @ 2014-11-21 9:34 UTC (permalink / raw)
To: git; +Cc: tboegi
Some file systems do not support the executable bit:
a) The user executable bit is always 0, e.g. VFAT mounted with -onoexec
b) The user executable bit is always 1, e.g. cifs mounted with -ofile_mode=0755
c) There are system where user executable bit is 1 even if it should be 0
like b), but the file mode can be maintained locally. chmod -x changes the
file mode from 0766 to 0666, until the file system is unmounted and
remounted and the file mode is 0766 again.
This been observed when a Windows machine with NTFS exports a share to
Mac OS X via smb or afp.
Case a) and b) are handled by the current code.
Case c) qualifies as "non trustable executable bit" and core.filemode
should be false, but this is currently not done.
Detect when ".git/config" has the user executable bit set after
creat(".git/config", 0666) and set core.filemode to false.
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
---
Thanks for the review, I never paid attention to the re-init.
The following works for me:
builtin/init-db.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/builtin/init-db.c b/builtin/init-db.c
index aab44d2..2619ca5 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -256,6 +256,8 @@ static int create_default_files(const char *template_path)
!lstat(path, &st2) &&
st1.st_mode != st2.st_mode &&
!chmod(path, st1.st_mode));
+ if (filemode && !reinit && (st1.st_mode & S_IXUSR))
+ filemode = 0;
}
git_config_set("core.filemode", filemode ? "true" : "false");
--
2.0.0.GIT
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-11-21 9:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-21 9:34 [PATCH v3] Improve the filemode trustability check Torsten Bögershausen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).