Last Comment Bug 686255 - modules/libpr0n/src/Endian.h shadows /usr/include/endian.h on a case-folding filesystem
: modules/libpr0n/src/Endian.h shadows /usr/include/endian.h on a case-folding ...
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: ImageLib (show other bugs)
: Trunk
: x86 Linux
: -- normal (vote)
: mozilla10
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-09-11 19:25 PDT by Khoo Yit Phang
Modified: 2016-06-04 01:21 PDT (History)
6 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Rename Endian.h to EndianMacros.h (1.82 KB, patch)
2011-09-11 19:25 PDT, Khoo Yit Phang
netzen: review+
jh: feedback+
Details | Diff | Splinter Review

Description Khoo Yit Phang 2011-09-11 19:25:33 PDT
Created attachment 559812 [details] [diff] [review]
Rename Endian.h to EndianMacros.h

I've found that the file modules/libpr0n/src/Endian.h introduced in 75919:52f2d362cbac (Bug 670466) potentially leads to a build failure when compiling Firefox on Linux with a case-folding file system due to shadowing /usr/include/endian.h.

Admittedly, I have a bit of an odd setup: Ubuntu 11.04 on VMware Fusion running on OS X Snow Leopard, with my Firefox source directory in an sshfs mount in the Linux guest from the OS X host. The case-folding occurs since the directory is actually in OS X. This setup has worked successfully until this issue.

I've attached a patch that renames Endian.h to EndianMacros.h that resolves this issue.


Details:

The first error that occurs is (a similar error occurs under the system-installed g++):

/home/khooyp/Projects/Research/llvm/build.yubuntu/Release/bin/clang++ -o nsICOEncoder.o -c -I../../../../dist/stl_wrappers -I../../../../dist/system_wrappers -include /home/khooyp/Projects/Research/mozilla/config/gcc_hidden.h -DMOZILLA_INTERNAL_API -D_IMPL_NS_COM -DEXPORT_XPT_API -DEXPORT_XPTC_API -D_IMPL_NS_GFX -D_IMPL_NS_WIDGET -DIMPL_XREAPI -DIMPL_NS_NET -DIMPL_THEBES  -DSTATIC_EXPORTABLE_JS_API -DOSTYPE=\"Linux2.6\" -DOSARCH=Linux -I/home/khooyp/Projects/Research/mozilla/modules/libpr0n/src/ -I/home/khooyp/Projects/Research/mozilla/modules/libpr0n/encoders/bmp/ -I/home/khooyp/Projects/Research/mozilla/modules/libpr0n/encoders/png/ -I/home/khooyp/Projects/Research/mozilla/modules/libpr0n/encoders/ico -I. -I../../../../dist/include -I../../../../dist/include/nsprpub  -I/home/khooyp/Projects/Research/mozilla/obj-i686-pc-linux-gnu/dist/include/nspr -I/home/khooyp/Projects/Research/mozilla/obj-i686-pc-linux-gnu/dist/include/nss      -fPIC  -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wno-invalid-offsetof -Wno-variadic-macros -Werror=return-type -pedantic -Wno-long-long -fno-strict-aliasing -fshort-wchar -pthread -ffunction-sections -fdata-sections -pipe  -DNDEBUG -DTRIMMED -g -fno-omit-frame-pointer   -DMOZILLA_CLIENT -include ../../../../mozilla-config.h -MD -MF .deps/nsICOEncoder.pp /home/khooyp/Projects/Research/mozilla/modules/libpr0n/encoders/ico/nsICOEncoder.cpp
In file included from /home/khooyp/Projects/Research/mozilla/modules/libpr0n/decoders/nsICODecoder.cpp:45:
In file included from ../../../dist/system_wrappers/stdlib.h:2:
In file included from /usr/include/stdlib.h:43:
/usr/include/bits/waitstatus.h:80:15: error: duplicate member '__w_retcode'
        unsigned int __w_retcode:8;
                     ^
/usr/include/bits/waitstatus.h:75:15: note: previous declaration is here
        unsigned int __w_retcode:8; /* Return code if exited normally.  */
                     ^
/usr/include/bits/waitstatus.h:81:15: error: duplicate member '__w_coredump'
        unsigned int __w_coredump:1;
                     ^
/usr/include/bits/waitstatus.h:74:15: note: previous declaration is here
        unsigned int __w_coredump:1; /* Set if dumped core.  */
                     ^
/usr/include/bits/waitstatus.h:82:15: error: duplicate member '__w_termsig'
        unsigned int __w_termsig:7;
                     ^
/usr/include/bits/waitstatus.h:73:15: note: previous declaration is here
        unsigned int __w_termsig:7; /* Terminating signal.  */
                     ^
/usr/include/bits/waitstatus.h:94:15: error: duplicate member '__w_stopsig'
        unsigned int __w_stopsig:8; /* Stopping signal.  */
                     ^
/usr/include/bits/waitstatus.h:89:15: note: previous declaration is here
        unsigned int __w_stopsig:8; /* Stopping signal.  */
                     ^
/usr/include/bits/waitstatus.h:95:15: error: duplicate member '__w_stopval'
        unsigned int __w_stopval:8; /* W_STOPPED if stopped.  */
                     ^
/usr/include/bits/waitstatus.h:88:15: note: previous declaration is here
        unsigned int __w_stopval:8; /* W_STOPPED if stopped.  */



This error occurs because the macros defined in /usr/include/endian.h are missing. Manually re-running the same command with "-o nsICOEncoder.o -c" replaced by "-E" to preprocess the input shows that the wrong "endian.h" is being opened (note that "modules/libpr0n/src/Endian.h" is case-folded to "modules/libpr0n/src/endian.h"):

# 1 "../../../../dist/system_wrappers/endian.h" 1 3
# 1 "../../../../dist/system_wrappers/endian.h" 3
#pragma GCC visibility push(default)
# 1 "/home/khooyp/Projects/Research/mozilla/modules/libpr0n/src/endian.h" 1 3
# 41 "/home/khooyp/Projects/Research/mozilla/modules/libpr0n/src/endian.h" 3
# 1 "../../../../dist/system_wrappers/prtypes.h" 1 3
# 1 "../../../../dist/system_wrappers/prtypes.h" 3
#pragma GCC visibility push(default)
Comment 1 Jeff Muizelaar [:jrmuizel] 2011-09-20 07:56:19 PDT
Comment on attachment 559812 [details] [diff] [review]
Rename Endian.h to EndianMacros.h

Brian added these, I'll defer the naming decisions to him. As a side note, it would be better if these were in a more general place than imglib and if they were inline functions instead of macros.
Comment 2 Brian R. Bondy [:bbondy] 2011-09-20 11:28:20 PDT
Comment on attachment 559812 [details] [diff] [review]
Rename Endian.h to EndianMacros.h

This compiles fine for me so the change is fine. 

> it would be better if these were in a more general place than imglib and if they were inline functions instead of macros.

Agree, these weren't created by me originally, I just moved them because they needed to be used by more than one cpp.  If we want to do this though I'd rather it be a different bug than this one and probably when someone needs to. 

---

Before this is pushed it should be run through try though.
Comment 3 Jens Hatlak (:InvisibleSmiley) 2011-09-30 03:46:48 PDT
Confirming (leaving the try run to people who are more knowledgeable in the field, though).

I'm also seeing this when trying to build SeaMonkey trunk on Kubuntu running in a VirtualBox on Windows 7, where the comm-central/mozilla-central sources are placed in a shared folder (NTFS). I'll try to build with the patch now. Meanwhile the output I got (gcc 4.5.1):

c++ -o Image.o -c -I../../../dist/stl_wrappers -I../../../dist/system_wrappers -include /mnt/hostdirs/mozilla-src/comm-central/mozilla/config/gcc_hidden.h -DMOZILLA_INTERNAL_API -D_IMPL_NS_COM -DEXPORT_XPT_API -DEXPORT_XPTC_API -D_IMPL_NS_GFX -D_IMPL_NS_WIDGET -DIMPL_XREAPI -DIMPL_NS_NET -DIMPL_THEBES  -DSTATIC_EXPORTABLE_JS_API -DMOZ_SUITE=1 -DOSTYPE=\"Linux2.6\" -DOSARCH=Linux -DEXCLUDE_SKIA_DEPENDENCIES  -DOS_LINUX=1 -DOS_POSIX=1  -I/mnt/hostdirs/mozilla-src/comm-central/mozilla/modules/libpr0n/decoders -I/mnt/hostdirs/mozilla-src/comm-central/mozilla/content/svg/content/src -I/mnt/hostdirs/mozilla-src/comm-central/mozilla/content/base/src  -I/mnt/hostdirs/mozilla-src/comm-central/mozilla/layout/svg/base/src -I/mnt/hostdirs/mozilla-src/comm-central/mozilla/ipc/chromium/src -I/mnt/hostdirs/mozilla-src/comm-central/mozilla/ipc/glue -I../../../ipc/ipdl/_ipdlheaders  -I/mnt/hostdirs/mozilla-src/comm-central/mozilla/modules/libpr0n/src -I. -I../../../dist/include -I../../../dist/include/nsprpub  -I/home/2install/build/mozilla/seamonkey-central/mozilla/dist/include/nspr -I/home/2install/build/mozilla/seamonkey-central/mozilla/dist/include/nss      -fPIC -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-invalid-offsetof -Wno-variadic-macros -Werror=return-type -Wno-long-long -fno-strict-aliasing -fshort-wchar -pthread -pipe -DNDEBUG -DTRIMMED -g -Os -freorder-blocks -finline-limit=50 -fomit-frame-pointer -I/home/2install/build/mozilla/seamonkey-central/mozilla/dist/include/cairo   -DMOZILLA_CLIENT -include ../../../mozilla-config.h /mnt/hostdirs/mozilla-src/comm-central/mozilla/modules/libpr0n/src/Image.cpp
In file included from /usr/include/stdlib.h:43:0,
                 from ../../../dist/system_wrappers/stdlib.h:3,
                 from ../../../dist/include/mozilla/mozalloc.h:48,
                 from ../../../dist/include/nscore.h:51,
                 from ../../../dist/include/nsrootidl.h:13,
                 from ../../../dist/include/nsISupports.h:10,
                 from ../../../dist/include/imgIContainer.h:10,
                 from /mnt/hostdirs/mozilla-src/comm-central/mozilla/modules/libpr0n/src/Image.h:41,
                 from /mnt/hostdirs/mozilla-src/comm-central/mozilla/modules/libpr0n/src/Image.cpp:38:
/usr/include/bits/waitstatus.h:80:27: error: declaration of ‘unsigned int wait::<anonymous struct>::__w_retcode’
/usr/include/bits/waitstatus.h:75:27: error: conflicts with previous declaration ‘unsigned int wait::<anonymous struct>::__w_retcode’
/usr/include/bits/waitstatus.h:81:28: error: declaration of ‘unsigned int wait::<anonymous struct>::__w_coredump’
/usr/include/bits/waitstatus.h:74:28: error: conflicts with previous declaration ‘unsigned int wait::<anonymous struct>::__w_coredump’
/usr/include/bits/waitstatus.h:82:27: error: declaration of ‘unsigned int wait::<anonymous struct>::__w_termsig’
/usr/include/bits/waitstatus.h:73:27: error: conflicts with previous declaration ‘unsigned int wait::<anonymous struct>::__w_termsig’
/usr/include/bits/waitstatus.h:94:27: error: declaration of ‘unsigned int wait::<anonymous struct>::__w_stopsig’
/usr/include/bits/waitstatus.h:89:27: error: conflicts with previous declaration ‘unsigned int wait::<anonymous struct>::__w_stopsig’
/usr/include/bits/waitstatus.h:95:27: error: declaration of ‘unsigned int wait::<anonymous struct>::__w_stopval’
/usr/include/bits/waitstatus.h:88:27: error: conflicts with previous declaration ‘unsigned int wait::<anonymous struct>::__w_stopval’
Comment 4 Brian R. Bondy [:bbondy] 2011-09-30 05:04:32 PDT
Pushed to try, I'll push out to inbound if that works:
https://tbpl.mozilla.org/?tree=Try&usebuildbot=1&rev=9a02946b8dcd
Comment 5 Jens Hatlak (:InvisibleSmiley) 2011-09-30 05:16:09 PDT
Comment on attachment 559812 [details] [diff] [review]
Rename Endian.h to EndianMacros.h

The patch fixed it for me.
Comment 6 Brian R. Bondy [:bbondy] 2011-10-02 04:51:29 PDT
I'm not a peer on imagelib but jlebar passed the review to me.  Should the commit message be marked as r=bbondy?
Comment 7 Philip Chee 2011-10-02 10:45:37 PDT
> I'm not a peer on imagelib but jlebar passed the review to me.  Should the commit
> message be marked as r=bbondy?
Yes. Certainly. As the saying goes: You touched it, you own it.
Comment 8 Brian R. Bondy [:bbondy] 2011-10-02 12:13:46 PDT
Pushed to inbound:
http://hg.mozilla.org/integration/mozilla-inbound/rev/4190b75388b9


Khoo Yit Phang:

I set you as the author this time, but you should set yourself as the author for the future:

> qrefresh -u "Your Name <your@email.com>"

Or do it once only in your hgrc (or mercurial.ini if you run on Windows):

> [ui]
> username = John Smith <john@smith.com>
> 
> [defaults]
> qnew = -Ue

Thanks for the patch.
Comment 9 Marco Bonardo [::mak] 2011-10-03 08:02:21 PDT
https://hg.mozilla.org/mozilla-central/rev/4190b75388b9

Note You need to log in before you can comment on or make changes to this bug.