yarn.lock v1 with a scoped alias of an unscoped package yields no packages and no error
维护者通常 1 天内回复
评估
调研方向
阅读 src/packagedcode/npm.py 中 YarnLockV1Handler.parse 里统计 @ 字符的断言附近部分。使用提供的、无 scope 包的有 scope 别名重现故障,然后检查附近的 Yarn v1 解析测试,以确定应在哪里添加覆盖。完成标准是 lockfile 能够提供包和依赖数据,且没有解析错误。
由索引模型根据 Issue 内容生成。
描述
Description
In a Yarn v1 yarn.lock, an alias whose own name is scoped and whose target is not scoped has three @:
"@jest/react-is-18@npm:react-is@^18.3.1":
version "18.3.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#..."
YarnLockV1Handler.parse asserts that a requirement starting with @ has two @ (a scoped package) or four (a scoped alias of a scoped package):
if req.startswith('@'):
# 2 = package, 4 = alias
assert req.count('@') in [2, 4]
With three, the parsing fails with an AssertionError at src/packagedcode/npm.py line 1063 and the whole lockfile is lost. Through the CLI the scan completes with no package data, no dependencies and no scan error for the file.
In a sample of 6 Yarn v1 lockfiles from well-known projects, 2 fail this way (webpack/webpack and GoogleChrome/lighthouse), both on @jest/react-is-18@npm:react-is@^18.3.1 and @jest/react-is-19@npm:react-is@^19.2.5.
How To Reproduce
- Download
yarn.lockfrom https://github.com/webpack/webpack at commit71338e24bc. - Run
scancode --package --json-pp out.json yarn.lock - In
out.json,package_datais empty for the file,dependenciesis empty andscan_errorsis empty.
Calling packagedcode.npm.YarnLockV1Handler.parse() on the file directly shows the AssertionError.
System configuration
- macOS (Apple Silicon)
- scancode-toolkit 32.5.0; the same code is on
developat e423b48a1 - installed with pip, Python 3.12
- 主要语言
- Python
- 星标
- 2.7k
- 派生
- 871
- 平均合并
- 1 天 10 小时
- 30 天内合并 PR
- 3
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
aboutcode-org/scancode-toolkit 的其他 Issue
-
package-lock.json dependencies report file_references as a list inside a list可能已有人在做 @Anbarasu2410 于 9 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 82/100
aboutcode-org/scancode-toolkit#5449 · 4 条评论 ·
维护者通常 1 天内回复
-
scancode aborts when encountering a broken RPM archive可能已有人在做 @Ashutosh-Panda2004 于 14 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 62/100
aboutcode-org/scancode-toolkit#5407 · 3 条评论 ·
维护者通常 1 天内回复
-
Four silent bugs: IsRequiredPhrase.license_expression returns None, find_in_path ignores later PATH changes, duplicate dict keys override license mappings可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭bug
难度 2/5 半天 新手友好度 65/100
aboutcode-org/scancode-toolkit#5405 · 1 条评论 ·
维护者通常 1 天内回复
-
parse_maintainer_name_email returns empty name and wrong email when string has "@" but no angle brackets可能已有人在做 @RohitSutar1823 于 15 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 84/100
aboutcode-org/scancode-toolkit#5402 ·
维护者通常 1 天内回复
-
bug: Unreachable JSON extension and format validation in validate_input_path可能已有人在做 @0Cymantek0 于 38 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
aboutcode-org/scancode-toolkit#5351 · 1 条评论 ·
维护者通常 1 天内回复
查看 aboutcode-org/scancode-toolkit 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
GoogleCloudPlatform/professional-services-data-validator#1899 ·
维护者通常 4 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
mohanraj00/entelos#200 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 68/100
-
sweep
难度 2/5 1-3 小时 新手友好度 85/100
bketelsen/truenas-mcp#77 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 86/100
sandbox-quantum/switch#2163 ·
维护者通常 1 天内回复