<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/wrapper.c, branch v2.7.3</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.7.3</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.7.3'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2016-02-22T22:50:32Z</updated>
<entry>
<title>harden REALLOC_ARRAY and xcalloc against size_t overflow</title>
<updated>2016-02-22T22:50:32Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-02-22T22:43:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e7792a74bcf7fcd554b4546fc91122b8c2af7d75'/>
<id>urn:sha1:e7792a74bcf7fcd554b4546fc91122b8c2af7d75</id>
<content type='text'>
REALLOC_ARRAY inherently involves a multiplication which can
overflow size_t, resulting in a much smaller buffer than we
think we've allocated. We can easily harden it by using
st_mult() to check for overflow.  Likewise, we can add
ALLOC_ARRAY to do the same thing for xmalloc calls.

xcalloc() should already be fine, because it takes the two
factors separately, assuming the system calloc actually
checks for overflow. However, before we even hit the system
calloc(), we do our memory_limit_check, which involves a
multiplication. Let's check for overflow ourselves so that
this limit cannot be bypassed.

Signed-off-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 'js/fopen-harder' into maint</title>
<updated>2016-02-05T22:54:11Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-02-05T22:54:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=da07df3ee3ff8c9d676db6be04a76ead1d9919d8'/>
<id>urn:sha1:da07df3ee3ff8c9d676db6be04a76ead1d9919d8</id>
<content type='text'>
Some codepaths used fopen(3) when opening a fixed path in $GIT_DIR
(e.g. COMMIT_EDITMSG) that is meant to be left after the command is
done.  This however did not work well if the repository is set to
be shared with core.sharedRepository and the umask of the previous
user is tighter.  They have been made to work better by calling
unlink(2) and retrying after fopen(3) fails with EPERM.

* js/fopen-harder:
  Handle more file writes correctly in shared repos
  commit: allow editing the commit message even in shared repos
</content>
</entry>
<entry>
<title>commit: allow editing the commit message even in shared repos</title>
<updated>2016-01-07T21:52:55Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2016-01-06T13:09:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=79d7582e32ca84eacf032298c8ae3d26816f48d0'/>
<id>urn:sha1:79d7582e32ca84eacf032298c8ae3d26816f48d0</id>
<content type='text'>
It was pointed out by Yaroslav Halchenko that the file containing the
commit message is writable only by the owner, which means that we have
to rewrite it from scratch in a shared repository.

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/ident-loosen-getpwuid'</title>
<updated>2015-12-21T18:59:07Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-12-21T18:59:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5498c57cdd637eb4f42ce8e296ce9ca4ab66e289'/>
<id>urn:sha1:5498c57cdd637eb4f42ce8e296ce9ca4ab66e289</id>
<content type='text'>
When getpwuid() on the system returned NULL (e.g. the user is not
in the /etc/passwd file or other uid-to-name mappings), the
codepath to find who the user is to record it in the reflog barfed
and died.  Loosen the check in this codepath, which already accepts
questionable ident string (e.g. host part of the e-mail address is
obviously bogus), and in general when we operate fmt_ident() function
in non-strict mode.

* jk/ident-loosen-getpwuid:
  ident: loosen getpwuid error in non-strict mode
  ident: keep a flag for bogus default_email
  ident: make xgetpwuid_self() a static local helper
</content>
</entry>
<entry>
<title>ident: make xgetpwuid_self() a static local helper</title>
<updated>2015-12-10T23:38:59Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-12-10T21:33:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e850194c83985396435b01b70d2db00b6d3af02e'/>
<id>urn:sha1:e850194c83985396435b01b70d2db00b6d3af02e</id>
<content type='text'>
This function is defined in wrapper.c, but nobody besides
ident.c uses it. And nobody is likely to in the future,
either, as anything that cares about the user's name should
be going through the ident code.

Moving it here is a cleanup of the global namespace, but it
will also enable further cleanups inside ident.c.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>add xsnprintf helper function</title>
<updated>2015-09-25T17:18:18Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-09-24T21:05:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7b03c89ebd10396ac7569f0c8c4fa0b4efd4f7ed'/>
<id>urn:sha1:7b03c89ebd10396ac7569f0c8c4fa0b4efd4f7ed</id>
<content type='text'>
There are a number of places in the code where we call
sprintf(), with the assumption that the output will fit into
the buffer. In many cases this is true (e.g., formatting a
number into a large buffer), but it is hard to tell
immediately from looking at the code. It would be nice if we
had some run-time check to make sure that our assumption is
correct (and to communicate to readers of the code that we
are not blindly calling sprintf, but have actually thought
about this case).

This patch introduces xsnprintf, which behaves just like
snprintf, except that it dies whenever the output is
truncated. This acts as a sort of assert() for these cases,
which can help find places where the assumption is violated
(as opposed to truncating and proceeding, which may just
silently give a wrong answer).

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>write_file_v(): do not leave incomplete line at the end</title>
<updated>2015-08-25T19:48:39Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-08-24T16:39:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e7ffa38c6e726e8014b76297b06f78e008deb2d0'/>
<id>urn:sha1:e7ffa38c6e726e8014b76297b06f78e008deb2d0</id>
<content type='text'>
All existing callers to this function use it to produce a text file
or an empty file, and a new callsite that mimick them must end their
payload with a LF.  If they forget to do so, the resulting file will
end with an incomplete line.

Teach write_file_v() to complete the incomplete line, if exists, so
that the callers do not have to.

With this, the caller-side fix in builtin/am.c becomes unnecessary.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>write_file(): drop "fatal" parameter</title>
<updated>2015-08-24T20:09:02Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-08-24T20:03:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=12d6ce1dba504dfc5279b8d24da3edb4865c2820'/>
<id>urn:sha1:12d6ce1dba504dfc5279b8d24da3edb4865c2820</id>
<content type='text'>
All callers except three passed 1 for the "fatal" parameter to ask
this function to die upon error, but to a casual reader of the code,
it was not all obvious what that 1 meant.  Instead, split the
function into two based on a common write_file_v() that takes the
flag, introduce write_file_gently() as a new way to attempt creating
a file without dying on error, and make three callers to call it.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>wrapper: implement xfopen()</title>
<updated>2015-08-05T05:02:11Z</updated>
<author>
<name>Paul Tan</name>
<email>pyokagan@gmail.com</email>
</author>
<published>2015-08-04T13:51:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=260eec292736388831958637eccdcf1a8f00e14d'/>
<id>urn:sha1:260eec292736388831958637eccdcf1a8f00e14d</id>
<content type='text'>
A common usage pattern of fopen() is to check if it succeeded, and die()
if it failed:

	FILE *fp = fopen(path, "w");
	if (!fp)
		die_errno(_("could not open '%s' for writing"), path);

Implement a wrapper function xfopen() for the above, so that we can save
a few lines of code and make the die() messages consistent.

Helped-by: Jeff King &lt;peff@peff.net&gt;
Helped-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Helped-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: Paul Tan &lt;pyokagan@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>wrapper: implement xopen()</title>
<updated>2015-08-05T05:02:11Z</updated>
<author>
<name>Paul Tan</name>
<email>pyokagan@gmail.com</email>
</author>
<published>2015-08-04T13:51:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3ff53df7b4cbc331d302181d2d6644f4cb860a52'/>
<id>urn:sha1:3ff53df7b4cbc331d302181d2d6644f4cb860a52</id>
<content type='text'>
A common usage pattern of open() is to check if it was successful, and
die() if it was not:

	int fd = open(path, O_WRONLY | O_CREAT, 0777);
	if (fd &lt; 0)
		die_errno(_("Could not open '%s' for writing."), path);

Implement a wrapper function xopen() that does the above so that we can
save a few lines of code, and make the die() messages consistent.

Helped-by: Torsten Bögershausen &lt;tboegi@web.de&gt;
Helped-by: Jeff King &lt;peff@peff.net&gt;
Helped-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Helped-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: Paul Tan &lt;pyokagan@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
