{"thread":{"id":"20812","subject":"[PATCH] Make git status print a helpful death message if the disk is full","startedAt":"2009-09-01T19:51:48Z","lastAt":"2009-09-01T20:35:05Z","messageCount":3,"participants":["David Reiss","Junio C Hamano","Thomas Rast"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"122255","messageId":"4A9D7B54.5020902@facebook.com","threadId":"20812","inReplyTo":null,"subject":"[PATCH] Make git status print a helpful death message if the disk is full","fromName":"David Reiss","fromEmail":"dreiss@facebook.com","sentAt":"2009-09-01T19:51:48Z","receivedAt":"2009-09-01T19:51:48Z","isPatch":true,"sender":{"key":"dreiss@facebook.com","avatar":null},"body":"The old behavior just said that it failed.  Now it includes the error\ninformation, which makes it much easier to debug.\n\nThere is a risk that some failure paths could result in misleading error\nmessages that actually make debugging more difficult.\n\nSigned-off-by: David Reiss <dreiss@facebook.com>\n---\n builtin-commit.c |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin-commit.c b/builtin-commit.c\nindex 4bcce06..3527c73 100644\n--- a/builtin-commit.c\n+++ b/builtin-commit.c\n@@ -256,7 +256,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix)\n \t\trefresh_cache(REFRESH_QUIET);\n \t\tif (write_cache(fd, active_cache, active_nr) ||\n \t\t    close_lock_file(&index_lock))\n-\t\t\tdie(\"unable to write new_index file\");\n+\t\t\tdie(\"unable to write new_index file: %s\", strerror(errno));\n \t\tcommit_style = COMMIT_NORMAL;\n \t\treturn index_lock.filename;\n \t}\n@@ -275,7 +275,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix)\n \t\trefresh_cache(REFRESH_QUIET);\n \t\tif (write_cache(fd, active_cache, active_nr) ||\n \t\t    commit_locked_index(&index_lock))\n-\t\t\tdie(\"unable to write new_index file\");\n+\t\t\tdie(\"unable to write new_index file: %s\", strerror(errno));\n \t\tcommit_style = COMMIT_AS_IS;\n \t\treturn get_index_file();\n \t}\n@@ -318,7 +318,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix)\n \trefresh_cache(REFRESH_QUIET);\n \tif (write_cache(fd, active_cache, active_nr) ||\n \t    close_lock_file(&index_lock))\n-\t\tdie(\"unable to write new_index file\");\n+\t\tdie(\"unable to write new_index file: %s\", strerror(errno));\n \n \tfd = hold_lock_file_for_update(&false_lock,\n \t\t\t\t       git_path(\"next-index-%\"PRIuMAX,\n-- \n1.6.0.4\n"},{"id":"122257","messageId":"7v3a76fmdu.fsf@alter.siamese.dyndns.org","threadId":"20812","inReplyTo":"4A9D7B54.5020902@facebook.com","subject":"Re: [PATCH] Make git status print a helpful death message if the disk is full","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-09-01T20:19:57Z","receivedAt":"2009-09-01T20:19:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Don't we have die_errno() or something since at least 1.6.4?\n"},{"id":"122259","messageId":"200909012235.10091.trast@student.ethz.ch","threadId":"20812","inReplyTo":"4A9D7B54.5020902@facebook.com","subject":"Re: [PATCH] Make git status print a helpful death message if the disk is full","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2009-09-01T20:35:05Z","receivedAt":"2009-09-01T20:35:05Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"David Reiss wrote:\n> The old behavior just said that it failed.  Now it includes the error\n> information, which makes it much easier to debug.\n> \n> There is a risk that some failure paths could result in misleading error\n> messages that actually make debugging more difficult.\n[...]\n>  \t\tif (write_cache(fd, active_cache, active_nr) ||\n>  \t\t    close_lock_file(&index_lock))\n> -\t\t\tdie(\"unable to write new_index file\");\n> +\t\t\tdie(\"unable to write new_index file: %s\", strerror(errno));\n\nJunio C Hamano wrote:\n> Don't we have die_errno() or something since at least 1.6.4?\n\nYes.  And during the conversion, I ignored call sites like this one\nprecisely because I did not (and still do not) have enough knowledge\nof the index and lock file machinery to decide at what stage I need to\nread errno to get the *real* error message.  You're of course welcome\nto dig into the code to verify that the above is correct, but I am\nagainst blindly hoping that it gives the right error.\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"}]}