Repository navigation
fix: sameRange panics on a specifier that cannot take its semver group range, and launcher exits 0 on crash - #347
Open
lavaude wants to merge 2 commits into
Conversation
…ver group range A specifier such as '*' has no version to apply a range prefix to, so get_specifier_with_preferred_semver_range() returns None. same_range.rs unwrapped it, which aborted the process. Leave such an instance as-is, as the semverRange policy already does. Signed-off-by: Edouard Lavaud <78795468+lavaude@users.noreply.github.com>
spawnSync() reports status null when the child is killed by a signal, so 'status || 0' turned a crash into a successful exit and CI checks passed without having run. Signed-off-by: Edouard Lavaud <78795468+lavaude@users.noreply.github.com>
Owner
|
Thanks a lot for this @lavaude, I think I have a fix for this waiting on the dev branch but I will check and make sure 👍 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description (What)
same_range.rs: when an instance mismatches its semver group butget_specifier_with_preferred_semver_range()returnsNone, leave it as-is (valid) instead of calling.unwrap(). This is how thesemverRangepolicy already handles the same case.npm/index.cjs: exit withstatus ?? 1instead ofstatus || 0, so a binary killed by a signal fails instead of exiting 0.Justification (Why)
Fixes #345.
A specifier such as
*(or a||union) has no version to apply a range prefix to, sowith_range()returnsNone. In asameRangegroup with a semver group, that reached.unwrap()and aborted the process:The abort is a SIGABRT (exit 134 when run directly).
spawnSync()reportsstatus: nullfor a signal, so|| 0turned the crash into a successful exit.syncpack linttherefore passed in CI without having checked anything. The launcher change makes any future crash fail the build, not only this one.Alternative considered: mark such instances unfixable (as #345 suggests). I followed
semver_range_only.rsand left the specifier alone, but that is easy to switch if you prefer reporting it.How Can This Be Tested?
cargo test same_range- the new testinstance_whose_specifier_cannot_take_its_semver_group_range_is_left_as_isfails onmainwith the panic above and passes with this change.cargo testpasses in full, andcargo clippy --all-targetsis clean.node -e "const {spawnSync}=require('child_process');const r=spawnSync('sh',['-c','kill -ABRT $$']);console.log(r.status||0, r.status??1)"prints0 1.