Bug #34122 mysqldump gives unhelpful error message on out ENOSPC
Submitted: 29 Jan 2008 2:50 Modified: 22 Sep 2010 15:11
Reporter: Dustin Mitchell Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: Errors Severity:S4 (Feature request)
Version:5.0.44 OS:Any
Assigned to: CPU Architecture:Any

[29 Jan 2008 2:50] Dustin Mitchell
I use mysqldump for backups, and accidentally overflowed the available space.  The error message is "Got errno 28 on write", which isn't exactly helpful :) 

It would be great to have mysqldump use strerror() to translate that to a human-readable form to help folks debug things a little bit more easily.

How to repeat:
knuth teensy # mysqldump -h euclid -p bigdb > bigdb.sql
Enter password: 
mysqldump: Got errno 28 on write

Suggested fix:
use sterror()
[30 Jan 2008 14:30] Susanne Ebrecht
Many thanks for writing a bug report.

Look here:

$ perror 28
OS error code  28:  No space left on device

I think, this is what you are looking for. It's already implemented.
[30 Jan 2008 14:43] Dustin Mitchell
That's an odd answer -- of course *I* could figure this out, and did.  That's not the point -- the problem is that users who don't know how to look up error messages are left wondering, "what the heck's wrong?"  UN*X is cryptic enough by nature -- why make it worse?

Most apps do print error messages instead of numbers:

knuth teensy # echo test > foo
-bash: echo: write error: No space left on device
knuth teensy # cat </etc/metalog.conf >foo
cat: write error: No space left on device
knuth teensy # echo "hello" | sed -e s/l/r/ > foo
sed: couldn't flush stdout: No space left on device

I can provide a full patch if desired, but the fix is easy enough:
void check_io(FILE *file)
  if (ferror(file))
    die(EX_EOF, "Got error %s on write", strerror(errno));

If there are compatibility reasons that strerror might not be availble, then conditionally compile it as a function that just prints a number.
[30 Jan 2008 15:04] Susanne Ebrecht
Your are wrong.

It is documented, how to use our error message.

Your solution also has the problem of the language.

Don't forget, that we support error messages in more languages then only English.

And non English speakers have the same idea what happened if there is "28" or "no space left on device".
[31 Jan 2008 16:14] Sergei Golubchik
Susanne, strerror() returns strings in the current locale, that is localization is not a problem.
[22 Sep 2010 15:07] Michael Newton
This still seems like a valid request to me. Any reason this one-line change hasn't been implemented?
[22 Sep 2010 15:11] Dustin Mitchell
I suspect it's because Susanne dismissed the report out of hand, for what seem to me bogus reasons?
[19 May 2011 13:27] Michiel Beijen
That's great; I got this error message, thought: "that's a crappy and unhelpful error message, what would it mean?", used my google fu and landed right here, in the bug report discussing why it's not a good error message.

Would it help if I would submit a patch with a better error message?
[18 Apr 2012 17:20] Tony Slagle
I agree, numeric error messages are not helpful and while *I* did find this page and figure out what it meant, it would be much better to have the error written out; especially if the fix is as simple as it appears. My job security comes through continually sharing information; not keeping it to myself so I feel important.

If Susanne's goal is to groom her self illusioned foundation for arrogance through condescensiously labeling people who aren't db admins then that isn't a good reason to not implement this change. If a valid objection exists to it's implementation, let's hear it and find a workaround.