]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
copyfilerange: wrap some overlong lines (in a tabsize-independent way)
authorBenno Schulenberg <bensberg@telfort.nl>
Mon, 16 Mar 2026 11:09:37 +0000 (12:09 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 17 Mar 2026 11:28:53 +0000 (12:28 +0100)
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 <dick@mrns.nl>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
misc-utils/copyfilerange.c

index 5ee562d223e151171482e3dd38fbe0544751a7b7..03b9e10015089960a557fa2f7f7f3f744ac85000 100644 (file)
@@ -133,19 +133,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;