git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/3] lockfile: LOCK_REPORT_ON_ERROR

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 8, 2016, 18:22 UTC
Message-ID
<xmqqinquth69.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<alpine.DEB.2.20.1612081252490.23160@virtualbox>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> Sorry for the breakage.

Apologies from me, too. Once a topic is merged, the credit still remains with the contributor, but the blame is shared by the project as a whole, with those who missed breakages during their reviews, and those who didn't review or test and let breakages pass.

> When libifying the code, I tried to be careful to retain the error
> messages when not dying,...

Quite honestly, I do not think either of us cared about preserving the exact error message the end-user was getting from each failure sites that the series changed a call with die-on-error=1 to a call with die-on-error=0 that is followed by a negative return while reviewing this series. As I wrote in the proposed log message for 3/3, this one was noticed as a end-user breaking change because it was the only one that has become totally silent. For example, this bit from sequencer.c::write_message() we can see in the output from "git show --first-parent 2a4062a4a8" does not preserve the message at all:

    diff --git a/sequencer.c b/sequencer.c
    index 3804fa931d..eec8a60d6b 100644
    --- a/sequencer.c
    +++ b/sequencer.c
    @@ -180,17 +180,20 @@
    ...
    -static void write_message(struct strbuf *msgbuf, const char *filename)
    +static int write_message(struct strbuf *msgbuf, const char *filename)
     {
            static struct lock_file msg_file;
    -	int msg_fd = hold_lock_file_for_update(&msg_file, filename,
    -					       LOCK_DIE_ON_ERROR);
    +	int msg_fd = hold_lock_file_for_update(&msg_file, filename, 0);
    +	if (msg_fd < 0)
    +		return error_errno(_("Could not lock '%s'"), filename);

And I do not think it is necessarily bad that the error message changed with this conversion. In other words, I do not think it should have been the goal to preserve the exact error message. hold_lock*() can afford to give a detailed message that strongly sounds as being the final decision when called with die-on-error=1 because it knows it is dying. However, the message from the updated write_message(), "could not lock", cannot be final---the caller may want to add something else after it to describe what failed in a larger picture.

Previous: Robbie Iannucci
Message 19 of 19 in “[BUG] Index.lock error message regression in git 2.11.0”
  1. Robbie IannucciDec 3, 2016
  2. Robbie IannucciDec 3, 2016
  3. Junio C HamanoDec 6, 2016
  4. Re* [BUG] Index.lock error message regression in git 2.11.0Junio C Hamano, Dec 6, 2016
  5. Junio C HamanoDec 7, 2016
  6. 0/3 Do not be totally silent upon lock errorJunio C Hamano, Dec 7, 2016
  7. 1/3 wt-status: implement opportunisitc index update correctlyJunio C Hamano, Dec 7, 2016
  8. Stefan BellerDec 7, 2016
  9. Junio C HamanoDec 7, 2016
  10. Stefan BellerDec 7, 2016
  11. Junio C HamanoDec 7, 2016
  12. Stefan BellerDec 7, 2016
  13. Paul TanDec 8, 2016
  14. Junio C HamanoDec 8, 2016
  15. 2/3 hold_locked_index(): align error handling with hold_lockfile_for_update()Junio C Hamano, Dec 7, 2016
  16. 3/3 lockfile: LOCK_REPORT_ON_ERRORJunio C Hamano, Dec 7, 2016
  17. Johannes SchindelinDec 8, 2016
  18. Robbie IannucciDec 8, 2016
  19. Junio C HamanoDec 8, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.