Skip to content

0.6.2: okrun opens a relative image name that climbs (..) - #38

Merged
Sunrisepeak merged 1 commit into
mainfrom
run/locate-relative-ascent
Nov 11, 2026
Merged

Sunrisepeak merged 1 commit into
mainfrom
run/locate-relative-ascent

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Member

A relative image name that climbs -- ../image, from a working directory below the one holding it -- failed with cannot be opened on every system, while the same name spelled absolutely or relative without ascent opened. The cause is a seam between two rules, not a defect in either: the fs interface accepts no name whose components ascend (a capability constraint its conformance suite states), and okrun's own lookup stripped only a leading ./ prefix before handing the name over, so .. reached the interface unchanged.

The fix folds a relative name lexically against the absolute name of the working directory's preopen and then runs the same longest-prefix match an absolute name takes; symlinks stay unresolved exactly as before, and a name that climbs past the namespace root keeps the existing error path. The fs rule itself is untouched.

  • run/src/run.cpp: the relative branch of the lookup folds seg/.. and . before prefix matching
  • ci.yml: the run job's regression step executes an image through ../../ from a directory two levels below it
  • version 0.6.2, all four manifests; README states the boundary in one sentence

Measured before: the failing form returns 127 with okrun: ../x.oke cannot be opened. After: the same invocation runs the image, and ./x, nested ../../x, absolute and plain relative names keep their behaviour; a climbing name that escapes every preopen still reports cannot-be-opened.

A relative name was passed to the file system as it stood, and an openkal
name admits no `..' component, so okrun refused an image named above the
working directory (`../image.oke'; `./image.oke' and an absolute name
opened). The runner folds a relative name against the first directory's
name --- `..' and `.' lexically, a symlink left to the file system --- into
the absolute name beneath it, then matches it against the supplied
directories' names exactly as an absolute one is matched. A name that
climbs past the root of the tree, or one beneath no directory, names
nothing, as before. Every member is 0.6.2.
@Sunrisepeak
Sunrisepeak merged commit 7fa8684 into main Nov 11, 2026
6 checks passed
@Sunrisepeak
Sunrisepeak deleted the run/locate-relative-ascent branch November 11, 2026 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant