<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/wrapper.c, branch v2.0.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.0.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.0.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2014-04-10T19:27:58Z</updated>
<entry>
<title>read-cache.c: verify index file before we opportunistically update it</title>
<updated>2014-04-10T19:27:58Z</updated>
<author>
<name>Yiannis Marangos</name>
<email>yiannis.marangos@gmail.com</email>
</author>
<published>2014-04-10T18:31:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=426ddeead6112955dfb50ccf9bb4af05d1ca9082'/>
<id>urn:sha1:426ddeead6112955dfb50ccf9bb4af05d1ca9082</id>
<content type='text'>
Before we proceed to opportunistically update the index (often done
by an otherwise read-only operation like "git status" and "git diff"
that internally refreshes the index), we must verify that the
current index file is the same as the one that we read earlier
before we took the lock on it, in order to avoid a possible race.

In the example below git-status does "opportunistic update" and
git-rebase updates the index, but the race can happen in general.

  1. process A calls git-rebase (or does anything that uses the index)

  2. process A applies 1st commit

  3. process B calls git-status (or does anything that updates the index)

  4. process B reads index

  5. process A applies 2nd commit

  6. process B takes the lock, then overwrites process A's changes.

  7. process A applies 3rd commit

As an end result the 3rd commit will have a revert of the 2nd commit.
When process B takes the lock, it needs to make sure that the index
hasn't changed since step 4.

Signed-off-by: Yiannis Marangos &lt;yiannis.marangos@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>wrapper.c: add xpread() similar to xread()</title>
<updated>2014-04-10T19:18:55Z</updated>
<author>
<name>Yiannis Marangos</name>
<email>yiannis.marangos@gmail.com</email>
</author>
<published>2014-04-10T18:54:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9aa91af0361e3c32fde5f8388dee963838308cd6'/>
<id>urn:sha1:9aa91af0361e3c32fde5f8388dee963838308cd6</id>
<content type='text'>
It is a common mistake to call read(2)/pread(2) and forget to
anticipate that they may return error with EAGAIN/EINTR when the
system call is interrupted.

We have xread() helper to relieve callers of read(2) from having to
worry about it; add xpread() helper to do the same for pread(2).

Update the caller in the builtin/index-pack.c and the mmap emulation
in compat/.

Signed-off-by: Yiannis Marangos &lt;yiannis.marangos@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>typofixes: fix misspelt comments</title>
<updated>2013-11-12T17:24:27Z</updated>
<author>
<name>Masanari Iida</name>
<email>standby24x7@gmail.com</email>
</author>
<published>2013-11-12T15:17:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=382d20e3ebc69ad20f54e71fc5f6ca17baa23973'/>
<id>urn:sha1:382d20e3ebc69ad20f54e71fc5f6ca17baa23973</id>
<content type='text'>
Signed-off-by: Masanari Iida &lt;standby24x7@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>wrapper.c: only define gitmkstemps if needed</title>
<updated>2013-10-14T23:16:00Z</updated>
<author>
<name>Ramsay Jones</name>
<email>ramsay@ramsay1.demon.co.uk</email>
</author>
<published>2013-10-06T20:50:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ec145c9c2ef0ddf0ca8b57b968054f4db9de63b3'/>
<id>urn:sha1:ec145c9c2ef0ddf0ca8b57b968054f4db9de63b3</id>
<content type='text'>
When the NO_MKSTEMPS build variable is not set, the gitmkstemps
function is dead code.  Use a preprocessor conditional to only include
the definition when needed.

Noticed by sparse.  ("'gitmkstemps' was not declared. Should it be
static?")

Signed-off-by: Ramsay Jones &lt;ramsay@ramsay1.demon.co.uk&gt;
Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
</content>
</entry>
<entry>
<title>xread, xwrite: limit size of IO to 8MB</title>
<updated>2013-08-20T18:10:59Z</updated>
<author>
<name>Steffen Prohaska</name>
<email>prohaska@zib.de</email>
</author>
<published>2013-08-20T06:43:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0b6806b9e45c659d25b87fb5713c920a3081eac8'/>
<id>urn:sha1:0b6806b9e45c659d25b87fb5713c920a3081eac8</id>
<content type='text'>
Checking out 2GB or more through an external filter (see test) fails
on Mac OS X 10.8.4 (12E55) for a 64-bit executable with:

    error: read from external filter cat failed
    error: cannot feed the input to external filter cat
    error: cat died of signal 13
    error: external filter cat failed 141
    error: external filter cat failed

The reason is that read() immediately returns with EINVAL when asked
to read more than 2GB.  According to POSIX [1], if the value of
nbyte passed to read() is greater than SSIZE_MAX, the result is
implementation-defined.  The write function has the same restriction
[2].  Since OS X still supports running 32-bit executables, the
32-bit limit (SSIZE_MAX = INT_MAX = 2GB - 1) seems to be also
imposed on 64-bit executables under certain conditions.  For write,
the problem has been addressed earlier [6c642a].

Address the problem for read() and write() differently, by limiting
size of IO chunks unconditionally on all platforms in xread() and
xwrite().  Large chunks only cause problems, like causing latencies
when killing the process, even if OS X was not buggy.  Doing IO in
reasonably sized smaller chunks should have no negative impact on
performance.

The compat wrapper clipped_write() introduced earlier [6c642a] is
not needed anymore.  It will be reverted in a separate commit.  The
new test catches read and write problems.

Note that 'git add' exits with 0 even if it prints filtering errors
to stderr.  The test, therefore, checks stderr.  'git add' should
probably be changed (sometime in another commit) to exit with
nonzero if filtering fails.  The test could then be changed to use
test_must_fail.

Thanks to the following people for suggestions and testing:

    Johannes Sixt &lt;j6t@kdbg.org&gt;
    John Keeping &lt;john@keeping.me.uk&gt;
    Jonathan Nieder &lt;jrnieder@gmail.com&gt;
    Kyle J. McKay &lt;mackyle@gmail.com&gt;
    Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
    Torsten Bögershausen &lt;tboegi@web.de&gt;

[1] http://pubs.opengroup.org/onlinepubs/009695399/functions/read.html
[2] http://pubs.opengroup.org/onlinepubs/009695399/functions/write.html

[6c642a] commit 6c642a878688adf46b226903858b53e2d31ac5c3
    compate/clipped-write.c: large write(2) fails on Mac OS X/XNU

Signed-off-by: Steffen Prohaska &lt;prohaska@zib.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'tr/fd-gotcha-fixes'</title>
<updated>2013-07-22T18:23:13Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-07-22T18:23:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1d1934caf1c927cb12cd76aa6ced9eab51a3d435'/>
<id>urn:sha1:1d1934caf1c927cb12cd76aa6ced9eab51a3d435</id>
<content type='text'>
Two places we did not check return value (expected to be a file
descriptor) correctly.

* tr/fd-gotcha-fixes:
  run-command: dup_devnull(): guard against syscalls failing
  git_mkstemps: correctly test return value of open()
</content>
</entry>
<entry>
<title>git_mkstemps: correctly test return value of open()</title>
<updated>2013-07-12T17:30:08Z</updated>
<author>
<name>Dale R. Worley</name>
<email>worley@alum.mit.edu</email>
</author>
<published>2013-07-12T08:58:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a2cb86c1524b7af20e609ca8d3db0b60b5c1d575'/>
<id>urn:sha1:a2cb86c1524b7af20e609ca8d3db0b60b5c1d575</id>
<content type='text'>
open() returns -1 on failure, and indeed 0 is a possible success value
if the user closed stdin in our process.  Fix the test.

Signed-off-by: Thomas Rast &lt;trast@inf.ethz.ch&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>config: allow inaccessible configuration under $HOME</title>
<updated>2013-04-15T14:26:50Z</updated>
<author>
<name>Jonathan Nieder</name>
<email>jrnieder@gmail.com</email>
</author>
<published>2013-04-12T21:03:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4698c8feb1bb56497215e0c10003dd046df352fa'/>
<id>urn:sha1:4698c8feb1bb56497215e0c10003dd046df352fa</id>
<content type='text'>
The changes v1.7.12.1~2^2~4 (config: warn on inaccessible files,
2012-08-21) and v1.8.1.1~22^2~2 (config: treat user and xdg config
permission problems as errors, 2012-10-13) were intended to prevent
important configuration (think "[transfer] fsckobjects") from being
ignored when the configuration is unintentionally unreadable (for
example with EIO on a flaky filesystem, or with ENOMEM due to a DoS
attack).  Usually ~/.gitconfig and ~/.config/git are readable by the
current user, and if they aren't then it would be easy to fix those
permissions, so the damage from adding this check should have been
minimal.

Unfortunately the access() check often trips when git is being run as
a server.  A daemon (such as inetd or git-daemon) starts as "root",
creates a listening socket, and then drops privileges, meaning that
when git commands are invoked they cannot access $HOME and die with

 fatal: unable to access '/root/.config/git/config': Permission denied

Any patch to fix this would have one of three problems:

  1. We annoy sysadmins who need to take an extra step to handle HOME
     when dropping privileges (the current behavior, or any other
     proposal that they have to opt into).

  2. We annoy sysadmins who want to set HOME when dropping privileges,
     either by making what they want to do impossible, or making them
     set an extra variable or option to accomplish what used to work
     (e.g., a patch to git-daemon to set HOME when --user is passed).

  3. We loosen the check, so some cases which might be noteworthy are
     not caught.

This patch is of type (3).

Treat user and xdg configuration that are inaccessible due to
permissions (EACCES) as though no user configuration was provided at
all.

An alternative method would be to check if $HOME is readable, but that
would not help in cases where the user who dropped privileges had a
globally readable HOME with only .config or .gitconfig being private.

This does not change the behavior when /etc/gitconfig or .git/config
is unreadable (since those are more serious configuration errors),
nor when ~/.gitconfig or ~/.config/git is unreadable due to problems
other than permissions.

Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Improved-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jn/warn-on-inaccessible-loosen' into maint</title>
<updated>2013-01-12T00:47:07Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-01-12T00:47:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e6f1550aa569fa5773977bc2c83729f29031b39e'/>
<id>urn:sha1:e6f1550aa569fa5773977bc2c83729f29031b39e</id>
<content type='text'>
When attempting to read the XDG-style $HOME/.config/git/config and
finding that $HOME/.config/git is a file, we gave a wrong error
message, instead of treating the case as "a custom config file does
not exist there" and moving on.

* jn/warn-on-inaccessible-loosen:
  config: exit on error accessing any config file
  doc: advertise GIT_CONFIG_NOSYSTEM
  config: treat user and xdg config permission problems as errors
  config, gitignore: failure to access with ENOTDIR is ok
</content>
</entry>
<entry>
<title>Merge branch 'jn/warn-on-inaccessible-loosen'</title>
<updated>2013-01-07T06:11:16Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-01-07T06:11:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4f43e9726af5d036af96de9e5208a6122d378f9b'/>
<id>urn:sha1:4f43e9726af5d036af96de9e5208a6122d378f9b</id>
<content type='text'>
Deal with a situation where .config/git is a file and we notice
.config/git/config is not readable due to ENOTDIR, not ENOENT.

* jn/warn-on-inaccessible-loosen:
  config: exit on error accessing any config file
  doc: advertise GIT_CONFIG_NOSYSTEM
  config: treat user and xdg config permission problems as errors
  config, gitignore: failure to access with ENOTDIR is ok
</content>
</entry>
</feed>
