Commit Graph
1071 Commits
Author SHA1 Message Date
Andrew Wood 663a54bda0 Merge the changes for #188 and #191 which add an intermediate pipe on the input side to allow splice() to be used for all transfers. 2026-05-03 17:59:13 +01:00
Andrew Wood ae60fc0688 Move output_fd into HAVE_SPLICE. 2026-05-03 17:06:47 +01:00
Andrew Wood 11d727a88d In discard mode, if splice() is available, open a file descriptor to /dev/null and splice the input to that, to improve performance (#191). 2026-05-03 14:53:45 +01:00
Andrew Wood b75ecd79d5 Add comments explaining the steps (#188). 2026-05-03 13:42:27 +01:00
Andrew Wood 5fb7e49848 Start the intermediary pipe buffer size at 1MiB (#188). 2026-05-03 13:41:52 +01:00
Andrew Wood 21c8237a73 When splice() is available but neither the input nor the output are pipes, splice the input through an intermediary pipe (#188). 2026-05-03 01:12:33 +01:00
Andrew Wood b300046eb1 Acknowledgements update. 2026-05-02 17:12:21 +01:00
Andrew Wood 17cbab3045 Add an option "-J" / "--pipe-buffer-size" to set the size of the output pipe buffer when the output is a pipe, and when that option is not specified, automatically increase the output pipe buffer size to match that of the input, when the first input is also a pipe (#188). 2026-05-02 16:42:35 +01:00
Andrew Wood d421024fb8 Run through "make indent" for consistency, update message line numbers. 2026-05-01 19:47:10 +01:00
Andrew Wood 7a6ce0f0b6 Message line number updates. 2026-05-01 19:10:30 +01:00
Andrew Wood b1bf99c09b Datestamp update. 2026-05-01 19:10:04 +01:00
Andrew Wood 096b655bb8 Remove the note about getting stuck when writing to an exited reader, as it was fixed in #189. 2026-05-01 19:09:20 +01:00
Andrew Wood 7a276040ad Note the fix for the endless wait on EOF issue (#189). 2026-05-01 19:07:44 +01:00
Andrew Wood 89d2a7840f Acknowledge the contributor of the fix for endlessly waiting for an exited receiver to empty the pipe buffer (#189, #190). 2026-05-01 19:07:07 +01:00
Andrew Wood fb2b325e94 Merge pull request 'fix: avoid EOF hang on unread pipe output (#189)' (#190) from whoschek/pv:wip/eof_hang into main
Reviewed-on: https://codeberg.org/ivarch/pv/pulls/190
Reviewed-by: Andrew Wood <a-j-wood@noreply.codeberg.org>
2026-05-01 19:42:43 +02:00
Wolfgang Hoschek e7d188ac65 fix: avoid EOF hang on unread pipe output (#189)
At EOF, pv waits for bytes already written to an output pipe to be consumed before finishing. If the downstream reader exits without reading those bytes, the pipe can keep reporting unread data forever. Since pv has no more input, there is no later write that would fail with EPIPE and break the wait.

Detect this EOF drain-wait case with a non-blocking poll() on the output pipe. When the pipe reports that its readers are gone, mark the pipe closed and stop waiting for bytes that can no longer be consumed. While a reader is still present, keep the existing behaviour and continue waiting for the pipe buffer to drain.

Add regression coverage for both ways pv can reach this state: direct input that leaves unread output bytes behind, and a pipeline where the original producer fails but an intermediate filter such as gzip still emits a valid empty stream. The latter matters because pv can still have pending output at EOF even when the command at the start of the pipeline failed immediately.

Signed-off-by: Wolfgang Hoschek <wolfgang.hoschek@mac.com>
2026-04-30 04:47:09 -04:00
Andrew Wood 79a6420fea Replace the fixed-sized buffer file_fdpath with a dynamically allocated equivalent. 2026-04-29 21:43:46 +01:00
Andrew Wood c54c3258a6 Acknowledge the reporter (#187). 2026-04-29 20:10:02 +01:00
Andrew Wood 0c28d017de Note the signal interrupt message feature (#187). 2026-04-29 19:54:27 +01:00
Andrew Wood 0a69501594 Add the new signal interrupt message (#187). 2026-04-29 19:53:43 +01:00
Andrew Wood a3f0caeab4 Record the received number before setting the exit trigger, so it will definitely be available for reporting (#187). 2026-04-28 22:55:16 +01:00
Andrew Wood 478039f539 Report which signal triggered the exit (#187). 2026-04-28 22:53:23 +01:00
Andrew Wood 2a25221eaf Suppress the error message about a signal interrupt in cursor mode in all but the first instance in a pipeline (#187). 2026-04-27 21:27:20 +01:00
Andrew Wood c763f1fcaa Write an error message if interrupted by a signal such as SIGINT (#187). 2026-04-26 21:45:36 +01:00
Andrew Wood 8b4fa8ade7 Clear the terminal flag ECHOCTL before starting, and set it again at the end, similar to how TOSTOP is dealt with (#187). 2026-04-26 20:01:22 +01:00
Andrew Wood 57f0b91d16 Adjust the watchfd changes for Apple builds. 2026-04-25 23:05:17 +01:00
Andrew Wood a66a1cc10c Message line number updates. 2026-04-25 22:06:18 +01:00
Andrew Wood 2a31b73a32 Replace the fixed-sized buffers file_fdinfo and file_fdsymlink with dynamically allocated equivalents. 2026-04-25 22:04:38 +01:00
Andrew Wood ee96f3f43b Specify which watched PID had the problem. 2026-04-25 21:04:41 +01:00
Andrew Wood 2b1d359281 Use pv_asprintf() to allocate fd_dir instead of having it statically sized. 2026-04-25 21:03:09 +01:00
Andrew Wood 4854d71aa9 Adjustment from "make indent". 2026-04-25 21:01:56 +01:00
Andrew Wood 18b1926d61 Replace the fixed-size "cwd" buffer with a dynamically allocated one. 2026-04-24 23:00:45 +01:00
Andrew Wood 43a54bd541 Rename the pvwatchfd "file_fd" item to "file_fdsymlink" to to better distinguish it from the other structure members. 2026-04-23 21:42:10 +01:00
Andrew Wood bf371e9a8c Tidy up comments. 2026-04-22 22:21:36 +01:00
Andrew Wood 239a20d13f Tidy up comments. 2026-04-21 23:45:56 +01:00
Andrew Wood a220e993af Adjust the wording as pv does not "know" things. 2026-04-21 22:18:13 +01:00
Andrew Wood a955038360 Document the behaviour exhibited when pv writes to a pipe and the reader exits with unread data in the pipe buffer. 2026-04-21 22:13:44 +01:00
Andrew Wood c0e530eefd Use awk instead of the non-portable "~" sed command. 2026-04-20 22:55:24 +01:00
Andrew Wood 1d28da18ce Add a basic test for monitoring, each of the "in" and "out" sides. 2026-04-19 23:12:10 +01:00
Andrew Wood 571c3bee06 Datestamp update. 2026-04-19 21:51:24 +01:00
Andrew Wood 618f1c1578 Message line number updates. 2026-04-19 21:49:12 +01:00
Andrew Wood 496b1e431e Return a boolean from pv__transfer_read/write, where false indicates a transient error. 2026-04-19 21:47:46 +01:00
Andrew Wood ef9240a7a5 Add another _ to the internal read/write_repeated functions so they are easier to distinguish from pv__transfer_read/write when searching. 2026-04-19 21:15:33 +01:00
Andrew Wood b2f44b6724 Clamp the calculated ETA to within the size of a long integer to avoid over/underflows, and round off the floating point value rather than just truncating the decimal portion. 2026-04-19 17:57:32 +01:00
Andrew Wood c19d16b3c8 Loosen the limits on this test slightly. 2026-04-19 17:47:52 +01:00
Andrew Wood 0440ba26da Adjust the ETA clamp note to mention 64-bit. 2026-04-19 16:58:55 +01:00
Andrew Wood 070bcb5acc Message line number updates. 2026-04-19 16:58:14 +01:00
Andrew Wood f3353cb4bd Adjust the ETA max to 68 years on systems where a long integer is 32 bits wide, as that is all that will fit. 2026-04-19 16:58:05 +01:00
Andrew Wood 9f63212a7c Add pv_asprintf() and change the way the terminal lock file is stored, so it is in a dynamically allocated buffer rather than using one of a fixed size. 2026-04-19 16:24:26 +01:00
Andrew Wood a59c91f03d Note the time clamping changes. 2026-04-19 13:06:59 +01:00