From: Linus Torvalds <torvalds@linux-foundation.org>
To: Alexander Litvinov <litvinov2004@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: My git repo is broken, how to fix it ?
Date: Mon, 19 Mar 2007 08:20:23 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.64.0703190804350.6730@woody.linux-foundation.org> (raw)
In-Reply-To: <200703191932.26856.litvinov2004@gmail.com>
On Mon, 19 Mar 2007, Alexander Litvinov wrote:
>
> It is pity but my repo was corrupted again. I have WinXP + cygwin +
> git-1.5.0-572-ge86d552. I was doing
> git-apply/git-am/git-reset/git-cvsexportcommit and broke repo somehow. I have
> two broken blobs that should be done by my recent patches.
Ok, can you send me just the two broken blobs? I assume that they are
loose objects, so when fsck complaines about a corrupt object xyzzy...,
just take those objects from
.git/objects/xy/zzy..
and tar the two broken ones up, and send it to me by email. I'll keep it
private if need be, but if you don't care about that, it would be even
better if you can send them to the list publicly so that others can see
what the corruption looks like.
> Is there any way to catch and solve the problem ?
I'd like to see the objects to look at what the corruption looks like, but
I suspect that it's cygwin and/or WinXP. I'm not at all convinced that
Windows is all that safe in general when it comes to data consistency, and
I suspect cygwin makes it much worse by making operations that *should* be
atomic be non-atomic.
Here's a patch that is probably a good idea to try. It disables the
hardlinking code for CYGWIN, and it also checks for errors from "close()".
Those are the two most obvious issues that I could imagine causing
problems..
Linus
---
sha1_file.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/sha1_file.c b/sha1_file.c
index 372af60..d829dc7 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1760,6 +1760,14 @@ static void write_sha1_file_prepare(void *buf, unsigned long len,
SHA1_Final(sha1, &c);
}
+#ifdef __CYGWIN__
+static int link(const char *old, const char *new)
+{
+ errno = ENOSYS;
+ return -1;
+}
+#endif
+
/*
* Link the tempfile to the final place, possibly creating the
* last directory level as you do so.
@@ -1951,7 +1959,8 @@ int write_sha1_file(void *buf, unsigned long len, const char *type, unsigned cha
if (write_buffer(fd, compressed, size) < 0)
die("unable to write sha1 file");
fchmod(fd, 0444);
- close(fd);
+ if (close(fd))
+ die("error closing sha1 file (%s)", strerror(errno));
free(compressed);
return move_temp_to_file(tmpfile, filename);
next prev parent reply other threads:[~2007-03-19 15:20 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-28 4:36 My git repo is broken, how to fix it ? Alexander Litvinov
2007-02-28 4:57 ` Linus Torvalds
2007-02-28 11:54 ` Alexander Litvinov
2007-02-28 16:19 ` Linus Torvalds
2007-02-28 19:12 ` Alex Riesen
2007-03-19 13:32 ` Alexander Litvinov
2007-03-19 15:20 ` Linus Torvalds [this message]
[not found] ` <200703201013.39169.litvinov2004@gmail.com>
2007-03-20 5:34 ` Linus Torvalds
2007-03-20 6:55 ` Alexander Litvinov
2007-03-20 7:42 ` Junio C Hamano
2007-03-20 15:23 ` Nicolas Pitre
[not found] ` <Pine.LNX.4.64.0703200832150.6730@woody.linux-foundation.org>
[not found] ` <Pine.LNX.4.64.0703200836490.6730@woody.linux-foundation.org>
[not found] ` <200703210956.50018.litvinov2004@gmail.com>
2007-03-22 15:58 ` Linus Torvalds
2007-03-22 16:34 ` Nicolas Pitre
[not found] ` <200703211024.04740.litvinov2004@gmail.com>
2007-03-22 16:17 ` Linus Torvalds
2007-03-22 16:29 ` Linus Torvalds
2007-03-22 16:48 ` Linus Torvalds
2007-03-22 17:01 ` Nicolas Pitre
2007-03-22 17:10 ` Linus Torvalds
2007-03-22 17:28 ` Nicolas Pitre
2007-03-22 22:13 ` Jeff King
2007-03-23 0:25 ` Linus Torvalds
2007-03-23 0:42 ` Bill Lear
2007-03-23 0:51 ` Jeff King
2007-03-22 20:31 ` [PATCH] git-apply: Do not free the wrong buffer when we convert the data for writeout Junio C Hamano
2007-03-22 20:55 ` Linus Torvalds
2007-03-23 3:55 ` Alexander Litvinov
2007-03-23 3:40 ` My git repo is broken, how to fix it ? Alexander Litvinov
2007-03-22 17:12 ` Johannes Sixt
2021-06-06 17:27 B
2021-06-06 17:28 B
2021-12-25 8:30 Joseph Mitchell
2021-12-26 0:48 ` Lemuria
2023-05-29 18:57 ross thomas
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=Pine.LNX.4.64.0703190804350.6730@woody.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=git@vger.kernel.org \
--cc=litvinov2004@gmail.com \
/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).