Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 39276 - parted -1.6.6 build dies in linux.c
Summary: parted -1.6.6 build dies in linux.c
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Tim Yamin (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-24 12:16 UTC by Derk W te Bokkel
Modified: 2004-02-02 09:56 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Derk W te Bokkel 2004-01-24 12:16:13 UTC
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
Comment 1 Derk W te Bokkel 2004-01-24 17:28:50 UTC
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
Comment 2 ferret 2004-01-25 18:12:24 UTC
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.
Comment 3 ferret 2004-01-25 20:35:37 UTC
The same (original) thing occurs with sys-boot/lilo ... any chance you can have a
look at that too?
Comment 4 Derk W te Bokkel 2004-01-26 11:01:51 UTC
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.
Comment 5 ferret 2004-01-26 13:34:38 UTC
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. :)
Comment 6 Derk W te Bokkel 2004-01-26 14:03:59 UTC
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 .. 
Comment 7 Derk W te Bokkel 2004-01-26 14:06:37 UTC
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)

Comment 8 ferret 2004-01-30 12:47:28 UTC
Sooo... what should be done about this? As far as I can see, linux-headers,
parted and lilo ALL need some changes...
Comment 9 SpanKY gentoo-dev 2004-01-30 14:16:23 UTC
lilo has already been fixed and is a different bug, dont discuss it here please
Comment 10 Derk W te Bokkel 2004-01-30 16:08:47 UTC
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 
Comment 11 SpanKY gentoo-dev 2004-02-02 06:40:32 UTC
plasmaroo: can we get some linux-headers-2.6.x lovin goin on ?
Comment 12 Derk W te Bokkel 2004-02-02 07:19:31 UTC
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 ..  
Comment 13 Tim Yamin (RETIRED) gentoo-dev 2004-02-02 09:56:17 UTC
Patched in CVS, emerge sync and it should merge fine now.