{"thread":{"id":"18132","subject":"[PATCH] Make the 'lock file exists' error more informative","startedAt":"2009-03-04T15:07:57Z","lastAt":"2009-03-04T17:55:12Z","messageCount":4,"participants":["John Tapsell","Matthieu Moy","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"106984","messageId":"1236179277-12477-1-git-send-email-johnflux@gmail.com","threadId":"18132","inReplyTo":null,"subject":"[PATCH] Make the 'lock file exists' error more informative","fromName":"John Tapsell","fromEmail":"johnflux@gmail.com","sentAt":"2009-03-04T15:07:57Z","receivedAt":"2009-03-04T15:07:57Z","isPatch":true,"sender":{"key":"johnflux@gmail.com","avatar":"https://gravatar.com/avatar/25f70d4c0f96396b84a2e34bcd9bdc233462c7b4be29b5fdca8266fc53f30b0c?d=mp&s=160"},"body":"It looks like someone did 90% of the work, then forgot to actually use\nthe function\n---\n lockfile.c |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/lockfile.c b/lockfile.c\nindex 1db1a2f..3dbb2d1 100644\n--- a/lockfile.c\n+++ b/lockfile.c\n@@ -158,7 +158,7 @@ static int lock_file(struct lock_file *lk, const char *path, int flags)\n \n NORETURN void unable_to_lock_index_die(const char *path, int err)\n {\n-\tif (errno == EEXIST) {\n+\tif (err == EEXIST) {\n \t\tdie(\"Unable to create '%s.lock': %s.\\n\\n\"\n \t\t    \"If no other git process is currently running, this probably means a\\n\"\n \t\t    \"git process crashed in this repository earlier. Make sure no other git\\n\"\n@@ -184,7 +184,7 @@ int hold_lock_file_for_append(struct lock_file *lk, const char *path, int flags)\n \tfd = lock_file(lk, path, flags);\n \tif (fd < 0) {\n \t\tif (flags & LOCK_DIE_ON_ERROR)\n-\t\t\tdie(\"unable to create '%s.lock': %s\", path, strerror(errno));\n+\t\t\tunable_to_lock_index_die(path, errno);\n \t\treturn fd;\n \t}\n \n-- \n1.6.2.rc2.23.g77740\n"},{"id":"106985","messageId":"43d8ce650903040718m6fc384ddv695c546276b7d3c3@mail.gmail.com","threadId":"18132","inReplyTo":"1236179277-12477-1-git-send-email-johnflux@gmail.com","subject":"Re: [PATCH] Make the 'lock file exists' error more informative","fromName":"John Tapsell","fromEmail":"johnflux@gmail.com","sentAt":"2009-03-04T15:18:06Z","receivedAt":"2009-03-04T15:18:06Z","isPatch":true,"sender":{"key":"johnflux@gmail.com","avatar":"https://gravatar.com/avatar/25f70d4c0f96396b84a2e34bcd9bdc233462c7b4be29b5fdca8266fc53f30b0c?d=mp&s=160"},"body":"2009/3/4 John Tapsell <johnflux@gmail.com>:\n> It looks like someone did 90% of the work, then forgot to actually use\n> the function\n\nIt seems that this was already fixed in the 'next' branch.  (Sorry, I\ndidn't know about this branch before).\n\nThe first bug fix is still required.  (well, for niceness.  In\npractise it isn't)\n\nJohn Tapsell\n\n> ---\n>  lockfile.c |    4 ++--\n>  1 files changed, 2 insertions(+), 2 deletions(-)\n>\n> diff --git a/lockfile.c b/lockfile.c\n> index 1db1a2f..3dbb2d1 100644\n> --- a/lockfile.c\n> +++ b/lockfile.c\n> @@ -158,7 +158,7 @@ static int lock_file(struct lock_file *lk, const char *path, int flags)\n>\n>  NORETURN void unable_to_lock_index_die(const char *path, int err)\n>  {\n> -       if (errno == EEXIST) {\n> +       if (err == EEXIST) {\n>                die(\"Unable to create '%s.lock': %s.\\n\\n\"\n>                    \"If no other git process is currently running, this probably means a\\n\"\n>                    \"git process crashed in this repository earlier. Make sure no other git\\n\"\n> @@ -184,7 +184,7 @@ int hold_lock_file_for_append(struct lock_file *lk, const char *path, int flags)\n>        fd = lock_file(lk, path, flags);\n>        if (fd < 0) {\n>                if (flags & LOCK_DIE_ON_ERROR)\n> -                       die(\"unable to create '%s.lock': %s\", path, strerror(errno));\n> +                       unable_to_lock_index_die(path, errno);\n>                return fd;\n>        }\n>\n> --\n> 1.6.2.rc2.23.g77740\n>\n>\n"},{"id":"106989","messageId":"vpqvdqpb7w6.fsf@bauges.imag.fr","threadId":"18132","inReplyTo":"1236179277-12477-1-git-send-email-johnflux@gmail.com","subject":"Re: [PATCH] Make the 'lock file exists' error more informative","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2009-03-04T15:54:49Z","receivedAt":"2009-03-04T15:54:49Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"John Tapsell <johnflux@gmail.com> writes:\n\n> It looks like someone did 90% of the work, then forgot to actually use\n> the function\n\nsomeone = me ;-).\n\nThe message is a bit inacurrate: the function is already used in two\nplaces, I just didn't notice this one.\n\n> -\tif (errno == EEXIST) {\n> +\tif (err == EEXIST) {\n\nOops, right.\n\n> -\t\t\tdie(\"unable to create '%s.lock': %s\", path, strerror(errno));\n> +\t\t\tunable_to_lock_index_die(path, errno);\n\nActually, _this_ instance is still to be fixed in next. You probably\nlooked at the other one that my original message fixes.\n\nIOW:\n\nAcked-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n\n-- \nMatthieu\n"},{"id":"106995","messageId":"7veixd5g1r.fsf@gitster.siamese.dyndns.org","threadId":"18132","inReplyTo":"vpqvdqpb7w6.fsf@bauges.imag.fr","subject":"Re: [PATCH] Make the 'lock file exists' error more informative","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-03-04T17:55:12Z","receivedAt":"2009-03-04T17:55:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@imag.fr> writes:\n\n> John Tapsell <johnflux@gmail.com> writes:\n>\n>> It looks like someone did 90% of the work, then forgot to actually use\n>> the function\n>\n> someone = me ;-).\n>\n> The message is a bit inacurrate: the function is already used in two\n> places, I just didn't notice this one.\n>\n>> -\tif (errno == EEXIST) {\n>> +\tif (err == EEXIST) {\n>\n> Oops, right.\n>\n>> -\t\t\tdie(\"unable to create '%s.lock': %s\", path, strerror(errno));\n>> +\t\t\tunable_to_lock_index_die(path, errno);\n>\n> Actually, _this_ instance is still to be fixed in next. You probably\n> looked at the other one that my original message fixes.\n\nNot in 'next', but in the maintenance track of v1.6.2.X and merged\nupwards, as v1.6.2~11^2~2 (More friendly message when locking the index\nfails., 2009-02-19) is obviously in v1.6.2 just released.\n\nJohn, congratulations for fixing the first bug immediately after a big\nrelease.  Please make it a habit to sign off your patches.\n"}]}