|
| From: | PƔdraig Brady |
| Subject: | bug#46048: split -n K/N loses data, sum of output files is smaller than input file. |
| Date: | Sun, 24 Jan 2021 16:58:43 +0000 |
| User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Thunderbird/84.0 |
On 24/01/2021 16:52, PƔdraig Brady wrote:
diff --git a/src/split.c b/src/split.c
index 0660da13f..6aa8d50e9 100644
--- a/src/split.c
+++ b/src/split.c
@@ -1001,7 +1001,7 @@ bytes_chunk_extract (uintmax_t k, uintmax_t n, char *buf,
size_t bufsize,
}
else
{
- if (lseek (STDIN_FILENO, start, SEEK_CUR) < 0)
+ if (lseek (STDIN_FILENO, start, SEEK_SET) < 0)
die (EXIT_FAILURE, errno, "%s", quotef (infile));
initial_read = SIZE_MAX;
}
The same adjustment is needed in lines_chunk_split() I'll add a test also. cheers, PƔdraig
| [Prev in Thread] | Current Thread | [Next in Thread] |