fix(ptx-schedule): refuse decisions-json paths that overwrite PTX - #1350
Open
YeonwooSung wants to merge 2 commits into
Open
YeonwooSung wants to merge 2 commits into
YeonwooSung wants to merge 2 commits into
Conversation
Reject a --decisions-json path that canonicalizes to the input PTX or to --output before either file is written. In-place PTX rewrite stays allowed when the JSON report is a different file. Signed-off-by: YeonwooSung <neos960518@gmail.com>
…schedule-decisions-json-clobber
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.
Fixes #1318.
ptx-schedulewrote--outputand then--decisions-jsonwithout checking whether those destinations were the same file. An exact path match, a./or../alias, or a decisions path equal to the input PTX exited successfully and left the JSON report where the PTX belonged. The success summary still claimed the perturbation had been written.The CLI now canonicalizes the decisions path against the input and
--outputbefore either write. A collision exits non-zero and leaves existing bytes unchanged, including the input file. In-place PTX rewrite (inputand--outputare the same path) is still allowed when the JSON path is a different file.CLI coverage in
crates/ptx-schedule/tests/cli.rs:--decisions-json/--outputcollision, including a pre-existing output file left untouched./and../aliases of the same output file./input.ptxalias, with input bytes unchanged and--outputnot created--outputequal to the input with a distinct decisions JSON file