overwrite_existing: false
is not documented to allow +x be set
#1787
Labels
acknowledged
an issue is accepted as shortcoming to be fixed
Current behavior 😯
In
gix_worktree_state::checkout::options
,destination_is_initially_empty
andoverwrite_existing
are documented as:gitoxide/gix-worktree-state/src/checkout/mod.rs
Lines 50 to 58 in 8d84818
This is technically consistent with the behavior (mentioned in the PoC and Impact sections of GHSA-fqmf-w4xh-33rh, but not part of that vulnerability and not changed in #1764) that:
destination_is_initially_empty: false
, executable permissions can be added to preexisting files, regardless of the value ofoverwrite_existing
.destination_is_initially_empty: false
andoverwrite_existing: false
, executable permissions can be added to preexisting files whose contents would also change if the same checkout were done withoverwrite_existing: true
. That is, a combination of content and permissions that didn't exist in the repository can easily arise, with all options set to the default, in the presence of preexisting files.However, this seems unintuitive, so I think it should be documented for at least one of those options in the documentation comment, probably for
overwrite_existing
.In case this behavior is actually going to change soon, which might imaginably occur depending on what approach is taken for #1783 and #1784, for now I'm opening this issue rather than a PR to change the documentation.
Expected behavior 🤔
See above.
Git behavior
Not directly applicable, because Git doesn't have these specific options. However,
overwrite_existing: true
is documented to cause a checkout similar in kind togit checkout --force
. Whengit checkout
is run without--force
under a circumstance where--force
would be needed to change contents, it likewise declines to change executable permissions.Steps to reproduce 🕹
Although this issue is distinct from GHSA-fqmf-w4xh-33rh and from #1784, the procedures to reproduce either of them, with any recent version of
gix-worktree-state
and other crates, will also show thatoverwrite_existing
can befalse
and a nonexclusive checkout still changes permissions (+x
).The text was updated successfully, but these errors were encountered: