git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Make git status print a helpful death message if the disk is full
@ 2009-09-01 19:51 David Reiss
  2009-09-01 20:19 ` Junio C Hamano
  2009-09-01 20:35 ` Thomas Rast
  0 siblings, 2 replies; 3+ messages in thread
From: David Reiss @ 2009-09-01 19:51 UTC (permalink / raw)
  To: git

The old behavior just said that it failed.  Now it includes the error
information, which makes it much easier to debug.

There is a risk that some failure paths could result in misleading error
messages that actually make debugging more difficult.

Signed-off-by: David Reiss <dreiss@facebook.com>
---
 builtin-commit.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/builtin-commit.c b/builtin-commit.c
index 4bcce06..3527c73 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -256,7 +256,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix)
 		refresh_cache(REFRESH_QUIET);
 		if (write_cache(fd, active_cache, active_nr) ||
 		    close_lock_file(&index_lock))
-			die("unable to write new_index file");
+			die("unable to write new_index file: %s", strerror(errno));
 		commit_style = COMMIT_NORMAL;
 		return index_lock.filename;
 	}
@@ -275,7 +275,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix)
 		refresh_cache(REFRESH_QUIET);
 		if (write_cache(fd, active_cache, active_nr) ||
 		    commit_locked_index(&index_lock))
-			die("unable to write new_index file");
+			die("unable to write new_index file: %s", strerror(errno));
 		commit_style = COMMIT_AS_IS;
 		return get_index_file();
 	}
@@ -318,7 +318,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix)
 	refresh_cache(REFRESH_QUIET);
 	if (write_cache(fd, active_cache, active_nr) ||
 	    close_lock_file(&index_lock))
-		die("unable to write new_index file");
+		die("unable to write new_index file: %s", strerror(errno));
 
 	fd = hold_lock_file_for_update(&false_lock,
 				       git_path("next-index-%"PRIuMAX,
-- 
1.6.0.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Make git status print a helpful death message if the disk is full
  2009-09-01 19:51 [PATCH] Make git status print a helpful death message if the disk is full David Reiss
@ 2009-09-01 20:19 ` Junio C Hamano
  2009-09-01 20:35 ` Thomas Rast
  1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2009-09-01 20:19 UTC (permalink / raw)
  To: David Reiss; +Cc: git

Don't we have die_errno() or something since at least 1.6.4?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Make git status print a helpful death message if the disk is full
  2009-09-01 19:51 [PATCH] Make git status print a helpful death message if the disk is full David Reiss
  2009-09-01 20:19 ` Junio C Hamano
@ 2009-09-01 20:35 ` Thomas Rast
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Rast @ 2009-09-01 20:35 UTC (permalink / raw)
  To: David Reiss; +Cc: git, Junio C Hamano

[-- Attachment #1: Type: Text/Plain, Size: 1042 bytes --]

David Reiss wrote:
> The old behavior just said that it failed.  Now it includes the error
> information, which makes it much easier to debug.
> 
> There is a risk that some failure paths could result in misleading error
> messages that actually make debugging more difficult.
[...]
>  		if (write_cache(fd, active_cache, active_nr) ||
>  		    close_lock_file(&index_lock))
> -			die("unable to write new_index file");
> +			die("unable to write new_index file: %s", strerror(errno));

Junio C Hamano wrote:
> Don't we have die_errno() or something since at least 1.6.4?

Yes.  And during the conversion, I ignored call sites like this one
precisely because I did not (and still do not) have enough knowledge
of the index and lock file machinery to decide at what stage I need to
read errno to get the *real* error message.  You're of course welcome
to dig into the code to verify that the above is correct, but I am
against blindly hoping that it gives the right error.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-09-01 20:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-01 19:51 [PATCH] Make git status print a helpful death message if the disk is full David Reiss
2009-09-01 20:19 ` Junio C Hamano
2009-09-01 20:35 ` Thomas Rast

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).