uutils/coreutils · error · io::Error

UnexpectedEof

UnexpectedEof

Error message

tried to skip past end of input

What it means

Error "tried to skip past end of input" thrown in uutils/coreutils.

Source

Thrown at src/uu/od/src/multifile_reader.rs:156

    /// special file (e.g. `/dev/null`, which can be skipped past its empty end).
    /// Everything else - proc/sys files that report a bogus size, pipes, stdin -
    /// is advanced by reading and discarding. Skipping past the end of the whole
    /// input is an error, matching GNU `od`.
    pub fn skip(&mut self, mut n_skip: u64) -> io::Result<()> {
        while n_skip > 0 {
            let Some(curr) = self.curr_file.as_mut() else {
                break;
            };
            n_skip = skip_in_file(curr, n_skip)?;
            if n_skip == 0 {
                break;
            }
            // Current file is exhausted; continue skipping in the next one.
            self.next_file();
        }

        if n_skip > 0 {
            return Err(io::Error::new(
                io::ErrorKind::UnexpectedEof,
                translate!("od-error-skip-past-end"),
            ));
        }
        Ok(())
    }
}

/// Skip up to `n_skip` bytes within a single file. Returns the number of bytes
/// that still need to be skipped (0 if the skip landed inside this file, or
/// the remainder if the file ended first).
fn skip_in_file(curr: &mut CurrentReader, n_skip: u64) -> io::Result<u64> {
    #[cfg(unix)]
    if let CurrentReader::File(f) = curr
        && let Ok(meta) = f.metadata()
    {
        let size = meta.len();
        let blksize = uucore::fs::sane_blksize::sane_blksize_from_metadata(&meta);

View on GitHub (pinned to 0b77ced485)

Solutions

  1. Ensure the skip offset (-j/-N) is smaller than the input length.
  2. Check the input file size before requesting a skip past its end.

When it happens

Trigger: Occurs in od when a skip/seek offset requests skipping beyond the end of the concatenated input files.

Common situations: Using `od -j` with an offset larger than the total input size.


AI-assisted analysis of uutils/coreutils@0b77ced485 (2026-08-19). Data as JSON: /api/errors/8fa56a42d0033003. Report an issue: GitHub.