2019-07-23 09:55:52 +0100, Geoff Clare: [...] > > Why GLOB_ERR? The shell does silently ignore directory open and > > read errors when expanding globs. In > > > > ls -ld -- *.c > > > > The shell would run ls with a literal *.c as argument without > > giving any warning when the current directory is not readable. > > The shell should ignore EACCES errors from opendir() (and probably > ELOOP, ENAMETOOLONG, ENOENT and ENOTDIR, none of which apply for "*.c") > but if opendir() fails with EMFILE or ENFILE the shell should report > an error. [...]
EACCES could apply for *.c if the current directory is not readable. The other ones could apply for dir/*.c In any case no shell reports errors upon failing to open or read directories when expanding globs (including for EMFILE/ENFILE; I'd agree it may be worth notifying the user of this kind of pathological condition; but doing it for each opendir in things like */*.c would be a problem). If the spec says otherwise, it's a bug in the spec. -- Stephane
