<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git, branch v2.13.7</title>
<subtitle>Fork of git SCM with my patches.</subtitle>
<id>http://git.kilabit.info/git/atom?h=v2.13.7</id>
<link rel='self' href='http://git.kilabit.info/git/atom?h=v2.13.7'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/'/>
<updated>2018-05-22T04:50:36Z</updated>
<entry>
<title>Git 2.13.7</title>
<updated>2018-05-22T04:50:36Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-05-22T04:50:36Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=0114f71344844be9e5add321cffea34bac077d75'/>
<id>urn:sha1:0114f71344844be9e5add321cffea34bac077d75</id>
<content type='text'>
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/submodule-fix-loose' into maint-2.13</title>
<updated>2018-05-22T04:48:26Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-05-22T04:48:26Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=8528c31d98c358cd27f45e203745bcdef03ca589'/>
<id>urn:sha1:8528c31d98c358cd27f45e203745bcdef03ca589</id>
<content type='text'>
* jk/submodule-fix-loose:
  verify_path: disallow symlinks in .gitmodules
  update-index: stat updated files earlier
  verify_dotfile: mention case-insensitivity in comment
  verify_path: drop clever fallthrough
  skip_prefix: add case-insensitive variant
  is_{hfs,ntfs}_dotgitmodules: add tests
  is_ntfs_dotgit: match other .git files
  is_hfs_dotgit: match other .git files
  is_ntfs_dotgit: use a size_t for traversing string
  submodule-config: verify submodule names as paths
</content>
</entry>
<entry>
<title>verify_path: disallow symlinks in .gitmodules</title>
<updated>2018-05-22T03:50:11Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-05-05T00:03:35Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=10ecfa76491e4923988337b2e2243b05376b40de'/>
<id>urn:sha1:10ecfa76491e4923988337b2e2243b05376b40de</id>
<content type='text'>
There are a few reasons it's not a good idea to make
.gitmodules a symlink, including:

  1. It won't be portable to systems without symlinks.

  2. It may behave inconsistently, since Git may look at
     this file in the index or a tree without bothering to
     resolve any symbolic links. We don't do this _yet_, but
     the config infrastructure is there and it's planned for
     the future.

With some clever code, we could make (2) work. And some
people may not care about (1) if they only work on one
platform. But there are a few security reasons to simply
disallow it:

  a. A symlinked .gitmodules file may circumvent any fsck
     checks of the content.

  b. Git may read and write from the on-disk file without
     sanity checking the symlink target. So for example, if
     you link ".gitmodules" to "../oops" and run "git
     submodule add", we'll write to the file "oops" outside
     the repository.

Again, both of those are problems that _could_ be solved
with sufficient code, but given the complications in (1) and
(2), we're better off just outlawing it explicitly.

Note the slightly tricky call to verify_path() in
update-index's update_one(). There we may not have a mode if
we're not updating from the filesystem (e.g., we might just
be removing the file). Passing "0" as the mode there works
fine; since it's not a symlink, we'll just skip the extra
checks.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
</content>
</entry>
<entry>
<title>update-index: stat updated files earlier</title>
<updated>2018-05-22T03:50:11Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-05-14T15:00:56Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=eb12dd0c764d2b71bebd5ffffb7379a3835253ae'/>
<id>urn:sha1:eb12dd0c764d2b71bebd5ffffb7379a3835253ae</id>
<content type='text'>
In the update_one(), we check verify_path() on the proposed
path before doing anything else. In preparation for having
verify_path() look at the file mode, let's stat the file
earlier, so we can check the mode accurately.

This is made a bit trickier by the fact that this function
only does an lstat in a few code paths (the ones that flow
down through process_path()). So we can speculatively do the
lstat() here and pass the results down, and just use a dummy
mode for cases where we won't actually be updating the index
from the filesystem.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
</content>
</entry>
<entry>
<title>verify_dotfile: mention case-insensitivity in comment</title>
<updated>2018-05-22T03:50:11Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-05-15T13:56:50Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=641084b618ddbe099f0992161988c3e479ae848b'/>
<id>urn:sha1:641084b618ddbe099f0992161988c3e479ae848b</id>
<content type='text'>
We're more restrictive than we need to be in matching ".GIT"
on case-sensitive filesystems; let's make a note that this
is intentional.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
</content>
</entry>
<entry>
<title>verify_path: drop clever fallthrough</title>
<updated>2018-05-22T03:50:11Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-05-13T17:00:23Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=e19e5e66d691bdeeeb5e0ed2ffcecdd7666b0d7b'/>
<id>urn:sha1:e19e5e66d691bdeeeb5e0ed2ffcecdd7666b0d7b</id>
<content type='text'>
We check ".git" and ".." in the same switch statement, and
fall through the cases to share the end-of-component check.
While this saves us a line or two, it makes modifying the
function much harder. Let's just write it out.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
</content>
</entry>
<entry>
<title>skip_prefix: add case-insensitive variant</title>
<updated>2018-05-22T03:50:11Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-05-13T16:57:14Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=41a80924aec0e94309786837b6f954a3b3f19b71'/>
<id>urn:sha1:41a80924aec0e94309786837b6f954a3b3f19b71</id>
<content type='text'>
We have the convenient skip_prefix() helper, but if you want
to do case-insensitive matching, you're stuck doing it by
hand. We could add an extra parameter to the function to
let callers ask for this, but the function is small and
somewhat performance-critical. Let's just re-implement it
for the case-insensitive version.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
</content>
</entry>
<entry>
<title>is_{hfs,ntfs}_dotgitmodules: add tests</title>
<updated>2018-05-22T03:50:11Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2018-05-12T20:16:51Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=dc2d9ba3187fcd0ca8eeab9aa9ddef70cf8627a6'/>
<id>urn:sha1:dc2d9ba3187fcd0ca8eeab9aa9ddef70cf8627a6</id>
<content type='text'>
This tests primarily for NTFS issues, but also adds one example of an
HFS+ issue.

Thanks go to Congyi Wu for coming up with the list of examples where
NTFS would possibly equate the filename with `.gitmodules`.

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Jeff King &lt;peff@peff.net&gt;
</content>
</entry>
<entry>
<title>is_ntfs_dotgit: match other .git files</title>
<updated>2018-05-22T03:50:11Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2018-05-11T14:03:54Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=e7cb0b4455c85b53aeba40f88ffddcf6d4002498'/>
<id>urn:sha1:e7cb0b4455c85b53aeba40f88ffddcf6d4002498</id>
<content type='text'>
When we started to catch NTFS short names that clash with .git, we only
looked for GIT~1. This is sufficient because we only ever clone into an
empty directory, so .git is guaranteed to be the first subdirectory or
file in that directory.

However, even with a fresh clone, .gitmodules is *not* necessarily the
first file to be written that would want the NTFS short name GITMOD~1: a
malicious repository can add .gitmodul0000 and friends, which sorts
before `.gitmodules` and is therefore checked out *first*. For that
reason, we have to test not only for ~1 short names, but for others,
too.

It's hard to just adapt the existing checks in is_ntfs_dotgit(): since
Windows 2000 (i.e., in all Windows versions still supported by Git),
NTFS short names are only generated in the &lt;prefix&gt;~&lt;number&gt; form up to
number 4. After that, a *different* prefix is used, calculated from the
long file name using an undocumented, but stable algorithm.

For example, the short name of .gitmodules would be GITMOD~1, but if it
is taken, and all of ~2, ~3 and ~4 are taken, too, the short name
GI7EBA~1 will be used. From there, collisions are handled by
incrementing the number, shortening the prefix as needed (until ~9999999
is reached, in which case NTFS will not allow the file to be created).

We'd also want to handle .gitignore and .gitattributes, which suffer
from a similar problem, using the fall-back short names GI250A~1 and
GI7D29~1, respectively.

To accommodate for that, we could reimplement the hashing algorithm, but
it is just safer and simpler to provide the known prefixes. This
algorithm has been reverse-engineered and described at
https://usn.pw/blog/gen/2015/06/09/filenames/, which is defunct but
still available via https://web.archive.org/.

These can be recomputed by running the following Perl script:

-- snip --
use warnings;
use strict;

sub compute_short_name_hash ($) {
        my $checksum = 0;
        foreach (split('', $_[0])) {
                $checksum = ($checksum * 0x25 + ord($_)) &amp; 0xffff;
        }

        $checksum = ($checksum * 314159269) &amp; 0xffffffff;
        $checksum = 1 + (~$checksum &amp; 0x7fffffff) if ($checksum &amp; 0x80000000);
        $checksum -= (($checksum * 1152921497) &gt;&gt; 60) * 1000000007;

        return scalar reverse sprintf("%x", $checksum &amp; 0xffff);
}

print compute_short_name_hash($ARGV[0]);
-- snap --

E.g., running that with the argument ".gitignore" will
result in "250a" (which then becomes "gi250a" in the code).

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Jeff King &lt;peff@peff.net&gt;
</content>
</entry>
<entry>
<title>is_hfs_dotgit: match other .git files</title>
<updated>2018-05-22T03:50:11Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-05-02T19:23:45Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=0fc333ba20b43a8afee5023e92cb3384ff4e59a6'/>
<id>urn:sha1:0fc333ba20b43a8afee5023e92cb3384ff4e59a6</id>
<content type='text'>
Both verify_path() and fsck match ".git", ".GIT", and other
variants specific to HFS+. Let's allow matching other
special files like ".gitmodules", which we'll later use to
enforce extra restrictions via verify_path() and fsck.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
</content>
</entry>
</feed>
