Skip to content

Accept an index from anywhere in 'mtree' - #426

Merged
folbricht merged 2 commits into
masterfrom
fix-mtree-index-location
Sep 3, 2026
Merged

folbricht merged 2 commits into
masterfrom
fix-mtree-index-location

Conversation

@folbricht

Copy link
Copy Markdown
Owner

The input was handed to os.Stat before anything looked at whether it was meant to be an index, so mtree -i only ever accepted a local file. desync mtree -i -s store - and an index named by URL both failed with no such file or directory, while every other command that reads an index takes both — untar -i with the same URL works.

The index case is now handled first and its location handed to the index store; the filesystem is only consulted for a catar or a directory, which are always local. The friendly message for -i on a directory is kept.

The #mtree v1.0 header used to be written before any of this, so a failure left a header on stdout with nothing under it. Nothing is written now until the input is known to be readable.

Based on #425, which touches the same function; the diff shown here is just this change.

Base automatically changed from fix-mtree-tarerr-race to master September 3, 2026 10:57
The input was passed to os.Stat before anything looked at whether it was
meant to be an index, so 'mtree -i' only ever accepted a local file.
'mtree -i -s store -' and an index named by URL both failed with "no such
file or directory", where every other command reading an index takes
both.

Handle the index case first and hand the location to the index store, and
only go to the filesystem for a catar or a directory, which are always
local. The friendly message for '-i' on a directory is kept.

The mtree header is no longer written before the input is known to be
readable, so a failure doesn't leave one on stdout with nothing under it.
@folbricht
folbricht force-pushed the fix-mtree-index-location branch from d6fac2e to 3968813 Compare September 3, 2026 11:17
@folbricht
folbricht merged commit 0b72d29 into master Sep 3, 2026
9 checks passed
@folbricht
folbricht deleted the fix-mtree-index-location branch September 3, 2026 11:53
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

⌂ 换网址