Bug 39276 - parted -1.6.6 build dies in linux.c
|
Bug#:
39276
|
Product: Gentoo Linux
|
Version: unspecified
|
Platform: All
|
|
OS/Version: All
|
Status: RESOLVED
|
Severity: normal
|
Priority: P2
|
|
Resolution: FIXED
|
Assigned To: plasmaroo@gentoo.org
|
Reported By: derk@zapville.org
|
|
Component: Ebuilds
|
|
|
URL:
|
|
Summary: parted -1.6.6 build dies in linux.c
|
|
Keywords:
|
|
Status Whiteboard:
|
|
Opened: 2004-01-24 12:16 0000
|
mv -f .libs/disk_pc98.lo disk_pc98.lo
/bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -mcpu=athlon-xp -O3 -pipe -D_REENTRANT -D_FILE_OFFSET_BITS=64 -DLOCALEDIR="\"/usr/share/locale\"" -DLOCALEDIR="\"/usr/share/locale\"" -W -Wall -Wno-unused -Wno-switch -Wno-format -Werror -c linux.c
mv -f .libs/disk_mac.lo disk_mac.lo
rm -f .libs/disk_sun.lo
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -mcpu=athlon-xp -O3 -pipe -D_REENTRANT -D_FILE_OFFSET_BITS=64 -DLOCALEDIR=\"/usr/share/locale\" -DLOCALEDIR=\"/usr/share/locale\" -W -Wall -Wno-unused -Wno-switch -Wno-format -Werror -c disk_sun.c -fPIC -DPIC -o .libs/disk_sun.lo
rm -f .libs/linux.lo
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -mcpu=athlon-xp -O3 -pipe -D_REENTRANT -D_FILE_OFFSET_BITS=64 -DLOCALEDIR=\"/usr/share/locale\" -DLOCALEDIR=\"/usr/share/locale\" -W -Wall -Wno-unused -Wno-switch -Wno-format -Werror -c linux.c -fPIC -DPIC -o .libs/linux.lo
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -mcpu=athlon-xp -O3 -pipe -D_REENTRANT -D_FILE_OFFSET_BITS=64 -DLOCALEDIR=\"/usr/share/locale\" -DLOCALEDIR=\"/usr/share/locale\" -W -Wall -Wno-unused -Wno-switch -Wno-format -Werror -c disk_sun.c -o disk_sun.o >/dev/null 2>&1
linux.c: In function `_device_get_length':
linux.c:407: error: syntax error before '[' token
linux.c:407: warning: signed and unsigned type in conditional expression
make[3]: *** [linux.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
mv -f .libs/disk_sun.lo disk_sun.lo
make[3]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6'
make: *** [all-recursive-am] Error 2
!!! ERROR: sys-apps/parted-1.6.6 failed.
!!! Function src_compile, Line 36, Exitcode 2
!!! Make failed
now this is after an attempted fix ..
there is an error in the 'built in' MACRO for
BLKGETSIZE64 _IOR(0x12,114,size_t)
is as it is defined in linux 2.6.0 headers fs.h other wise we get a type missmatch -- error
old form was _IOR(0x12,114,sizeof(uint64_t)) this dies as
_IOR as defined in /usr/include/asm/ioctl.h results in a call to
_IOC_TYPECHECK(t) where the sizeof(uint64_t) causes the compile to error out on and unmatched '[' token ..
_IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size)))
/* provoke compile error for invalid uses of size argument */
extern int __invalid_size_argument_for_IOC;
#define _IOC_TYPECHECK(t) \
((sizeof(t) == sizeof(t[1]) && \
sizeof(t) < (1 << _IOC_SIZEBITS)) ? \
sizeof(t) : __invalid_size_argument_for_IOC)
perhaps defining in 'parted' a direct call to _IOC without including the _IOC_TYPECHECK(t) call would work.
the my swap of size_t for (sizeof(uint64_t)) resulted in the listing below it dies on the warning ... how does one fix that ? the problem is in the header files called by BLKGETSIZE64
Type 'make' to compile parted
make all-recursive
make[1]: Entering directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6'
Making all in intl
make[2]: Entering directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/intl'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/intl'
Making all in po
make[2]: Entering directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/po'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/po'
Making all in libparted
make[2]: Entering directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted'
Making all in fs_ext2
make[3]: Entering directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted/fs_ext2'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted/fs_ext2'
Making all in fs_fat
make[3]: Entering directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted/fs_fat'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted/fs_fat'
Making all in fs_hfs
make[3]: Entering directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted/fs_hfs'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted/fs_hfs'
Making all in fs_jfs
make[3]: Entering directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted/fs_jfs'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted/fs_jfs'
Making all in fs_linux_swap
make[3]: Entering directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted/fs_linux_swap'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted/fs_linux_swap'
Making all in fs_ntfs
make[3]: Entering directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted/fs_ntfs'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted/fs_ntfs'
Making all in fs_reiserfs
make[3]: Entering directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted/fs_reiserfs'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted/fs_reiserfs'
Making all in fs_ufs
make[3]: Entering directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted/fs_ufs'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted/fs_ufs'
Making all in fs_xfs
make[3]: Entering directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted/fs_xfs'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted/fs_xfs'
make[3]: Entering directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted'
/bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -mcpu=athlon-xp -O3 -pipe -D_REENTRANT -D_FILE_OFFSET_BITS=64 -DLOCALEDIR="\"/usr/share/locale\"" -DLOCALEDIR="\"/usr/share/locale\"" -W -Wall -Wno-unused -Wno-switch -Wno-format -Werror -c linux.c
rm -f .libs/linux.lo
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -mcpu=athlon-xp -O3 -pipe -D_REENTRANT -D_FILE_OFFSET_BITS=64 -DLOCALEDIR=\"/usr/share/locale\" -DLOCALEDIR=\"/usr/share/locale\" -W -Wall -Wno-unused -Wno-switch -Wno-format -Werror -c linux.c -fPIC -DPIC -o .libs/linux.lo
linux.c: In function `_device_get_length':
linux.c:410: warning: signed and unsigned type in conditional expression
make[3]: *** [linux.lo] Error 1
make[3]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6'
make: *** [all-recursive-am] Error 2
!!! ERROR: sys-apps/parted-1.6.6 failed.
!!! Function src_compile, Line 36, Exitcode 2
!!! Make failed
okay found out how get past the warning error ;
original /asm/ioctl.h has
/* provoke compile error for invalid uses of size argument */
extern int __invalid_size_argument_for_IOC;
#define _IOC_TYPECHECK(t) \
((sizeof(t) == sizeof(t[1]) && \
sizeof(t) < (1 << _IOC_SIZEBITS)) ? \
sizeof(t) : __invalid_size_argument_for_IOC)
option to fix #1
/* provoke compile error for invalid uses of size argument */
extern int __invalid_size_argument_for_IOC;
#define _IOC_TYPECHECK(t) \
((sizeof(t) == sizeof(t[1]) && \
sizeof(t) < (1 << _IOC_SIZEBITS)) ? \
sizeof(t) : (unsigned int)__invalid_size_argument_for_IOC)
option to fix number 2 ..
/* provoke compile error for invalid uses of size argument */
extern unsigned int __invalid_size_argument_for_IOC;
#define _IOC_TYPECHECK(t) \
((sizeof(t) == sizeof(t[1]) && \
sizeof(t) < (1 << _IOC_SIZEBITS)) ? \
sizeof(t) : __invalid_size_argument_for_IOC)
either works now I don't know if this is safe or not .. any thoughts
does it by pass the whole purpose of the test ...
derk
From man gcc:
-Werror
Make all warnings into errors.
-W Print extra warning messages for these events:
...
* An unsigned value is compared against zero with < or >=.
...
I guess this could be fixed by removing either -W or -Werror as above, but I'm
pretty sure this is a bug in asm/ioctl.h, as you've suggested.
The second solution seems less likely to break stuff, I think.
The same (original) thing occurs with sys-boot/lilo ... any chance you can have
a
look at that too?
OKay for your lilo question the
#define LVM_GET_IOP_VERSION _IOR(0xfe,0x98,1) errors since a 'type' is expected in the 3 arguement position putting "char" here fixes the problem .. as I think a single byte is being requested .. but I haven't got the LVM docs at the moment to check.
So the following changes to geometry.c will compile and should work properly without changing ioctls.h but the correspondence to a single byte == char should be checked as I think this may be arch dependent .. is there a header that defines a type 'byte' in a arch independent way? if so it should be included and the 'char' replaced with 'byte' instead.
#define LVM_GET_IOP_VERSION _IOR(0xfe,0x98,char)
and
#define LV_BMAP _IOWR(0xfe,0X30,char)
This also suggests that any non-type args to these expressions found elsewhere should be changed to the corresponding types.
Okay, well to be honest you needn't really worry about lilo working on other
arches and 64 bit architectures and such, since it won't, ever. :)
okay discovered a note in LVM source code about ioctl defines
this is in kernel/lvm.h or include/linux/lvm.h or tools/lib/lvm.h (from lvm-1.0.8.tar.gz)
the last arg is indeed a type and in the notes it says
sizeof(1) == sizeof(int) == sizeof(2) == 4 on a 32 bit machine os the arg should be an int not a char as stated above ..
oops .. forgot the clarifying code so it should read
#define LVM_GET_IOP_VERSION _IOR(0xfe,0x98,int)
and
#define LV_BMAP _IOWR(0xfe,0X30,int)
Sooo... what should be done about this? As far as I can see, linux-headers,
parted and lilo ALL need some changes...
lilo has already been fixed and is a different bug, dont discuss it here please
Sorry .. both parted and Lilo involved calls to _IOR( ) or _IOWR( ) masked by
#define MACRO's. These actually end up calling _IOC which calls _IOC_TYPECHECK
.. which is where the problems arose so .. different programs .. same mechanism
plasmaroo: can we get some linux-headers-2.6.x lovin goin on ?
Be careful .. there is only a minor .. i.e. a warning problem ... with the
headers. It can be silenced with the 'cast'. The other fixes are necessary in
the programs also ..
Patched in CVS, emerge sync and it should merge fine now.