pbzip2: Improved error reporting

Bug #874605 reported by Jeff Gilchrist
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pbzip2
Fix Released
Wishlist
Yavor Nikolov

Bug Description

Reported by Assaf Gordon gordon [at] cshl {dot} edu

Hello Jeff,

My name is Gordon, I just recently discovered pbzip2, and using it extensively.
It's working great, thank you for writing it and making it free software.

One improvement I'd like to offer, is to add slightly more informative error messages.
Currently, if 'pbzip2' fails because of I/O related errors, it shows a generic error message, and sometimes the value returned from the system call (which is always -1 for failures).

In our production system, it's useful to know of pbzip2 failed because of a real I/O error (e.g. stale NFS), or because the disk is full, etc.

The attach patch (against v1.1.5) adds the "errno" variable and a textual string of the last error that happened.
Would you be willing to consider it for inclusion?

The changes are:
1. in "safe_open_output", "safe_fopen_output", "do_read" and "do_write", if the system call fails, it saves the errno value and gets the textual string for that error (by calling "save_last_io_error").

2. When reporting an error with "handle_error" or just "printf", the value of the last errno and the error string are printed to the string.

The isn't the cleanest patch ever, more like a proof-of-concept.
It uses three new global variables (to save the value of the offending errno),
and implicitly assumes that "do_read/do_write" are never called from the child-threads (is that assumption correct?).

Here's a slightly improved patch, also catches the two "open" calls, and instead of a generic "file not found", it gives a better description (e.g. "permission denied" or "No such file").

Revision history for this message
Jeff Gilchrist (jeff-gilchrist) wrote :
Changed in pbzip2:
status: New → Incomplete
status: Incomplete → Confirmed
assignee: nobody → Yavor Nikolov (yavor-nikolov)
importance: Undecided → Wishlist
Changed in pbzip2:
milestone: none → 1.1.6
status: Confirmed → In Progress
Changed in pbzip2:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.