Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 52755 - glibc 2.3.3_pre20040420 compile failure on reiser4: ./nss/nss.h: Permission denied
Summary: glibc 2.3.3_pre20040420 compile failure on reiser4: ./nss/nss.h: Permission d...
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All All
: High major (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
: 54237 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-06-01 23:05 UTC by Ed Catmur
Modified: 2004-06-18 08:44 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to make EACCES non-fatal (gcc-3.4.0-reiser4-includes.patch,587 bytes, patch)
2004-06-02 06:33 UTC, Ed Catmur
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Catmur 2004-06-01 23:05:01 UTC
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
...

Cause: ${S}/nis/nss is an ordinary file; gcc tries to open it as a directory (reiser4, yay!) and of course fails.

This is (I think) strictly speaking a gcc bug, but it's easier to fix this compile; I don't know of a fix to gcc.

Workaround (from forums):
--- /usr/portage/sys-libs/glibc/glibc-2.3.3_pre20040420.ebuild  2004-05-08 23:07:40.000000000 +0100
+++ /srv/gentoo/trees/forums.gentoo.org/sys-libs/glibc/glibc-2.3.3_pre20040420.ebuild   2004-06-01 03:43:00.991041326 +0100
@@ -532,8 +532,10 @@ src_compile() {
                ${myconf} || die

        einfo "Building GLIBC..."
+       mv ${S}/nis/nss ${S}/nis/nss.bak
        cd ${S}/buildhere
        make PARALLELMFLAGS="${MAKEOPTS}" || die
+       mv ${S}/nis/nss.bak ${S}/nis/nss
 #      einfo "Doing GLIBC checks..."
 #      make check
 }

This works fine and I am using the glibc in question with no problems.
Comment 1 Joshua Kinard gentoo-dev 2004-06-01 23:57:27 UTC
I've never seen this bug before, and looking at your error messages, I'm surprised that workaround works.  I think what's going on is glibc is getting its paths screwed up.

It looks like the compiler enters nss_nis/ and starts parsing nis-proto.c.  In parsing that file, it needs to read nss.h in the include folder one level up (hence ../include/nss.h).  Parsing that include, it needs to access another header, ./nss/nss.h.  Now assuming this is from the point of view of the compiler sitting in nss_nis/ while calling that second nss.h file, it will indeed fail because nss_nis/nss is a file and not a directory, and the compiler should be looking for ../nss/nss.h (up one level, in the nss/ dir).  Same goes for the other files gcc is looking for.

I'm not sure if this error is a bug in reiserfs4, or a bug in glibc.  You said this workaround came form the forums, which topic, and what filesystem is everyone in that topic running?  I'm suspecting reiserfs4 having a minor quirk smply because of a slight bias and because it looks like make is getting confused.  I've compiled this glibc on several systems of different archs, and never bumped into this before.
Comment 2 Ed Catmur 2004-06-02 00:35:58 UTC
http://forums.gentoo.org/viewtopic.php?t=108718&start=600#1093328 and above.

The compiler is sitting in ${S}/nis so includes will be relative to that dir. (gcc does not enter directories, make does that.)
The structure is:
${S}/
${S}/include/nss.h
${S}/nss/nss.h
${S}/nis/ (compiler's wd)
${S}/nis/nss_nis/nis-service.c (source file)
${S}/nis/nss (ordinary file)

From wd of the compiler, ${S}/include/nss.h is ../include/nss.h.
./nss/nss.h is indeed ${S}/nis/nss/nss.h (failed chdir) but the gcc line includes -I.. so on most filesystems ./nss/nss.h will try .././nss/nss.h i.e. ${S}/nss/nss.h which is correct.

glibc is not at fault here.

Behaviour of reiser4 is that every file is a directory. This allows various metadata, ACLs, mime types etc. to be implemented. However it causes problems of this sort. See the gstreamer bug 49081 (which I fixed).

Confirmatory data:
Removing -I. from the gcc command line allows successful compile.
Moving the compilation to a reiser3 (reiserfs) filesystem allows successful compile.
Moving the directory to a tmpfs/ramfs filesystem allows successful compile.

More cases of this bug:
http://linuxfromscratch.org/pipermail/lfs-hackers/2004-May/001096.html

and others. Every instance of this bug I have found has been on a reiser4 filesystem.
Comment 3 Ed Catmur 2004-06-02 02:00:18 UTC
Just had a genius moment (yeah, they don't come too often).

I was checking the gcc source to see how includes work and it seems to be concentrated in gcc/cppfiles.c (open_file(), find_file_in_dir(), _cpp_find_file() are the functions to look at).

The reason the error is "Permission denied" is that gcc tries to open() nss/nss.h and as nss is 0644 we get a EACCES. Changing nss to 0755 changes the error to ENOENT which gcc knows how to recover from (moving on to the next directory in the include search path). On non-reiser4 fss the error is ENOENT in both cases. (confirmed experimentally.)

And indeed, running chmod +x nss allows the compilation to proceed. This suggests that the ebuild should do that, rather than moving nss out of the way which is potentially destructive.

--- /usr/portage/sys-libs/glibc/glibc-2.3.3_pre20040420.ebuild  2004-05-08 23:07:40.000000000 +0100
+++ /srv/gentoo/trees/forums.gentoo.org/sys-libs/glibc/glibc-2.3.3_pre20040420.ebuild   2004-06-01 03:43:00.991041326 +0100
@@ -532,8 +532,9 @@ src_compile() {
                ${myconf} || die

        einfo "Building GLIBC..."
+       chmod +x ${S}/nis/nss
        cd ${S}/buildhere
        make PARALLELMFLAGS="${MAKEOPTS}" || die
 #      einfo "Doing GLIBC checks..."
 #      make check
 }
Comment 4 Ed Catmur 2004-06-02 03:31:19 UTC
Further analysis and soon a patch: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15772

Once I have tested the patch I will split it off allowing this bug to be for the workaround.
Comment 5 Martin Holzer (RETIRED) gentoo-dev 2004-06-02 05:10:36 UTC
mr_bones_: please assign glibc/gcc bugs to toolchain@g.o
Comment 6 Ed Catmur 2004-06-02 06:33:40 UTC
Created attachment 32522 [details, diff]
Patch to make EACCES non-fatal

Upstreamed etc. Have some (initially sceptical) developer interest.


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 an ordinary file on a
reiser4 filesystem, but keeps searching for <foo/bar.h> in the include path.
Comment 7 SpanKY gentoo-dev 2004-06-05 14:12:04 UTC
since this seems to be a reiser4 bug please report this upstream
Comment 8 Ed Catmur 2004-06-05 14:45:12 UTC
Not a reiser 4 bug; this is a gcc bug with a glibc workaround.

I reported it upstream at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15772 but the patch can be used here as well.
Comment 9 Travis Tilley (RETIRED) gentoo-dev 2004-06-05 15:21:02 UTC
the fix has been added to gcc 3.4.0-r6
Comment 10 SpanKY gentoo-dev 2004-06-18 08:44:10 UTC
*** Bug 54237 has been marked as a duplicate of this bug. ***