public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ed at catmur dot co dot uk" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/15772] New: "Permission denied" compiling glibc 2.3.3 on reiser4: EACCES fatal to #include
Date: Wed, 02 Jun 2004 10:28:00 -0000	[thread overview]
Message-ID: <20040602102803.15772.ed@catmur.co.uk> (raw)

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


             reply	other threads:[~2004-06-02 10:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-02 10:28 ed at catmur dot co dot uk [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040602102803.15772.ed@catmur.co.uk \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).