Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when there's sub-directory under rcs & sccs directory #1422

Open
lekhoa88 opened this issue Mar 6, 2019 · 4 comments
Open

Error when there's sub-directory under rcs & sccs directory #1422

lekhoa88 opened this issue Mar 6, 2019 · 4 comments

Comments

@lekhoa88
Copy link

lekhoa88 commented Mar 6, 2019

Description

When I scan a directory sccs(or rcs) with sub-directory(such as rcs/a), the scan scan fails with keyerror.
Note 1: I've scanned a git directory with .git & it works without error.
Note 2: when I comment out '/rcs' and '/sccs' in src/commoncode/ignore.py, there's no error.

[khoale:~/workspace/test]> mkdir sccs
[khoale:~/workspace/test]> mkdir sccs/a
[khoale:~/workspace/test]> /usr2/khoale/scancode-toolkit-3.0.2/scancode -clp --verbose --json-pp - /usr2/khoale/workspace/test
 Setup plugin: output:json-pp...
 Setup plugin: scan:packages...
 Setup plugin: scan:copyrights...
 Setup plugin: scan:licenses...
Collect file inventory...
ERROR: failed to collect codebase at: '/usr2/khoale/workspace/test'
Traceback (most recent call last):
  File "/usr2/khoale/scancode-toolkit-3.0.2/src/scancode/cli.py", line 707, in scancode
    max_in_memory=max_in_memory
  File "/khoale/scancode-toolkit-3.0.2/src/scancode/resource.py", line 280, in __init__
    self._populate()
  File "/usr2/khoale/scancode-toolkit-3.0.2/src/scancode/resource.py", line 439, in _populate
    parent = parent_by_loc.pop(top)
KeyError: '/usr2/khoale/workspace/test/sccs/a'

System configuration

For bug reports, it really helps us to know:

  • What OS are you running on? Linux / Ubuntu 16.04 LTS ; python 2.7.3
  • What version of scancode-toolkit was used to generate the scan file? scancode-toolkit-3.0.2/
  • What installation method was used to install/run scancode? (pip/source download/other)
    Download from release git release page & unzip
@pombredanne
Copy link
Member

@lekhoa88 thank you ++ for this bug report! that's a nasty one alright :|

@pombredanne
Copy link
Member

Would you care to submit a PR? I think the fix is not to remove the ignore entries, but rather to remove the */ prefix and just keep SCCS and RCS here https://github.com/nexB/scancode-toolkit/blob/887ae131c3809a6a002267eebf8f2d5e817499f9/src/commoncode/ignore.py#L198

pombredanne added a commit that referenced this issue Mar 7, 2019
Signed-off-by: Philippe Ombredanne <[email protected]>
pombredanne added a commit that referenced this issue Aug 30, 2019
Signed-off-by: Philippe Ombredanne <[email protected]>
pombredanne added a commit that referenced this issue Aug 30, 2019
Signed-off-by: Philippe Ombredanne <[email protected]>
@pombredanne
Copy link
Member

@lekhoa88 This was fixed (a long while agao) by @JonoYang in aboutcode-org/commoncode@641150b
Closing now. Thanks again.

pombredanne added a commit to aboutcode-org/commoncode that referenced this issue Jun 11, 2021
@pombredanne
Copy link
Member

Actually I also pushed some extra fixes in aboutcode-org/commoncode#24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants