From a08be1c420501b1c75770a8f6103e3959486c895 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Wed, 9 Nov 2022 14:10:52 +0200 Subject: xz: Add comments about stdin and src_st.st_size. "xz -v < regular_file > out.xz" doesn't display the percentage and estimated remaining time because it doesn't even try to check the input file size when input is read from stdin. This could be improved but for now there's just a comment to remind about it. --- src/xz/coder.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/xz/coder.c') diff --git a/src/xz/coder.c b/src/xz/coder.c index f952e80d..4f51e8d5 100644 --- a/src/xz/coder.c +++ b/src/xz/coder.c @@ -931,6 +931,15 @@ coder_run(const char *filename) mytime_set_start_time(); // Initialize the progress indicator. + // + // NOTE: When reading from stdin, fstat() + // isn't called on it and thus src_st.st_size + // is zero. If stdin pointed to a regular + // file, it would still be possible to know + // the file size but then we would also need + // to take into account the current reading + // position since with stdin it isn't + // necessarily at the beginning of the file. const bool is_passthru = init_ret == CODER_INIT_PASSTHRU; const uint64_t in_size -- cgit v1.2.3