Bug 1350021

Summary: licensecheck invokes find with -follow
Product: [Fedora] Fedora Reporter: Jerry James <loganjerry>
Component: licensecheckAssignee: Sandro Mani <manisandro>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: rawhideCC: manisandro
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-22 19:11:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jerry James 2016-06-24 20:43:36 UTC
Description of problem:
I just started a package review.  When licensecheck ran, it reported:

find: File system loop detected; ‘./src/giac’ is part of the same file system loop as ‘./src’.
Can't close(GLOB(0x668db0)) filehandle: '' at /usr/bin/licensecheck line 387

and fedora-review has this to say:

[ ]: License field in the package spec file matches the actual license.
     Note: Cannot run licensecheck: Command 'licensecheck -r /var/lib/mock
     /fedora-rawhide-x86_64/root/builddir/build/BUILD/giac-1.2.2' returned
     non-zero exit status 1

There are two bugs here: licensecheck tries to close a file handle on line 387 even when the handle is already closed due to find exiting with an error, and licensecheck invokes find with the -follow option.

The find man page says that -follow is deprecated and -L should be used instead, by the way.  But I can't conceive of any situation where using -follow/-L is the right thing to do.  I think it should be removed, for three reasons.  Reason 1: self loops like the one in giac make find, and therefore licensecheck, fail.  Reason 2: symlinks can point anywhere.  Do you really want to let licensecheck run over arbitrary parts of the filesystem?  Reason 3: every file in a package *should* be reachable without traversing symlinks at all.  (If fedora-review doesn't have a check for that, it probably should.)

Version-Release number of selected component (if applicable):
devscripts-minimal-2.15.10-2.fc23.x86_64

but I also see this in Rawhide, which has:

devscripts-minimal-2.16.5-1.fc25.x86_64

How reproducible:
Always

Steps to Reproduce:
1. mkdir loop
2. ln -s . loop/loop
3. licensecheck -r -v loop

Actual results:
The error messages reported above, and no license output.

Expected results:
A report on licenses.

Additional info:
The filesystem type might have something to do with this.  I do NOT see this behavior if I create the loop under /tmp (tmpfs), but I do see it if the loop is under my /home directory (ext4).

Comment 1 Sandro Mani 2016-06-24 20:59:59 UTC
Reported upstream at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=828088

Comment 2 Sandro Mani 2016-07-22 19:11:37 UTC
Fixed in licensecheck-3.0.7-1.fc25