read_code answers path_outside_root for a missing file whose directory does not exist #578
Labels
No labels
code-review
correctness
dos
performance
security
severity/high
severity/low
severity/medium
tech-debt
Kind/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
h-dv/code-index#578
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found by the lead while reviewing a lane of the v0.41.51 train; reproduced on the installed release, 0.41.50 (
3d0a584c), in this repository.Reproduction:
Actual: the first answers
file_not_readable("No readable file at that path. …"), which is right. The second and third answerpath_outside_rootwith the hint "Paths must be project-relative with no absolute or..components." Both paths are project-relative and contain no...Cause: containment is decided by canonicalizing the parent directory; when that fails because the directory is missing, the failure is reported as a containment violation. #568 fixed the same confusion for reads with
rev; the working-tree read still has it. A path component longer than the filesystem's name limit takes the same route.Expected: a path that is lexically inside the root and does not exist answers
file_not_readable, whatever part of it is missing. Containment is still decided on what exists: the deepest existing ancestor is canonicalized, and if it leaves the root (a symlinked directory pointing outside) the answer stayspath_outside_root.Impact: an agent that guesses a path in a directory that does not exist is told its path is malformed, not that the file is missing, and the hint points it away from
list_files. Whetherfile_outline,get_dependencies,list_filesandindex_coverageshare the refusal is being checked in the lane that fixes this.Released in v0.41.52 (
7fc7fb20, release run 8656, 15 assets). Verified on the installed Linux x86_64 binaries (code-index 0.41.52 (7fc7fb20)):read_codetargetsrc/missing.rsfile_not_readablenope/missing.rs(directory does not exist)file_not_readablesrc/nope/deeper/missing.rsfile_not_readableCargo.toml/x(a file used as a directory)file_not_readablepath_outside_rootpath_outside_root