Reproduction steps
$ echo foo | install /dev/stdin bar
$ echo foo | install /dev/stdin bar
install: No such file or directory
Expected behaviour
Piped content is written to target file as per coreutils behaviour, regardless of whether target file exists.
Actual behaviour
Error message printed about missing file only if target file already exists.
From an strace it looks like it trips up chasing symlinks for the stdin pipe:
readlink("/proc", 0x7ffe5f48f540, 1023) = -1 EINVAL (Invalid argument)
readlink("/proc/self", "328710", 1023) = 6
readlink("/proc/328710", 0x7ffe5f48f540, 1023) = -1 EINVAL (Invalid argument)
readlink("/proc/328710/fd", 0x7ffe5f48f540, 1023) = -1 EINVAL (Invalid argument)
readlink("/proc/328710/fd/0", "pipe:[2063159]", 1023) = 14
readlink("/proc/328710/fd/pipe:[2063159]", 0x7ffe5f48f540, 1023) = -1 ENOENT (No such file or directory)
Reproduction steps
Expected behaviour
Piped content is written to target file as per coreutils behaviour, regardless of whether target file exists.
Actual behaviour
Error message printed about missing file only if target file already exists.
From an
straceit looks like it trips up chasing symlinks for the stdin pipe: