From 33b62ea9f27938a225920672f2ef743280cb8b34 Mon Sep 17 00:00:00 2001 From: Socialpranker <0630039863abc@gmail.com> Date: Sat, 5 Sep 2026 19:27:06 +0200 Subject: [PATCH] od: say the skip ran past the end of the combined input -j is measured over all the inputs joined together, so naming a single 'input' misleads when several files were given: $ od -j6 a b od: tried to skip past end of input # was od: cannot skip past end of combined input # GNU, and now --- src/uu/od/locales/en-US.ftl | 2 +- src/uu/od/locales/fr-FR.ftl | 2 +- tests/by-util/test_od.rs | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/uu/od/locales/en-US.ftl b/src/uu/od/locales/en-US.ftl index 2c0d8baed49..e123ca9bbc9 100644 --- a/src/uu/od/locales/en-US.ftl +++ b/src/uu/od/locales/en-US.ftl @@ -59,7 +59,7 @@ od-error-overflow = Numerical result out of range od-error-invalid-suffix = invalid suffix in {$option} argument {$value} od-error-invalid-argument = invalid {$option} argument {$value} od-error-argument-too-large = {$option} argument {$value} too large -od-error-skip-past-end = tried to skip past end of input +od-error-skip-past-end = cannot skip past end of combined input # Help messages od-help-help = Print help information. diff --git a/src/uu/od/locales/fr-FR.ftl b/src/uu/od/locales/fr-FR.ftl index ada0c2d796f..c12d085c16a 100644 --- a/src/uu/od/locales/fr-FR.ftl +++ b/src/uu/od/locales/fr-FR.ftl @@ -59,7 +59,7 @@ od-error-parse-failed = échec de l'analyse od-error-invalid-suffix = suffixe invalide dans l'argument {$option} {$value} od-error-invalid-argument = argument {$option} invalide {$value} od-error-argument-too-large = argument {$option} {$value} trop grand -od-error-skip-past-end = tentative d'ignorer au-delà de la fin de l'entrée +od-error-skip-past-end = impossible d'ignorer au-delà de la fin de l'entrée combinée # Messages d'aide od-help-help = Afficher les informations d'aide. diff --git a/tests/by-util/test_od.rs b/tests/by-util/test_od.rs index f23f241dbae..6da0c4964e0 100644 --- a/tests/by-util/test_od.rs +++ b/tests/by-util/test_od.rs @@ -948,6 +948,21 @@ fn test_skip_bytes_error() { .failure(); } +// The skip is measured over all the inputs joined together, and the message +// says so, matching GNU od. +#[test] +fn test_skip_bytes_past_end_message() { + let (at, mut ucmd) = at_and_ucmd!(); + at.write("a", "abc"); + at.write("b", "de"); + ucmd.arg("-j6") + .arg("a") + .arg("b") + .fails_with_code(1) + .no_stdout() + .stderr_only("od: cannot skip past end of combined input\n"); +} + // A seekable special file such as /dev/null can be skipped past its (empty) // end without error, matching GNU od. #[cfg(unix)]