check.py: infinite loop due wrong handling of symbolic links
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
HPLIP |
New
|
Undecided
|
Unassigned | ||
Gentoo Linux |
Fix Released
|
Medium
|
Bug Description
Version: hplip-3.11.3a
When check.py is executed, the first call of check_file() (with argument "crypto.h") leads to an infinite loop within the recursive function utils.walkFiles(). The reason is that this function follows symbolic links to directories.
On my system the directory X contains the symbolic link "Y -> ." because X/Z and X/Y/Z shall be accessible for all entries Z without having the Zs twice on the disk. This is necessary because one program assume Z at X/Z and another program at X/Y/Z.
Anyhow, it is not a good practice to follow symbolic links at a directory descent. Because often an infinite loop starts at it is the case for check.py.
Obviously other users already had the same problem, because there is the question https:/
# if os.path.
# fullname = os.path.
When the comment chars are removed from these lines check.py works perfectly again.
check_file()
/usr/share/
walkFiles()
/usr/share/
description: | updated |
description: | updated |
summary: |
- check.py: infinite loop due wrong handling of to symbolic links + check.py: infinite loop due wrong handling of symbolic links |
description: | updated |
Changed in gentoo: | |
importance: | Unknown → Medium |
Changed in gentoo: | |
status: | Unknown → Fix Released |
Changed in gentoo: | |
status: | Fix Released → Unknown |
Changed in gentoo: | |
status: | Unknown → Fix Released |
I found the same problem in my Linux distribution (Slackware 12.0), but when I uncommented the two lines it still did not work. Turns out that in /usr/include/ seamonkey, there are 3 symbolic links: include/ seamonkey/ plugin -> . include/ seamonkey/ nss -> . include/ seamonkey/ xpcom -> .
/usr/
/usr/
/usr/
Instead, I added the following to walkFiles after the assignment of fullname:
if os.path. islink( name):
linkname = os.readlink(name); linkname) )
log.debug( "skipping link: %s (.)" % fullname)
continue
# log.debug("link: %s -> %s" % (fullname,
if linkname == ".":
This effectively skips over symbolic links that point to the current root.
This works for me. I've attached a copy of my revised utils.py.