[ENBD] enbd_ioctl 2.6.9 kernel fails to modprobe enbd - seg fault

scunacc scunacc at yahoo.com
Thu Mar 2 18:35:10 MST 2006


Dear Peter et al.,

> >  make module 2>&1 |  tail -60
> > /bin/sh: line 0: [: -ge: unary operator expected
> 
> Where's that from? Could you investigate, please? I suspect
> RH's version.h. Go back and check without the tail -60. Use strace  if
> necesary, but find that problem.
> 

Her we go:

/usr/src/linux-2.6.9-cm46/arch/i386/Makefile

-------------------

.....

GCC_VERSION                     := $(call cc-version)
cflags-$(CONFIG_REGPARM)        += $(shell if [ $(GCC_VERSION) -ge
0300 ] ; then echo "-mregparm=3"; fi ;)

.....


-------------------


Found by strace -f -s 2048 on the make

[pid  8161] open("/usr/src/linux-2.6.9-cm46/arch/i386/Makefile",
O_RDONLY|O_LARGEFILE) = 4
.....
[pid  8161] read(5,  <unfinished ...>
[pid  8168] close(6)                    = 0
[pid  8168] execve("/bin/sh", ["/bin/sh", "-c", "if [  -ge 0300 ] ; then
echo \"-mregparm=3\"; fi ;"], [/* 93 vars */]) = 0
....

[pid  8168] write(2, "/bin/sh: line 0: [: -ge: unary operator expected
n", 49/bin/sh: line 0: [: -ge: unary operator expected) = 49


Fixed with:

------------------------------
#!/bin/bash

STR=$(gcc -v 2>&1 | tail -1)
VERS=$(echo $STR | awk '{print $3}' | sed 's/\..*$//')
echo $VERS
------------------------------

as /usr/local/bin/cc-version

and
------------------------------
GCC_VERSION                     := $(shell /usr/local/bin/cc-version)
------------------------------

instead in the Makefile.

More to come on the other shortly.

Kind regards

Derek.




More information about the ENBD mailing list