[PATCH 1/2] copyfilerange: wrap some overlong lines (in a tabsize-independent way)

Benno Schulenberg <[email protected]> Mon, 16 Mar 2026 12:09:37 +0100
Newsgroups org.kernel.vger.util-linux
Message-ID <[email protected]>
Most tools in util-linux seem to assume a tabsize of 8, judging from
the alignments of several continuation lines.  But `copyfilerange.c`
appears to have assumed a tabsize of 2, because with a tabsize of 8
the text on line 147 started in column 209!

But even with a tabsize of 2, three lines were much wider than the
reasonable 100 columns.  So, wrap those, and in the bargain improve
the wording of the affected messages, and add a space before %m.

CC: Dick Marinus <[email protected]>
Signed-off-by: Benno Schulenberg <[email protected]>
---
 misc-utils/copyfilerange.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/misc-utils/copyfilerange.c b/misc-utils/copyfilerange.c
index 20f0373bd..71b21bb28 100644
--- a/misc-utils/copyfilerange.c
+++ b/misc-utils/copyfilerange.c
@@ -135,19 +135,23 @@ static void copy_range(struct rangeitem *range) {
 	uintmax_t remaining = range->length;
 
 	if (range->in_offset > range->in_st_size)
-		errx(EXIT_FAILURE, _("%s offset %"PRId64" beyond file size of %"PRId64""), range->in_filename, range->in_offset, range->in_st_size);
+		errx(EXIT_FAILURE, _("%s offset %"PRId64" is beyond file size of %"PRId64""),
+		                     range->in_filename, range->in_offset, range->in_st_size);
 
 	while (remaining > 0) {
 		const size_t chunk = remaining > SIZE_MAX ? SIZE_MAX : remaining;
 		if (verbose)
-			printf("copy_file_range %s to %s %"PRId64":%"PRId64":%zu\n", range->in_filename,
-							range->out_filename, range->in_offset, range->out_offset, chunk);
+			printf("copy_file_range %s to %s %"PRId64":%"PRId64":%zu\n",
+			       range->in_filename, range->out_filename,
+			       range->in_offset, range->out_offset, chunk);
 
-		const ssize_t copied = copy_file_range(range->in_fd, &range->in_offset, range->out_fd,
-																										&range->out_offset, chunk, 0);
+		const ssize_t copied = copy_file_range(range->in_fd, &range->in_offset,
+		                                       range->out_fd, &range->out_offset, chunk, 0);
 		if (copied < 0)
-			errx(EXIT_FAILURE, _("failed copy file range %"PRId64":%"PRId64":%ju from %s to %s with remaining %ju:%m\n"),
-							range->in_offset, range->out_offset, range->length, range->in_filename, range->out_filename, remaining);
+			errx(EXIT_FAILURE, _("failed to copy range %"PRId64":%"PRId64":%ju "
+			                     "from %s to %s with %ju remaining: %m\n"),
+			                     range->in_offset, range->out_offset, range->length,
+			                     range->in_filename, range->out_filename, remaining);
 		if (copied == 0)
 			break;
 
-- 
2.53.0