<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>39276</bug_id>
          
          <creation_ts>2004-01-24 12:16 0000</creation_ts>
          <short_desc>parted -1.6.6 build dies in linux.c</short_desc>
          <delta_ts>2004-02-02 09:56:17 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Linux</product>
          <component>Ebuilds</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>derk@zapville.org</reporter>
          <assigned_to>plasmaroo@gentoo.org</assigned_to>
          <cc>base-system@gentoo.org</cc>
    
    <cc>ferret@explodingferret.com</cc>

      

      
          <long_desc isprivate="0">
            <who>derk@zapville.org</who>
            <bug_when>2004-01-24 12:16:13 0000</bug_when>
            <thetext>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=&quot;\&quot;/usr/share/locale\&quot;&quot; -DLOCALEDIR=&quot;\&quot;/usr/share/locale\&quot;&quot; -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=\&quot;/usr/share/locale\&quot; -DLOCALEDIR=\&quot;/usr/share/locale\&quot; -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=\&quot;/usr/share/locale\&quot; -DLOCALEDIR=\&quot;/usr/share/locale\&quot; -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=\&quot;/usr/share/locale\&quot; -DLOCALEDIR=\&quot;/usr/share/locale\&quot; -W -Wall -Wno-unused -Wno-switch -Wno-format -Werror -c disk_sun.c -o disk_sun.o &gt;/dev/null 2&gt;&amp;1
linux.c: In function `_device_get_length&apos;:
linux.c:407: error: syntax error before &apos;[&apos; 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&apos;
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted&apos;
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6&apos;
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 &apos;built in&apos; 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  &apos;[&apos; 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]) &amp;&amp; \
	  sizeof(t) &lt; (1 &lt;&lt; _IOC_SIZEBITS)) ? \
	  sizeof(t) : __invalid_size_argument_for_IOC)


perhaps defining in &apos;parted&apos; 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 &apos;make&apos; to compile parted
make  all-recursive
make[1]: Entering directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6&apos;
Making all in intl
make[2]: Entering directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/intl&apos;
make[2]: Nothing to be done for `all&apos;.
make[2]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/intl&apos;
Making all in po
make[2]: Entering directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/po&apos;
make[2]: Nothing to be done for `all&apos;.
make[2]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/po&apos;
Making all in libparted
make[2]: Entering directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted&apos;
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&apos;
make[3]: Nothing to be done for `all&apos;.
make[3]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted/fs_ext2&apos;
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&apos;
make[3]: Nothing to be done for `all&apos;.
make[3]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted/fs_fat&apos;
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&apos;
make[3]: Nothing to be done for `all&apos;.
make[3]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted/fs_hfs&apos;
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&apos;
make[3]: Nothing to be done for `all&apos;.
make[3]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted/fs_jfs&apos;
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&apos;
make[3]: Nothing to be done for `all&apos;.
make[3]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted/fs_linux_swap&apos;
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&apos;
make[3]: Nothing to be done for `all&apos;.
make[3]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted/fs_ntfs&apos;
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&apos;
make[3]: Nothing to be done for `all&apos;.
make[3]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted/fs_reiserfs&apos;
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&apos;
make[3]: Nothing to be done for `all&apos;.
make[3]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted/fs_ufs&apos;
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&apos;
make[3]: Nothing to be done for `all&apos;.
make[3]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted/fs_xfs&apos;
make[3]: Entering directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted&apos;
/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=&quot;\&quot;/usr/share/locale\&quot;&quot; -DLOCALEDIR=&quot;\&quot;/usr/share/locale\&quot;&quot; -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=\&quot;/usr/share/locale\&quot; -DLOCALEDIR=\&quot;/usr/share/locale\&quot; -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&apos;:
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&apos;
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6/libparted&apos;
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/extrabig/tmp/portage/parted-1.6.6/work/parted-1.6.6&apos;
make: *** [all-recursive-am] Error 2
 
!!! ERROR: sys-apps/parted-1.6.6 failed.
!!! Function src_compile, Line 36, Exitcode 2
!!! Make failed</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>derk@zapville.org</who>
            <bug_when>2004-01-24 17:28:50 0000</bug_when>
            <thetext>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]) &amp;&amp; \
	  sizeof(t) &lt; (1 &lt;&lt; _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]) &amp;&amp; \
	  sizeof(t) &lt; (1 &lt;&lt; _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]) &amp;&amp; \
	  sizeof(t) &lt; (1 &lt;&lt; _IOC_SIZEBITS)) ? \
	  sizeof(t) : __invalid_size_argument_for_IOC)

either works now I don&apos;t know if this is safe or not .. any thoughts 
does it by pass the whole purpose of the test ...

derk
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>ferret@explodingferret.com</who>
            <bug_when>2004-01-25 18:12:24 0000</bug_when>
            <thetext>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 &lt; or &gt;=.
...

I guess this could be fixed by removing either -W or -Werror as above, but I&apos;m
pretty sure this is a bug in asm/ioctl.h, as you&apos;ve suggested.

The second solution seems less likely to break stuff, I think.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>ferret@explodingferret.com</who>
            <bug_when>2004-01-25 20:35:37 0000</bug_when>
            <thetext>The same (original) thing occurs with sys-boot/lilo ... any chance you can have a
look at that too?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>derk@zapville.org</who>
            <bug_when>2004-01-26 11:01:51 0000</bug_when>
            <thetext>OKay for your lilo question the 
#define LVM_GET_IOP_VERSION _IOR(0xfe,0x98,1) errors since  a &apos;type&apos; is expected in the 3 arguement position   putting &quot;char&quot; here fixes the problem .. as I think a single byte is being requested .. but I haven&apos;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 &apos;byte&apos; in a arch independent way? if so it should be included and the &apos;char&apos; replaced with &apos;byte&apos; 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.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>ferret@explodingferret.com</who>
            <bug_when>2004-01-26 13:34:38 0000</bug_when>
            <thetext>Okay, well to be honest you needn&apos;t really worry about lilo working on other
arches and 64 bit architectures and such, since it won&apos;t, ever. :)</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>derk@zapville.org</who>
            <bug_when>2004-01-26 14:03:59 0000</bug_when>
            <thetext>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 .. </thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>derk@zapville.org</who>
            <bug_when>2004-01-26 14:06:37 0000</bug_when>
            <thetext>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)

</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>ferret@explodingferret.com</who>
            <bug_when>2004-01-30 12:47:28 0000</bug_when>
            <thetext>Sooo... what should be done about this? As far as I can see, linux-headers,
parted and lilo ALL need some changes...</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>vapier@gentoo.org</who>
            <bug_when>2004-01-30 14:16:23 0000</bug_when>
            <thetext>lilo has already been fixed and is a different bug, dont discuss it here please</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>derk@zapville.org</who>
            <bug_when>2004-01-30 16:08:47 0000</bug_when>
            <thetext>Sorry .. both parted and Lilo involved calls to _IOR(  ) or _IOWR(  ) masked by #define MACRO&apos;s. These actually end up calling _IOC which calls _IOC_TYPECHECK .. which is where the problems arose so .. different programs .. same mechanism </thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>vapier@gentoo.org</who>
            <bug_when>2004-02-02 06:40:32 0000</bug_when>
            <thetext>plasmaroo: can we get some linux-headers-2.6.x lovin goin on ?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>derk@zapville.org</who>
            <bug_when>2004-02-02 07:19:31 0000</bug_when>
            <thetext>Be careful .. there is only a minor .. i.e. a warning problem ... with the headers. It can be silenced with the &apos;cast&apos;. The other fixes are necessary in the programs also ..  </thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>plasmaroo@gentoo.org</who>
            <bug_when>2004-02-02 09:56:17 0000</bug_when>
            <thetext>Patched in CVS, emerge sync and it should merge fine now.</thetext>
          </long_desc>
      
    </bug>

</bugzilla>