On 05/22/2017 10:38 PM, Bruno Haible wrote: > Tim Rühsen wrote: >>>> on GNU/Linux open() on a directory returns -1 and sets errno to EISDIR. >>> >>> No, for example on my platform (Fedora 25 x86-64), 'strace cat .' >>> outputs the line 'open(".", O_RDONLY) = 3'. >> >> Same here on Debian unstable. >> What you want to say is, that it depends on the flags. >> And you are right, I wasn't very precise in that point. >> >> Here we use >> fd = open(fname, O_WRONLY | flag | O_CREAT | O_NONBLOCK | O_BINARY, S_IRUSR >> | >> S_IWUSR | S_IRGRP | S_IROTH); >> >> 'flag' might be one of O_TRUNC, O_APPEND or O_EXCL. >> >> A test with different flags for open(<existing directory>) shows failure + >> errno EISDIR when opening for writing. > > This portability issue is an ideal "skills ramp up" for someone who has only > done > smaller contributions to gnulib so far. > > Steps: > 1) Consider the standards: What does POSIX:2008 say about the issue? > 2) Extend the unit test of module 'open'. > 3) Ask us to test these extended unit tests on various platforms (Mac OS X, > Solaris, > FreeBSD, HP-UX, etc.). > 4) Mention the issue in the doc section about 'open'. > 5) Extend the Autoconf test to recognize this case and arrange to override the > 'open' function when the Autoconf test fails. > 6) Extend the workaround (lib/open.c) and make sure the unit test now succeeds > on the relevant platform(s). > > Any takers? Tim? Gisle?
Basically a very good idea. But I am really busy working on wget2/libwget, maintaining projects and mentoring GSOC students. I just created a Wiki[1] page describing this issue. Maybe we can get one (or more) of our students to work on this - it is still 'community bonding' time. Thanks for providing the detailed steps. > > Bruno [1] https://gitlab.com/gnuwget/wget2/wikis/enhancing-gnulib-module-'open'-to-return-eisdir-regarding-posix.2008 With Best Regards, Tim
signature.asc
Description: OpenPGP digital signature