close failures to stdout not detected
Bug #1300876 reported by
Richard Brittain
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pbzip2 |
Fix Released
|
Undecided
|
Yavor Nikolov |
Bug Description
Using -c option, with stdout directed to a file on an AFS fileserver, write failures (typically due to quota-full errors) are not detected.
With AFS, some failures are not detected until close(), since writes go into a local cache. A quick perusal of the source suggests pbzip2 doesn't close() stdout.
Related branches
lp:~yavor-nikolov/pbzip2/bug-1300876-explicit-close-of-stdout
- Yavor Nikolov: Approve
-
Diff: 45 lines (+16/-2)2 files modifiedChangeLog (+3/-1)
pbzip2.cpp (+13/-1)
Changed in pbzip2: | |
status: | New → In Progress |
assignee: | nobody → Yavor Nikolov (yavor-nikolov) |
Changed in pbzip2: | |
status: | In Progress → Fix Committed |
milestone: | none → 1.1.9 |
Changed in pbzip2: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
This may affect NFS as well as AFS.
Suggested patch:
--- pbzip2.cpp 2014-04-10 03:01:54.000000001 +0000 ------- ------- ------- ------- ------- --\n");
+++ pbzip2.cpp-new 2014-04-10 02:50:09.000000001 +0000
@@ -4706,6 +4706,18 @@
fprintf(stderr, "------
} /* for */
+ // Explicit close on stdout if we've been writing there, after all input has been processed FILENO) ; :getInstance( )->saveError( ); error(EF_ EXIT, 1, "pbzip2: *ERROR: Failed to close output file! Aborting...\n");
+ if (OutputStdOut == 1)
+ {
+ ret = close(STDOUT_
+ if (ret == -1)
+ {
+ ErrorContext:
+ handle_
+ exit(1);
+ }
+ }
+