Hi,

Pretty sure this logic is now correct, ( __GLIBC__ is set by uClibc according to comment in scripts/trylink, which seems to fit my experience).

Please find patches attached.



Regards

Rich


On 11/03/14 21:40, Richard Moore wrote:
Hi,

The fault in libbb/xreadlink.c (using my situation as an example) is that when both are defined

__GLIBC__ =2
__UCLIBC__ =1

originally this would equate false but with the change, it always evaluates true as __GLIBC__ is set - (I hadn't realised on previous post as assumed __GLIBC__ would be unset if __UCLIBC__ was set.)

I presume therefore +#if defined(__GLIBC__) ||
should be +#if defined(__GLIBC__) &&



I also think I noticed a similar logic mistake in networking/ether-wake.c ,it cant be undefined yet have a version.

-#if !defined(__UCLIBC_MAJOR__) \
- || __UCLIBC_MAJOR__ > 0 \
- || __UCLIBC_MINOR__ > 9 \
- || (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ >= 30)
+#if !defined(__UCLIBC__) || UCLIBC_VERSION >= KERNEL_VERSION(0, 9, 30)

Think this should be
+#if defined(__UCLIBC__) && UCLIBC_VERSION >= KERNEL_VERSION(0, 9, 30)


I haven't submitted a patch as it may be worth another pair of eyes looking at it and the other UCLIBC changes !


Cheers

Rich




On 11/03/14 19:26, Richard Moore wrote:
Hi,

Ok solved it myself - segfaulting on line 147 of umount.c

path = xmalloc_realpath(zapit);


Looking back through the changes, this commit is breaking it, (reversing it fixes)

-#if defined(__GLIBC__) && !defined(__UCLIBC__)
+#if defined(__GLIBC__) || \
+ (defined(__UCLIBC__) && UCLIBC_VERSION >= KERNEL_VERSION(0, 9, 31))


I am using uClibc 0.9.29 , which seems to make the logic the same, as both eval false (I changed 0, 9, 31 to lower but no different)?


Cheers

Rich


On 09/03/14 12:44, Richard Moore wrote:
Hi,

umount has started segfaulting since >= 1.22.0 , (1.21.1 and earlier all ok).

Mount and everything else is fine. I am cross compiling with MIPS (uClibc) , this is the (not very helpful) strace.


open("/proc/mounts", O_RDONLY)          = 3
ioctl(3, TIOCNXCL, 0x7fd96b68) = -1 ENOTTY (Inappropriate ioctl for device)
brk(0x4c9000)                           = 0x4c9000
read(3, "rootfs / rootfs rw 0 0\n/dev/root / squashfs ro 0 0\nproc /proc proc rw 0 0\nsysfs /sys sysfs rw 0 0\ntmpfs /tmp tmpfs rw 0 0\ntmpfs /media tmpfs rw 0 0\ntmpfs /dev tmpfs rw 0 0\nnone /proc/bus/usb usbfs rw 0 0\n/dev/mtdblock18 /tmp/mnt/storage jffs2 rw 0 0\n/dev/sda1 /media/500GB ext3 rw,data=ordered 0 0\n", 4096) = 298
read(3, "", 4096)                       = 0
close(3)                                = 0
readlink("/dev", 0x7fd94c18, 4095)      = -1 EINVAL (Invalid argument)
readlink("/dev/sda1", 0x7fd94c18, 4095) = -1 EINVAL (Invalid argument)
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0} ---
+++ killed by SIGSEGV +++
Segmentation fault


Cheers!



Regards

Rich
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox



_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox



_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

--- busybox-1.22.1/networking/ether-wake.c.orig	2014-01-09 18:15:44.000000000 +0000
+++ busybox-1.22.1/networking/ether-wake.c	2014-03-11 21:48:43.508326968 +0000
@@ -121,7 +121,7 @@
 	eap = ether_aton_r(hostid, eaddr);
 	if (eap) {
 		bb_debug_msg("The target station address is %s\n\n", ether_ntoa(eap));
-#if !defined(__UCLIBC__) || UCLIBC_VERSION >= KERNEL_VERSION(0, 9, 30)
+#if defined(__UCLIBC__) && UCLIBC_VERSION >= KERNEL_VERSION(0, 9, 30)
 	} else if (ether_hostton(hostid, eaddr) == 0) {
 		bb_debug_msg("Station address for hostname %s is %s\n\n", hostid, ether_ntoa(eaddr));
 #endif
--- busybox-1.22.1/libbb/xreadlink.c.orig	2014-03-12 09:00:22.461220185 +0000
+++ busybox-1.22.1/libbb/xreadlink.c	2014-03-12 09:01:06.429220034 +0000
@@ -108,8 +108,8 @@
 
 char* FAST_FUNC xmalloc_realpath(const char *path)
 {
-#if defined(__GLIBC__) || \
-    (defined(__UCLIBC__) && UCLIBC_VERSION >= KERNEL_VERSION(0, 9, 31))
+#if defined(__GLIBC__) && \
+    (!defined(__UCLIBC__) || UCLIBC_VERSION >= KERNEL_VERSION(0, 9, 31))
 	/* glibc provides a non-standard extension */
 	/* new: POSIX.1-2008 specifies this behavior as well */
 	return realpath(path, NULL);
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to