Skip to content

dd of=/dev/stdout cause Illegal seek #11557

Description

@oech3
$ dd if=/etc/pacman.conf of=/dev/stdout
dd: failed to seek in output file: Illegal seek

GNU shows the content of input.
Maybe, caused by

coreutils/src/uu/dd/src/dd.rs

Lines 1440 to 1452 in 877f656

/// Canonicalized file name of `/dev/stdout`.
///
/// For example, if this process were invoked from the command line as
/// `dd`, then this function returns the [`OsString`] form of
/// `"/dev/stdout"`. However, if this process were invoked as `dd >
/// outfile`, then this function returns the canonicalized path to
/// `outfile`, something like `"/path/to/outfile"`.
fn stdout_canonicalized() -> OsString {
match Path::new("/dev/stdout").canonicalize() {
Ok(p) => p.into_os_string(),
Err(_) => OsString::from("/dev/stdout"),
}
}
?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions