--- Comment #5 from Martin von Wittich ( ---
(In reply to Zhang Rui from comment #3)
> I don't know what the python error means.

Sorry for not clarifying this; I'll try to explain. The code crashes at this

  File "/usr/lib/python2.6/", line 60, in <lambda>
    names = filter(lambda x: x[0] != '.', names)

Here you can see line 60 of of python2.6:

The code essentially loops through the array "names", which contains all
filenames that have been generated by `os.listdir("/sys/firmware/acpi/tables")`
(l. 56). It checks if the current filename begins with "." (which would
indicate a hidden file). If the glob pattern begins with a ".", then it will
only return filenames beginning with ".", and if the pattern doesn't, it will
only return filenames not beginning with ".". Standard glob behaviour so far :)

Unfortunately, the `names` array contains an empty string, ie it looks like

names = ["", "APIC", "BOOT", ... ]

The code crashes as soon as it tries to extract the first character of "" (the
`x[0]` in the code), because the string doesn't contain any characters. As far
as I know, empty filenames aren't allowed on Linux (can't find any
documentation on this though, maybe I'm wrong?), so I'd argue that this is a
kernel bug and not a Python bug.

> what's the output of following bash code?

I don't currently have access to the machine because it is a notebook on a
remote customer site; I would have to ask the customer to boot it for me,
because I can't wake it up remotely :/

> for table in $(ls /sys/firmware/acpi/tables)
> do
>    if [ -d $table ]
>    then
>        echo found directory: $table
>        continue
>    else
>        echo found file: $table
>    fi
> done
> you may also run similar code to dump the file names under
> /sys/firmware/acpi/tables/data/ and /sys/firmware/acpi/tables/dynamic/

I'm sorry, but I do not see how this code would be any help in the current
situation. `ls` will just print an empty string for the unnamed folder that is
causing this issue, and the word splitting of the shell would then eat that;
the `for` loop will only ever see the valid entries of
`/sys/firmware/acpi/tables`. The `ls` output in my original posting contains
all the information that this code could gather.

(Also, it would work only after `cd`'ing to `/sys/firmware/acpi/tables`, and
parsing `ls` is always a mistake ;) )

You are receiving this mail because:
You are watching the assignee of the bug.
Check out the vibrant tech community on one of the world's most
engaging tech sites,!
acpi-bugzilla mailing list

Reply via email to