<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/lockfile.c, branch v2.1.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.1.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.1.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2014-07-21T18:18:37Z</updated>
<entry>
<title>Merge branch 'rs/ref-transaction-0'</title>
<updated>2014-07-21T18:18:37Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-07-21T18:18:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=19a249ba83abb72faf530a214ea867feb51ade91'/>
<id>urn:sha1:19a249ba83abb72faf530a214ea867feb51ade91</id>
<content type='text'>
Early part of the "ref transaction" topic.

* rs/ref-transaction-0:
  refs.c: change ref_transaction_update() to do error checking and return status
  refs.c: remove the onerr argument to ref_transaction_commit
  update-ref: use err argument to get error from ref_transaction_commit
  refs.c: make update_ref_write update a strbuf on failure
  refs.c: make ref_update_reject_duplicates take a strbuf argument for errors
  refs.c: log_ref_write should try to return meaningful errno
  refs.c: make resolve_ref_unsafe set errno to something meaningful on error
  refs.c: commit_packed_refs to return a meaningful errno on failure
  refs.c: make remove_empty_directories always set errno to something sane
  refs.c: verify_lock should set errno to something meaningful
  refs.c: make sure log_ref_setup returns a meaningful errno
  refs.c: add an err argument to repack_without_refs
  lockfile.c: make lock_file return a meaningful errno on failurei
  lockfile.c: add a new public function unable_to_lock_message
  refs.c: add a strbuf argument to ref_transaction_commit for error logging
  refs.c: allow passing NULL to ref_transaction_free
  refs.c: constify the sha arguments for ref_transaction_create|delete|update
  refs.c: ref_transaction_commit should not free the transaction
  refs.c: remove ref_transaction_rollback
</content>
</entry>
<entry>
<title>lockfile.c: make lock_file return a meaningful errno on failurei</title>
<updated>2014-07-14T18:54:41Z</updated>
<author>
<name>Ronnie Sahlberg</name>
<email>sahlberg@google.com</email>
</author>
<published>2014-06-20T14:42:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=447ff1bf0acf9a1d7d2dc3aed032c209f105fb8a'/>
<id>urn:sha1:447ff1bf0acf9a1d7d2dc3aed032c209f105fb8a</id>
<content type='text'>
Making errno when returning from lock_file() meaningful, which should
fix

 * an existing almost-bug in lock_ref_sha1_basic where it assumes
   errno==ENOENT is meaningful and could waste some work on retries

 * an existing bug in repack_without_refs where it prints
   strerror(errno) and picks advice based on errno, despite errno
   potentially being zero and potentially having been clobbered by
   that point

Signed-off-by: Ronnie Sahlberg &lt;sahlberg@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Acked-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
</content>
</entry>
<entry>
<title>lockfile.c: add a new public function unable_to_lock_message</title>
<updated>2014-07-14T18:54:40Z</updated>
<author>
<name>Ronnie Sahlberg</name>
<email>sahlberg@google.com</email>
</author>
<published>2014-06-20T14:42:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6af926e8bcab15b42faeee9f2fe1c69b5fea1b15'/>
<id>urn:sha1:6af926e8bcab15b42faeee9f2fe1c69b5fea1b15</id>
<content type='text'>
Introducing a new unable_to_lock_message helper, which has nicer
semantics than unable_to_lock_error and cleans up lockfile.c a little.

Signed-off-by: Ronnie Sahlberg &lt;sahlberg@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Acked-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
</content>
</entry>
<entry>
<title>read-cache: relocate and unexport commit_locked_index()</title>
<updated>2014-06-13T18:49:38Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2014-06-13T12:19:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=626f35c89332059980251f7cdf8e94bc49d68834'/>
<id>urn:sha1:626f35c89332059980251f7cdf8e94bc49d68834</id>
<content type='text'>
This function is now only used by write_locked_index(). Move it to
read-cache.c (because read-cache.c will need to be aware of
alternate_index_output later) and unexport it.

Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>lockfile: fix buffer overflow in path handling</title>
<updated>2013-07-07T17:29:28Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2013-07-06T19:48:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2fbd4f92fa0d6d59d01cf1b9c800d428cd95143d'/>
<id>urn:sha1:2fbd4f92fa0d6d59d01cf1b9c800d428cd95143d</id>
<content type='text'>
The path of the file to be locked is held in lock_file::filename,
which is a fixed-length buffer of length PATH_MAX.  This buffer is
also (temporarily) used to hold the path of the lock file, which is
the path of the file being locked plus ".lock".  Because of this, the
path of the file being locked must be less than (PATH_MAX - 5)
characters long (5 chars are needed for ".lock" and one character for
the NUL terminator).

On entry into lock_file(), the path length was only verified to be
less than PATH_MAX characters, not less than (PATH_MAX - 5)
characters.

When and if resolve_symlink() is called, then that function is
correctly told to treat the buffer as (PATH_MAX - 5) characters long.
This part is correct.  However:

* If LOCK_NODEREF was specified, then resolve_symlink() is never
  called.

* If resolve_symlink() is called but the path is not a symlink, then
  the length check is never applied.

So it is possible for a path with length (PATH_MAX - 5 &lt;= len &lt;
PATH_MAX) to make it through the checks.  When ".lock" is strcat()ted
to such a path, the lock_file::filename buffer is overflowed.

Fix the problem by adding a check when entering lock_file() that the
original path is less than (PATH_MAX - 5) characters.

[jc: with independent development by Peff]

Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Name make_*_path functions more accurately</title>
<updated>2011-03-17T23:08:30Z</updated>
<author>
<name>Carlos Martín Nieto</name>
<email>cmn@elego.de</email>
</author>
<published>2011-03-17T11:26:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e2a57aac8a8a2b786739a5a93ea9dcfd2f0fd0e2'/>
<id>urn:sha1:e2a57aac8a8a2b786739a5a93ea9dcfd2f0fd0e2</id>
<content type='text'>
Rename the make_*_path functions so it's clearer what they do, in
particlar make clear what the differnce between make_absolute_path and
make_nonrelative_path is by renaming them real_path and absolute_path
respectively. make_relative_path has an understandable name and is
renamed to relative_path to maintain the name convention.

The function calls have been replaced 1-to-1 in their usage.

Signed-off-by: Carlos Martín Nieto &lt;cmn@elego.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>lockfile: show absolute filename in unable_to_lock_message</title>
<updated>2010-01-12T23:48:24Z</updated>
<author>
<name>Matthieu Moy</name>
<email>Matthieu.Moy@imag.fr</email>
</author>
<published>2010-01-07T14:54:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a8c37a0e011d67e3192834a0fffe17452ea57a08'/>
<id>urn:sha1:a8c37a0e011d67e3192834a0fffe17452ea57a08</id>
<content type='text'>
When calling a git command from a subdirectory and a file locking fails,
the user will get a path relative to the root of the worktree, which is
invalid from the place where the command is ran. Make it easy for the
user to know which file it is.

Signed-off-by: Matthieu Moy &lt;Matthieu.Moy@imag.fr&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>git branch -D: give a better error message when lockfile creation fails</title>
<updated>2009-09-29T15:14:47Z</updated>
<author>
<name>Miklos Vajna</name>
<email>vmiklos@frugalware.org</email>
</author>
<published>2009-09-26T23:15:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1b018fd9be290fd6a70ce3093ab1dc1abce74e00'/>
<id>urn:sha1:1b018fd9be290fd6a70ce3093ab1dc1abce74e00</id>
<content type='text'>
Previously the old error message just told the user that it was not
possible to delete the ref from the packed-refs file. Give instructions
on how to resolve the problem.

Signed-off-by: Miklos Vajna &lt;vmiklos@frugalware.org&gt;
Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Shawn O. Pearce &lt;spearce@spearce.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ar/unlink-err'</title>
<updated>2009-05-18T16:01:06Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2009-05-18T16:01:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=36587681b4743c980e4e74a342dc5ec105314d08'/>
<id>urn:sha1:36587681b4743c980e4e74a342dc5ec105314d08</id>
<content type='text'>
* ar/unlink-err:
  print unlink(2) errno in copy_or_link_directory
  replace direct calls to unlink(2) with unlink_or_warn
  Introduce an unlink(2) wrapper which gives warning if unlink failed
</content>
</entry>
<entry>
<title>Fix a bunch of pointer declarations (codestyle)</title>
<updated>2009-05-01T22:17:31Z</updated>
<author>
<name>Felipe Contreras</name>
<email>felipe.contreras@gmail.com</email>
</author>
<published>2009-05-01T09:06:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4b25d091ba53c758fae0096b8c0662371857b9d9'/>
<id>urn:sha1:4b25d091ba53c758fae0096b8c0662371857b9d9</id>
<content type='text'>
Essentially; s/type* /type */ as per the coding guidelines.

Signed-off-by: Felipe Contreras &lt;felipe.contreras@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
