From: Rei Thiessen <rei.thiessen@gmail.com>
To: git@vger.kernel.org
Cc: Rei Thiessen <rei.thiessen@gmail.com>
Subject: [PATCH] cygwin: set write permission before unlink
Date: Wed, 29 Jun 2011 01:18:18 -0600 [thread overview]
Message-ID: <1309331898-32247-1-git-send-email-rei.thiessen@gmail.com> (raw)
On Cygwin 1.7, if filesystems are mounted with the "noacl" option,
files without write permission (in particular, the temp files created
in write_loose_object()) have their "read-only" flags set in NTFS.
"read-only" files can't be unlinked.
For Cygwin, set write permissions on files that are about to be unlinked.
Signed-off-by: Rei Thiessen <rei.thiessen@gmail.com>
---
compat/cygwin.c | 7 +++++++
compat/cygwin.h | 3 +++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/compat/cygwin.c b/compat/cygwin.c
index b4a51b9..f40ee6d 100644
--- a/compat/cygwin.c
+++ b/compat/cygwin.c
@@ -141,3 +141,10 @@ static int cygwin_lstat_stub(const char *file_name, struct stat *buf)
stat_fn_t cygwin_stat_fn = cygwin_stat_stub;
stat_fn_t cygwin_lstat_fn = cygwin_lstat_stub;
+#undef unlink
+int cygwin_unlink(const char *pathname)
+{
+ /* "read-only" files can't be unlinked */
+ chmod(pathname, 0666);
+ return unlink(pathname);
+}
diff --git a/compat/cygwin.h b/compat/cygwin.h
index a3229f5..aa2ba3e 100644
--- a/compat/cygwin.h
+++ b/compat/cygwin.h
@@ -7,3 +7,6 @@ extern stat_fn_t cygwin_lstat_fn;
#define stat(path, buf) (*cygwin_stat_fn)(path, buf)
#define lstat(path, buf) (*cygwin_lstat_fn)(path, buf)
+
+int cygwin_unlink(const char *pathname);
+#define unlink cygwin_unlink
--
1.7.4.1
next reply other threads:[~2011-06-29 7:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-29 7:18 Rei Thiessen [this message]
2011-06-29 14:31 ` [PATCH] cygwin: set write permission before unlink Christof Krüger
2011-06-29 18:48 ` Rei Thiessen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1309331898-32247-1-git-send-email-rei.thiessen@gmail.com \
--to=rei.thiessen@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).