In looking at Pádraig's report of a tail test failure with ksh, I wanted to see how ksh pipes differed from bash/zsh ones, by doing this:
for i in sh zsh bash ksh; do printf "$i: "; $i -c ':|./stat --format=%F -';done sh: fifo zsh: fifo bash: fifo ksh: socket But couldn't, because stat didn't accept "-" as meaning standard input. Here's a patch to make it do that (and make the above print what's displayed): diff --git a/src/stat.c b/src/stat.c index 3302270..56d25e6 100644 --- a/src/stat.c +++ b/src/stat.c @@ -857,7 +857,15 @@ do_stat (char const *filename, bool terse, char const *format) { struct stat statbuf; - if ((follow_links ? stat : lstat) (filename, &statbuf) != 0) + if (STREQ (filename, "-")) + { + if (fstat (STDIN_FILENO, &statbuf) != 0) + { + error (0, errno, _("cannot stat standard input")); + return false; + } + } + else if ((follow_links ? stat : lstat) (filename, &statbuf) != 0) { error (0, errno, _("cannot stat %s"), quote (filename)); return false; This is just FYI. Of course I'll add the usual NEWS, log and tests and post again later.