<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/lockfile.c, branch v2.5.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.5.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.5.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2015-06-24T19:21:47Z</updated>
<entry>
<title>Merge branch 'js/sleep-without-select'</title>
<updated>2015-06-24T19:21:47Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-06-24T19:21:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=510ab3f3c19566b43be02ec13c3326fa04a4a677'/>
<id>urn:sha1:510ab3f3c19566b43be02ec13c3326fa04a4a677</id>
<content type='text'>
Portability fix.

* js/sleep-without-select:
  lockfile: wait using sleep_millisec() instead of select()
  lockfile: convert retry timeout computations to millisecond
  help.c: wrap wait-only poll() invocation in sleep_millisec()
  lockfile: replace random() by rand()
</content>
</entry>
<entry>
<title>lockfile: wait using sleep_millisec() instead of select()</title>
<updated>2015-06-05T22:00:32Z</updated>
<author>
<name>Johannes Sixt</name>
<email>j6t@kdbg.org</email>
</author>
<published>2015-06-05T19:45:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=30f8160d26f11156a6792565fe694c813406b929'/>
<id>urn:sha1:30f8160d26f11156a6792565fe694c813406b929</id>
<content type='text'>
Use the new function sleep_millisec() to delay execution for a short
time. This avoids the invocation of select() with just a timeout, but
no file descriptors. Such a use of select() is quit with EINVAL on
Windows, leading to no delay at all.

Signed-off-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Reviewed-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>lockfile: convert retry timeout computations to millisecond</title>
<updated>2015-06-05T22:00:32Z</updated>
<author>
<name>Johannes Sixt</name>
<email>j6t@kdbg.org</email>
</author>
<published>2015-06-05T19:45:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a8a17756bbc9617ba22d0c78a73fce5bb2faa6f2'/>
<id>urn:sha1:a8a17756bbc9617ba22d0c78a73fce5bb2faa6f2</id>
<content type='text'>
When the goal is to wait for some random amount of time up to one
second, it is not necessary to compute with microsecond precision.
This is a preparation to re-use sleep_millisec().

Signed-off-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Reviewed-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>lockfile: replace random() by rand()</title>
<updated>2015-06-05T22:00:31Z</updated>
<author>
<name>Johannes Sixt</name>
<email>j6t@kdbg.org</email>
</author>
<published>2015-06-05T19:45:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1e9676ec0a771de06abca3009eb4bdc5a4ae3312'/>
<id>urn:sha1:1e9676ec0a771de06abca3009eb4bdc5a4ae3312</id>
<content type='text'>
On Windows, we do not have functions srandom() and random(). Use srand()
and rand(). These functions produce random numbers of lesser quality,
but for the purpose (a retry time-out) they are still good enough.

Signed-off-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Reviewed-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jc/ignore-epipe-in-filter'</title>
<updated>2015-05-22T19:41:57Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-05-22T19:41:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ddaf4e2e9a8b38185405205ddead638cf052728e'/>
<id>urn:sha1:ddaf4e2e9a8b38185405205ddead638cf052728e</id>
<content type='text'>
Filter scripts were run with SIGPIPE disabled on the Git side,
expecting that they may not read what Git feeds them to filter.
We however treated a filter that does not read its input fully
before exiting as an error.

This changes semantics, but arguably in a good way.  If a filter
can produce its output without consuming its input using whatever
magic, we now let it do so, instead of diagnosing it as a
programming error.

* jc/ignore-epipe-in-filter:
  filter_buffer_or_fd(): ignore EPIPE
  copy.c: make copy_fd() report its status silently
</content>
</entry>
<entry>
<title>copy.c: make copy_fd() report its status silently</title>
<updated>2015-05-19T21:48:54Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-05-19T17:55:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=00b7cbfcb36b6679c64ad0566c0fc251f7e979fe'/>
<id>urn:sha1:00b7cbfcb36b6679c64ad0566c0fc251f7e979fe</id>
<content type='text'>
When copy_fd() function encounters errors, it emits error messages
itself, which makes it impossible for callers to take responsibility
for reporting errors, especially when they want to ignore certain
errors.

Move the error reporting to its callers in preparation.

 - copy_file() and copy_file_with_time() by indirection get their
   own calls to error().

 - hold_lock_file_for_append(), when told to die on error, used to
   exit(128) relying on the error message from copy_fd(), but now it
   does its own die() instead.  Note that the callers that do not
   pass LOCK_DIE_ON_ERROR need to be adjusted for this change, but
   fortunately there is none ;-)

 - filter_buffer_or_fd() has its own error() already, in addition to
   the message from copy_fd(), so this will change the output but
   arguably in a better way.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>lockfile: allow file locking to be retried with a timeout</title>
<updated>2015-05-14T21:51:08Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2015-05-11T10:35:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=044b6a9efecf9941073b99ced4cb2881b18aee62'/>
<id>urn:sha1:044b6a9efecf9941073b99ced4cb2881b18aee62</id>
<content type='text'>
Currently, there is only one attempt to lock a file. If it fails, the
whole operation fails.

But it might sometimes be advantageous to try acquiring a file lock a
few times before giving up. So add a new function,
hold_lock_file_for_update_timeout(), that allows a timeout to be
specified. Make hold_lock_file_for_update() a thin wrapper around the
new function.

If timeout_ms is positive, then retry for at least that many
milliseconds to acquire the lock. On each failed attempt, use select()
to wait for a backoff time that increases quadratically (capped at 1
second) and has a random component to prevent two processes from
getting synchronized. If timeout_ms is negative, retry indefinitely.

In a moment we will switch to using the new function when locking
packed-refs.

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>lockfile.c: store absolute path</title>
<updated>2014-11-03T19:00:28Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2014-11-02T06:24:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fa137f67a40bbcb3f583920586fdd34ce98ddeaf'/>
<id>urn:sha1:fa137f67a40bbcb3f583920586fdd34ce98ddeaf</id>
<content type='text'>
Locked paths can be saved in a linked list so that if something wrong
happens, *.lock are removed. For relative paths, this works fine if we
keep cwd the same, which is true 99% of time except:

- update-index and read-tree hold the lock on $GIT_DIR/index really
  early, then later on may call setup_work_tree() to move cwd.

- Suppose a lock is being held (e.g. by "git add") then somewhere
  down the line, somebody calls real_path (e.g. "link_alt_odb_entry"),
  which temporarily moves cwd away and back.

During that time when cwd is moved (either permanently or temporarily)
and we decide to die(), attempts to remove relative *.lock will fail,
and the next operation will complain that some files are still locked.

Avoid this case by turning relative paths to absolute before storing
the path in "filename" field.

Reported-by: Yue Lin Ho &lt;yuelinho777@gmail.com&gt;
Helped-by: Ramsay Jones &lt;ramsay@ramsay1.demon.co.uk&gt;
Helped-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Adapted-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
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>lockfile: remove unable_to_lock_error</title>
<updated>2014-10-15T17:47:27Z</updated>
<author>
<name>Jonathan Nieder</name>
<email>jrnieder@gmail.com</email>
</author>
<published>2014-08-28T23:41:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fb43bd1cd187bcd29312df3b0394a457d524906d'/>
<id>urn:sha1:fb43bd1cd187bcd29312df3b0394a457d524906d</id>
<content type='text'>
The former caller uses unable_to_lock_message now.

Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Reviewed-by: Ronnie Sahlberg &lt;sahlberg@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'mh/lockfile-stdio'</title>
<updated>2014-10-14T17:49:52Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-10-14T17:49:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=11cb3130d551590ae2dbd582e809763bfc353a47'/>
<id>urn:sha1:11cb3130d551590ae2dbd582e809763bfc353a47</id>
<content type='text'>
* mh/lockfile-stdio:
  commit_packed_refs(): reimplement using fdopen_lock_file()
  dump_marks(): reimplement using fdopen_lock_file()
  fdopen_lock_file(): access a lockfile using stdio
</content>
</entry>
</feed>
