Fixes #4581: Failure to scan cargo #4582
Fixes #4581: Failure to scan cargo #4582AyanSinhaMahapatra merged 6 commits intoaboutcode-org:developfrom
Conversation
|
@AyanSinhaMahapatra review this please !! |
|
@AyanSinhaMahapatra sure I ll add the required test in the test suite !! |
|
@AyanSinhaMahapatra i added the test please review !!
here i used the same cargo.toml file this https://raw.githubusercontent.com/cesarb/constant_time_eq/refs/heads/main/Cargo.toml mentioned in the issue |
| [dev-dependencies] | ||
| criterion = { version = "0.5.1", features = ["cargo_bench_support", "html_reports"] } | ||
| count_instructions = "0.2.0" | ||
|
|
There was a problem hiding this comment.
Could you shorten this test file by getting rid of everything below the dev-dependencies as we ignore this anyway as they are not useful info? We keep test files as small as possible to reduce repo size
There was a problem hiding this comment.
@AyanSinhaMahapatra yaa actually i followed the same cargo.toml which is in the issue also before adding i looked in other cargo.toml and there is features and everything so i just added this one without any type of annotation
will be making this shorter !!
b755a2f to
9c3b77f
Compare
Signed-off-by: Om Santosh Suneri <[email protected]>
Signed-off-by: Om Santosh Suneri <[email protected]>
Signed-off-by: Om Santosh Suneri <[email protected]>
Signed-off-by: Om Santosh Suneri <[email protected]>
9c3b77f to
b09b68b
Compare
Signed-off-by: Om Santosh Suneri <[email protected]>
|
@AyanSinhaMahapatra please review i had refactored the test and shortened the cargo.toml along with the full package scan cargo.toml.expected
|
tests/packagedcode/data/cargo/cargo_toml/single-file-scan/Cargo.toml.expected
Outdated
Show resolved
Hide resolved
Signed-off-by: Om Santosh Suneri <[email protected]>
3679f02 to
58e2e2b
Compare
AyanSinhaMahapatra
left a comment
There was a problem hiding this comment.
LGTM! Thanks @omsuneri
Merging!
| @@ -0,0 +1,126 @@ | |||
| { | |||
| "packages": [], | |||
There was a problem hiding this comment.
I just noticed, we are not returning top-level packages for single-manifest cargo scans, which is not right. This isn't introduced by your changes of course but is a bug which was present already.
There was a problem hiding this comment.
I will fix this in a seperate PR as this requires a bit more looking into use of assembly elsewhere.


Issue :
Fixes #4581
Changes made :
cargo.pyadded proper null check before accessing
.pathon parent resourceadded fallback to use
os.path.dirname(resource.path)when no parent existsnpm.pycode was calling .parent() twice instead of reusing the result
after making changes i passed the same cargo.toml file in the scancode and the error is resolved.
before changes result.json:
after changes result.json: