https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67367
--- Comment #5 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> --- Created attachment 36265 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36265&action=edit A preliminary patch - not final This patch catches the segfault and we end up with an EOF error. It bothers me that we get into this with both source and destination of the raw_read with bad pointers, so I am going to explore further. If one uses a regular open command, READ/WRITE is specified and one can not write to a directory, so it throws the expected OS error. In the case of read only, one cany open a directory, but it is only intended to be read with readdir and not read (see man read and man readdir) Stay tuned.