git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git bugs
@ 2017-02-23 20:27 Sean Hunt
  2017-02-24 16:52 ` Johannes Schindelin
  0 siblings, 1 reply; 37+ messages in thread
From: Sean Hunt @ 2017-02-23 20:27 UTC (permalink / raw)
  To: git

There are a few bugs I git I noticed when using mingw, mingw64,
cygwin, and cygwin64. These bugs are the following:

if I do git ``rebase -i --root`` and tell it to edit every commit to
gpg sign all my commits it bugs out and merges all of the commits into
1 commit instead of only appending the ``-S`` to each and every commit
and keeping all of the commits. It is as if I told it to squash the
commits but yet I did not. There is also another bug where if I clone
a repo on Windows and not on github desktop and that I placed commits
to the repo on github web and then when I rebase to squash the commits
to 1 commit (some repos are doing it as a requirement for 1 commit
PR's) that all of my commits on the remote (fork in this case) that is
linked to an open pull request are discarded and then the pull request
is somehow and oddly closed. It is super annoying.

^ permalink raw reply	[flat|nested] 37+ messages in thread
* git bugs
@ 2008-06-10  8:41 Ben Lynn
  2008-06-10 16:58 ` Daniel Barkalow
                   ` (2 more replies)
  0 siblings, 3 replies; 37+ messages in thread
From: Ben Lynn @ 2008-06-10  8:41 UTC (permalink / raw)
  To: git

I've come across a couple of bugs. Most users will probably never
encounter them, but I think they ought to be fixed. Apologies if
they're well-known issues. I haven't read much of this list.

1. The import/export language poorly handles distinct initial commits
on the same branch, because given two commits with same branch name,
it assumes the latter is the descendant of the former (if there are no
"from" commands).

Normally this is what you want. But if your project, like git, ever
merges distinct initial commits, then all but the first will
unexpectedly gain parents, corrupting all their descendants' hashes.
For example:

$ git clone git://git.kernel.org/pub/scm/git/git.git
$ git checkout -b test 60ea0fdd7de001405fcc7591beb18a66a1f0dd09
$ git fast-export test > /tmp/x
$ cd /some/empty/dir
$ git init
$ git fast-import < /tmp/x
$ git checkout test

Importing a pristine export, we discover Linus did not in fact make
the first commit to the git project:

$ git log d154ebcc23bfcec2ed44e365af9e5c14c6e22015

As a workaround, I have a custom importer that knows that
git-fast-export omits the "from" command in initial commits. But there
should be a command to specify that the current commit is an initial
commit, allowing reliable export of projects such as git.

2. Kudos to everyone who figured out the nasty race condition and its
complex solution as described in Documentation/technical/racy-git.txt
and the comments of read-cache.c. It took me a while to get my head
around it.

Unfortunately, the solution isn't perfect. Try this:

$ echo xyzzy > file
$ git update-index --add file   # don't zero size since contents match
$ echo frotz > file             # all stats still match, contents don't
$ echo nitfol > other  # can be done much earlier
$ git update-index --add other  # now the cached size is zeroed
$ : > file                      # zero the file size muahahaha
$ # Type fast! The above must take place within the same second! ;-)
$ sleep 2
$ echo filfre > other
$ git update-index --add other  # stats of "file" match, hash is wrong

Essentially, we trigger two index writes that avoid operations on
"file": one immediately after "file" is first committed and identified
as racily clean, and the second some time later, after we have
sneakily zeroed the file behind git's back (after previously editing
its contents in place). We defeat the safeguards and end up with a bad
hash in the index that appears valid.

The"other" file merely causes index writes without reading the "file"
entry. It is also racily clean in the above, but this is irrelevant.

It's unlikely this sequence of operations would occur in real usage,
but I'd sleep better if this index corruption bug were eliminated. One
practical but unsatisfactory easy "fix" is to mark racily clean
entries with SIZE_MAX instead of 0. Who uses git to track to files of
this size?

A better solution would be to introduce a new per-entry flag. Let's
call it "dodgy". Then during a cache entry update, we set "dodgy" if
the mtime is bigger or equal to the index timestamp. And during cache
entry reads, we check "dodgy": if clear, then we trust the hatch,
otherwise we don't trust the hash and recompute it, again setting
"dodgy" if necessary (i.e. if the mtime matches the index timestamp
again).

Although this solution does require adding a flag per index entry, we
no longer have to scan through the index on every index write to
perform the size zero hack.

-Ben

^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2017-02-24 16:59 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-23 20:27 git bugs Sean Hunt
2017-02-24 16:52 ` Johannes Schindelin
  -- strict thread matches above, loose matches on Subject: below --
2008-06-10  8:41 Ben Lynn
2008-06-10 16:58 ` Daniel Barkalow
2008-06-10 17:44 ` Linus Torvalds
2008-06-10 18:45   ` Ben Lynn
2008-06-10 20:06     ` Linus Torvalds
2008-06-10 23:09       ` Ben Lynn
2008-06-10 23:38         ` Junio C Hamano
2008-06-11  0:02           ` Ben Lynn
2008-06-11  0:20             ` Junio C Hamano
2008-06-11  0:24               ` Ben Lynn
2008-06-11  0:53                 ` Ben Lynn
2008-06-11 12:46                 ` Stephen R. van den Berg
2008-06-12  6:51                   ` Ben Lynn
2008-06-11  1:36             ` Linus Torvalds
2008-06-11  2:04               ` Ben Lynn
2008-06-11  2:12                 ` Linus Torvalds
2008-06-11  2:31                   ` Ben Lynn
2008-06-11  2:39                     ` Linus Torvalds
2008-06-11  5:58                       ` Ben Lynn
2008-06-11  6:18                         ` Ben Lynn
2008-06-11 14:54                           ` Linus Torvalds
2008-06-11 17:52                             ` Ben Lynn
2008-06-11 18:10                               ` Linus Torvalds
2008-06-11 18:48                                 ` Ben Lynn
2008-06-11 18:53                                   ` Linus Torvalds
2008-06-11 20:57                                     ` Ben Lynn
2008-06-11 21:50                                     ` Junio C Hamano
2008-06-11 14:52                         ` Linus Torvalds
2008-06-12 20:06   ` Junio C Hamano
2008-06-13 10:10   ` Jeff King
2008-06-13 23:09     ` Junio C Hamano
2008-06-14  6:25       ` Jeff King
2008-06-12  3:17 ` Shawn O. Pearce
2008-06-12  6:46   ` Ben Lynn
2008-06-12  7:12   ` Johannes Schindelin

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).