Subject: bug#15147: tr: crash upon failed write(2)

From: Paul Eggert <[email-masked]>
Date: Tue, 20 Aug 2013 15:26:52 -0700

I can reproduce the problem without coreutils
on Ubuntu 13.04 x86-64.  Compile the following
program with plain "gcc foo.c" and then run
"./a.out >/dev/full"; it'll dump core the same way.
So it appears that this is a bug in the C library,
not in coreutils.

It's a fairly serious bug, I'd say.

#include <stdio.h>
int
main (void)
{
  static char io_buf[BUFSIZ];
  if (fwrite (io_buf, 1, sizeof io_buf, stdout) != sizeof io_buf)
    {
      perror ("write error");
      return 1;
    }
  return 0;
}