public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/15772] New: "Permission denied" compiling glibc 2.3.3 on reiser4: EACCES fatal to #include
@ 2004-06-02 10:28 ed at catmur dot co dot uk
  2004-06-02 11:16 ` [Bug c/15772] " dannysmith at users dot sourceforge dot net
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: ed at catmur dot co dot uk @ 2004-06-02 10:28 UTC (permalink / raw)
  To: gcc-bugs

http://linuxfromscratch.org/pipermail/lfs-hackers/2004-May/001096.html
http://bugs.gentoo.org/show_bug.cgi?id=52755
http://forums.gentoo.org/viewtopic.php?t=108718&start=600#1093328

gcc nss_nis/nis-service.c -c -std=gnu99 -O2 -Wall -Winline -Wstrict-prototypes
-Wwrite-strings -fprefetch-loop-arrays -freorder-blocks -march=athlon-xp -pipe
-mpreferred-stack-boundary=2  -fPIC    -I../include -I.
-I/var/tmp/portage/glibc-2.3.3_pre20040420-r1/work/glibc-2.3.2/buildhere/nis
-I.. -I../libio -I../nptl
-I/var/tmp/portage/glibc-2.3.3_pre20040420-r1/work/glibc-2.3.2/buildhere
-I../sysdeps/i386/elf -I../nptl/sysdeps/unix/sysv/linux/i386/i686
-I../nptl/sysdeps/unix/sysv/linux/i386 -I../nptl/sysdeps/unix/sysv/linux
-I../nptl/sysdeps/pthread -I../sysdeps/pthread -I../nptl/sysdeps/unix/sysv
-I../nptl/sysdeps/unix -I../nptl/sysdeps/i386/i686 -I../nptl/sysdeps/i386
-I../sysdeps/unix/sysv/linux/i386 -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu
-I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet
-I../sysdeps/unix/sysv/i386 -I../sysdeps/unix/sysv -I../sysdeps/unix/i386
-I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/i386/i686/fpu
-I../sysdeps/i386/i686 -I../sysdeps/i386/i486 -I../nptl/sysdeps/i386/i486
-I../sysdeps/i386/fpu -I../sysdeps/i386 -I../sysdeps/wordsize-32
-I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64
-I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754 -I../sysdeps/generic/elf
-I../sysdeps/generic -nostdinc -isystem
/usr/lib/gcc/i686-pc-linux-gnu/3.4.0/include -isystem //usr/include
-D_LIBC_REENTRANT -D_LIBC_REENTRANT -include ../include/libc-symbols.h  -DPIC
-DSHARED -DNOT_IN_libc=1 -DIS_IN_libnss_nis=1    -o
/var/tmp/portage/glibc-2.3.3_pre20040420-r1/work/glibc-2.3.2/buildhere/nis/nis-service.os
-MD -MP -MF
/var/tmp/portage/glibc-2.3.3_pre20040420-r1/work/glibc-2.3.2/buildhere/nis/nis-service.os.dt
In file included from nss_nis/nis-proto.c:20:
../include/nss.h:1:21: ./nss/nss.h: Permission denied
In file included from nss_nis/nis-service.c:20:
../include/nss.h:1:21: ./nss/nss.h: Permission denied
In file included from ./nss-nis.h:24,
                 from nss_nis/nis-proto.c:29:
../include/nsswitch.h:1:26: ./nss/nsswitch.h: Permission denied
...

Situation: reiser4 filesystem, wd contains an ordinary file mode 0644 named
'nss'. (This is important).

Cause: in gcc/cppfiles.c,
_cpp_find_file() calls find_file_in_dir() on . for nss/nsswitch.h
find_file_in_dir() calls open_file() on ./nss/nsswitch.h
open_file() calls open() on ./nss/nsswitch.h
Instead of failing ENOTDIR, open() fails EACCES. This is because under reiser4
all files are directories so ENOTDIR is unused as an error code; instead it
tries to read 'nss' as a directory but as 'nss' is 0644 its "directory contents"
are not accessible.
On any normal file system, open() fails ENOTDIR, open_file() returns false
converting ENOTDIR to ENOENT, find_file_in_dir() returns false, and
_cpp_find_file() continues to the next node in the include list, eventually
finding nss/nsswitch.h in -I..
On reiser4, open() fails EACCES, open_file() returns false, find_file_in_dir()
calls open_file_failed() and returns true, everything falls apart.

The workaround I suggest for glibc is to make 'nss' 0755 thus causing open() to
fail ENOENT which causes _cpp_find_file_in_dir() to continue to the next node in
the include list.

The fix I suggest for gcc is to make EACCES non-fatal: gcc should instead of
failing print a warning message and continue searching for an include file it
can access. 

The patch is obvious and I will attach it as soon as I have tested it properly.

-- 
           Summary: "Permission denied" compiling glibc 2.3.3 on reiser4:
                    EACCES fatal to #include
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ed at catmur dot co dot uk
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15772


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c/15772] "Permission denied" compiling glibc 2.3.3 on reiser4: EACCES fatal to #include
  2004-06-02 10:28 [Bug c/15772] New: "Permission denied" compiling glibc 2.3.3 on reiser4: EACCES fatal to #include ed at catmur dot co dot uk
@ 2004-06-02 11:16 ` dannysmith at users dot sourceforge dot net
  2004-06-02 12:18 ` ed at catmur dot co dot uk
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dannysmith at users dot sourceforge dot net @ 2004-06-02 11:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dannysmith at users dot sourceforge dot net  2004-06-02 11:16 -------
This is a duplicate of 11242 which was (incorrectly) closed.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11242

There is a patch there too, which has been bootstrapped and regtested.

Danny

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dannysmith at users dot
                   |                            |sourceforge dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15772


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c/15772] "Permission denied" compiling glibc 2.3.3 on reiser4: EACCES fatal to #include
  2004-06-02 10:28 [Bug c/15772] New: "Permission denied" compiling glibc 2.3.3 on reiser4: EACCES fatal to #include ed at catmur dot co dot uk
  2004-06-02 11:16 ` [Bug c/15772] " dannysmith at users dot sourceforge dot net
@ 2004-06-02 12:18 ` ed at catmur dot co dot uk
  2004-06-02 12:40 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ed at catmur dot co dot uk @ 2004-06-02 12:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ed at catmur dot co dot uk  2004-06-02 12:18 -------
Interesting, but... no, this isn't a duplicate.

The error on mingw32 is caused by attempting to open a directory as a file.

The error on reiser4 is caused by attempting to open a file as a directory (as a
component in the path to an include file).

The patch on bug 11242 will not fix the reiser4 bug as stat() fails in the
reiser4 scenario.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15772


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c/15772] "Permission denied" compiling glibc 2.3.3 on reiser4: EACCES fatal to #include
  2004-06-02 10:28 [Bug c/15772] New: "Permission denied" compiling glibc 2.3.3 on reiser4: EACCES fatal to #include ed at catmur dot co dot uk
  2004-06-02 11:16 ` [Bug c/15772] " dannysmith at users dot sourceforge dot net
  2004-06-02 12:18 ` ed at catmur dot co dot uk
@ 2004-06-02 12:40 ` pinskia at gcc dot gnu dot org
  2004-06-02 13:25 ` ed at catmur dot co dot uk
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-02 12:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-02 12:40 -------
Isn't this a bug in reiser4 which is inconsistent with any other file system?

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15772


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c/15772] "Permission denied" compiling glibc 2.3.3 on reiser4: EACCES fatal to #include
  2004-06-02 10:28 [Bug c/15772] New: "Permission denied" compiling glibc 2.3.3 on reiser4: EACCES fatal to #include ed at catmur dot co dot uk
                   ` (2 preceding siblings ...)
  2004-06-02 12:40 ` pinskia at gcc dot gnu dot org
@ 2004-06-02 13:25 ` ed at catmur dot co dot uk
  2004-06-02 13:31 ` ed at catmur dot co dot uk
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ed at catmur dot co dot uk @ 2004-06-02 13:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ed at catmur dot co dot uk  2004-06-02 13:25 -------
"It's not a bug, it's a feature". Files-as-directories is part of what reiser4 is.

I see two issues here.

First, reiser4 giving an EACCES or ENOENT where classically an ENOTDIR would be
expected. So this is different behaviour. That doesn't mean that it's wrong;
Hans has made it clear that files-as-directories is the direction reiser4 is taking.

Second, even if a reiser4-specific patch were possible the situation remains
that (on any filesystem) an inaccessible directory somewhere along the include
path breaks that #include statement. I have tried but I can't think of a good
reason for this behaviour. I can file it as a separate bug blocking this bug if
you want.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15772


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c/15772] "Permission denied" compiling glibc 2.3.3 on reiser4: EACCES fatal to #include
  2004-06-02 10:28 [Bug c/15772] New: "Permission denied" compiling glibc 2.3.3 on reiser4: EACCES fatal to #include ed at catmur dot co dot uk
                   ` (3 preceding siblings ...)
  2004-06-02 13:25 ` ed at catmur dot co dot uk
@ 2004-06-02 13:31 ` ed at catmur dot co dot uk
  2004-06-02 13:41 ` ed at catmur dot co dot uk
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ed at catmur dot co dot uk @ 2004-06-02 13:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ed at catmur dot co dot uk  2004-06-02 13:31 -------
Created an attachment (id=6451)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6451&action=view)
Patch to make EACCES non-fatal

For #include <foo/bar.h>, causes a warning:

foo.c:1:27: warning: ./foo/bar.h: Permission denied

to be issued when foo is a non-readable directory or on a reiser4 filesystem,
but keeps searching for <foo/bar.h> in the include path.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15772


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c/15772] "Permission denied" compiling glibc 2.3.3 on reiser4: EACCES fatal to #include
  2004-06-02 10:28 [Bug c/15772] New: "Permission denied" compiling glibc 2.3.3 on reiser4: EACCES fatal to #include ed at catmur dot co dot uk
                   ` (4 preceding siblings ...)
  2004-06-02 13:31 ` ed at catmur dot co dot uk
@ 2004-06-02 13:41 ` ed at catmur dot co dot uk
  2004-06-02 13:43 ` [Bug preprocessor/15772] " pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ed at catmur dot co dot uk @ 2004-06-02 13:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ed at catmur dot co dot uk  2004-06-02 13:41 -------
Here's an test case for the underlying bug on any filesystem:

$ cat > foo.c
#include <include/stdio.h>
main() { printf("Hello world\n"); }
$ mkdir include
$ chmod 000 include
$ gcc foo.c -I. -I/usr && ./a.out
foo.c:1:27: ./include/stdio.h: Permission denied
$ gcc foo.c -I/usr -I. && ./a.out
Hello world

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15772


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug preprocessor/15772] "Permission denied" compiling glibc 2.3.3 on reiser4: EACCES fatal to #include
  2004-06-02 10:28 [Bug c/15772] New: "Permission denied" compiling glibc 2.3.3 on reiser4: EACCES fatal to #include ed at catmur dot co dot uk
                   ` (5 preceding siblings ...)
  2004-06-02 13:41 ` ed at catmur dot co dot uk
@ 2004-06-02 13:43 ` pinskia at gcc dot gnu dot org
  2004-06-02 17:23 ` neil at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-02 13:43 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |preprocessor


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15772


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug preprocessor/15772] "Permission denied" compiling glibc 2.3.3 on reiser4: EACCES fatal to #include
  2004-06-02 10:28 [Bug c/15772] New: "Permission denied" compiling glibc 2.3.3 on reiser4: EACCES fatal to #include ed at catmur dot co dot uk
                   ` (6 preceding siblings ...)
  2004-06-02 13:43 ` [Bug preprocessor/15772] " pinskia at gcc dot gnu dot org
@ 2004-06-02 17:23 ` neil at gcc dot gnu dot org
  2004-06-05 21:42 ` ed at catmur dot co dot uk
  2004-08-24  1:11 ` andy at benton987 dot fsnet dot co dot uk
  9 siblings, 0 replies; 11+ messages in thread
From: neil at gcc dot gnu dot org @ 2004-06-02 17:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From neil at gcc dot gnu dot org  2004-06-02 17:23 -------
Despite all said in this PR I can't see why this is a GCC bug.  Isn't it a glibc
bug?

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15772


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug preprocessor/15772] "Permission denied" compiling glibc 2.3.3 on reiser4: EACCES fatal to #include
  2004-06-02 10:28 [Bug c/15772] New: "Permission denied" compiling glibc 2.3.3 on reiser4: EACCES fatal to #include ed at catmur dot co dot uk
                   ` (7 preceding siblings ...)
  2004-06-02 17:23 ` neil at gcc dot gnu dot org
@ 2004-06-05 21:42 ` ed at catmur dot co dot uk
  2004-08-24  1:11 ` andy at benton987 dot fsnet dot co dot uk
  9 siblings, 0 replies; 11+ messages in thread
From: ed at catmur dot co dot uk @ 2004-06-05 21:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ed at catmur dot co dot uk  2004-06-05 21:42 -------
Sorry, missed your response.

This is not a glibc although glibc would be well advised to work around the bug
e.g. by making the file nss executable.

I regard this as a gcc bug on the grounds that raising an error (as opposed to a
warning), when an inaccessible path is encountered while searching for includes,
is incorrect behaviour.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15772


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug preprocessor/15772] "Permission denied" compiling glibc 2.3.3 on reiser4: EACCES fatal to #include
  2004-06-02 10:28 [Bug c/15772] New: "Permission denied" compiling glibc 2.3.3 on reiser4: EACCES fatal to #include ed at catmur dot co dot uk
                   ` (8 preceding siblings ...)
  2004-06-05 21:42 ` ed at catmur dot co dot uk
@ 2004-08-24  1:11 ` andy at benton987 dot fsnet dot co dot uk
  9 siblings, 0 replies; 11+ messages in thread
From: andy at benton987 dot fsnet dot co dot uk @ 2004-08-24  1:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From andy at benton987 dot fsnet dot co dot uk  2004-08-24 01:11 -------
Thanks for the patch.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15772


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2004-08-24  1:11 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-02 10:28 [Bug c/15772] New: "Permission denied" compiling glibc 2.3.3 on reiser4: EACCES fatal to #include ed at catmur dot co dot uk
2004-06-02 11:16 ` [Bug c/15772] " dannysmith at users dot sourceforge dot net
2004-06-02 12:18 ` ed at catmur dot co dot uk
2004-06-02 12:40 ` pinskia at gcc dot gnu dot org
2004-06-02 13:25 ` ed at catmur dot co dot uk
2004-06-02 13:31 ` ed at catmur dot co dot uk
2004-06-02 13:41 ` ed at catmur dot co dot uk
2004-06-02 13:43 ` [Bug preprocessor/15772] " pinskia at gcc dot gnu dot org
2004-06-02 17:23 ` neil at gcc dot gnu dot org
2004-06-05 21:42 ` ed at catmur dot co dot uk
2004-08-24  1:11 ` andy at benton987 dot fsnet dot co dot uk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).