anchore / grant

Search an SBOM for licenses and the packages they belong to
Apache License 2.0
65 stars 6 forks source link

"[0090] ERROR unable to classify license: unable to read" on symlink #70

Open popey opened 6 months ago

popey commented 6 months ago

:wave:

I pointed grant at a folder, a mounted squashfs file, distributed from an app store (specifically the alacrity desktop terminal software package from the snap store). Partway through the license check, it fails with:

[0090] ERROR unable to classify license: unable to read "/snap/alacritty/current/usr/share/doc/libncursesw6": read /snap/alacritty/current/usr/share/doc/libncursesw6: is a directory

/snap/alacritty/current/usr/share/doc/libncursesw6 is actually just a symlink to a directory.

alan@ziggy:~$ ls -ld /snap/alacritty/current/usr/share/doc/libncursesw6
lrwxrwxrwx 1 root root 9 May 16  2023 /snap/alacritty/current/usr/share/doc/libncursesw6 -> libtinfo6
alan@ziggy:~$ ls -ld /snap/alacritty/current/usr/share/doc/libtinfo6
drwxr-xr-x 2 root root 70 Feb 21 17:02 /snap/alacritty/current/usr/share/doc/libtinfo6
alan@ziggy:~$ ls -l /snap/alacritty/current/usr/share/doc/libtinfo6
total 10
-rw-r--r-- 1 root root 2334 May 16  2023 changelog.Debian.gz
-rw-r--r-- 1 root root 4670 Jan 16  2022 copyright
-rw-r--r-- 1 root root 2383 Jan 16  2022 FAQ

Steps to reproduce:

  1. On a system which supports snap (such as Ubuntu), install alacritty

sudo snap install alacritty

(it's a classic (unconfined) snap, so it will need --classic passed on the above command)

  1. Run grant against the installed application

grant check /snap/alacritty/current/

Expected results

I'd expect grant to follow the symlink.

Actual results

An error is displayed:

[0090] ERROR unable to classify license: unable to read "/snap/alacritty/current/usr/share/doc/libncursesw6": read /snap/alacritty/current/usr/share/doc/libncursesw6: is a directory

spiffcs commented 6 months ago

@popey Thanks for the report here! I'll also check this and see why the sym link is not being handled correctly