Re: Modified usb-devices.sh script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday 21 July 2009, Steve Calfee wrote:
> On Mon, Jul 20, 2009 at 2:07 PM, Frans Pop<elendil@xxxxxxxxx> wrote:
> > I've given your script a try, but the result was rather bad. It ate
> > all my memory and half hung the system. I was also running a kernel
> > compile at the time which may have contributed, but that still does
> > not explain.
> >
> > Eventually I was able to break out of it, but only with some
> > difficulty:
>
> Yikes, I had not seen that. I would guess that your kernel's sysfs is
> different than mine (running 2.6.24 under Ubuntu). It must be
> following some circular linked list somewhere.

I enabled all the debug print statements in your script; what I get is:
1 /busnum
2 /busnum
3 /busnum
4 /busnum
5 /busnum
6 /busnum
7 /busnum
8 /busnum
9 /busnum
10 /busnum
[... ad infinitum ...]

So it looks like it's already going wrong in the very first loop in the 
BEGIN function.

My sysfs looks fairly normal, nothing weird connected at all. And there 
are only 7 hubs listed:
$ ls -d1 /sys/bus/usb/devices/usb*
/sys/bus/usb/devices/usb1
/sys/bus/usb/devices/usb2
/sys/bus/usb/devices/usb3
/sys/bus/usb/devices/usb4
/sys/bus/usb/devices/usb5
/sys/bus/usb/devices/usb6
/sys/bus/usb/devices/usb7

This is with gawk from Debian stable ("Lenny"):
$ gawk --version
GNU Awk 3.1.5

If I run your script in Debian Unstable, it does run correctly. That has:
$ gawk --version
GNU Awk 3.1.6

So it looks as if there's either a bug in 3.1.5, or you're doing something 
that was not supported in that version. But allowing a script to run wild 
in that way is not really good programming anyway I'd say.

If you can help narrow down exactly what's wrong with 3.1.5, that would be 
appreciated. It may well be worth fixing in Debian stable. We'd probably 
need a small test script that shows the problem.

BTW, did you test what happens with your script if /sys/bus/usb/devices/ 
does not exist or when there are no hubs in it? I made sure that the 
usb-devices script included some sanity checks for those cases.

Cheers,
FJP
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux