This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/15772] New: "Permission denied" compiling glibc 2.3.3 on reiser4: EACCES fatal to #include
- From: "ed at catmur dot co dot uk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Jun 2004 10:28:12 -0000
- Subject: [Bug c/15772] New: "Permission denied" compiling glibc 2.3.3 on reiser4: EACCES fatal to #include
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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