Skip to content

iso9660: expose rich metadata via FileInfo.Sys()#394

Merged
deitch merged 2 commits into
diskfs:masterfrom
luthermonson:iso9660-expose-metadata
May 15, 2026
Merged

iso9660: expose rich metadata via FileInfo.Sys()#394
deitch merged 2 commits into
diskfs:masterfrom
luthermonson:iso9660-expose-metadata

Conversation

@luthermonson
Copy link
Copy Markdown
Contributor

Refs #301. Sibling of #393 (ext4) — same pattern, applied to iso9660.

What this does

filesystem/iso9660/directoryEntry.Sys() previously returned *RockRidgeInfo when Rock Ridge extensions were present on the entry, otherwise nil. That was a partial answer to #301: callers could only see uid/gid/mode/symlink, only on Rock Ridge ISOs, and the plain ISO9660 metadata (extent location, volume sequence, hidden flag, etc.) was invisible.

This PR replaces RockRidgeInfo with a richer iso9660.StatT that Sys() always returns, carrying both the plain ISO9660 directory-entry fields and the Rock Ridge fields when present.

Fields

Source Field
ISO9660 directory entry ExtAttrSize uint8
Location uint32 (extent LBA)
VolumeSequence uint16
IsHidden bool
IsAssociated bool
HasExtendedAttrs bool
HasOwnerGroupPermissions bool
Rock Ridge PX record UID uint32
GID uint32
NLink uint32
Inode uint32
Rock Ridge SL record LinkTarget string
(any RR record found) RockRidge bool

RR fields are zero-valued / RockRidge=false on non-RR ISOs.

Breaking change — RockRidgeInfo removed

RockRidgeInfo was added recently (in #353) and exported, so removing it is a breaking change. In-repo callers in 4 test files are updated as part of this PR. External callers will need to switch:

// before
if rri, ok := info.Sys().(*iso9660.RockRidgeInfo); ok {
    fmt.Println(rri.Symlink, rri.UID)
}

// after
if st, ok := info.Sys().(*iso9660.StatT); ok && st.RockRidge {
    fmt.Println(st.LinkTarget, st.UID)
}

The alternative — keeping RockRidgeInfo alongside the new StatT — would have left two competing return types for Sys() and split the metadata model in two. Given that RockRidgeInfo is fresh (one release) and only covers a subset of what callers actually want, supersession seems cleaner than coexistence. Open to keeping it as a deprecated alias if reviewers prefer.

Tests

New TestSysStatT (plain ISO via testdata/9660.iso) and TestSysStatTRockRidge (RR ISO via testdata/rockridge.iso). Existing Rock Ridge tests (combined_xorriso_test.go, finalize_test.go, rockridge_xorriso_test.go) updated to assert on *StatT instead of *RockRidgeInfo.

Returns a *StatT from directoryEntry.Sys() carrying ISO9660 fields
(ExtAttrSize, Location, VolumeSequence, IsHidden, IsAssociated,
HasExtendedAttrs, HasOwnerGroupPermissions) and, when present, Rock
Ridge fields parsed from PX and SL records (UID, GID, NLink, Inode,
LinkTarget, RockRidge).

Refs diskfs#301
@deitch
Copy link
Copy Markdown
Collaborator

deitch commented May 14, 2026

This is fine and makes sense. I have no issue with deprecating RockRidgeInfo. Once again, go module structure makes life easier.

2 issues:

  1. This is still marked as draft; is it ready?
  2. My only request - and it is minor - is that the member func func (de *directoryEntry) statT() *StatT is in fileinfo.go rather than in directoryentry.go. I know, there is no "law" that requires all members to be in a single file, and we probably have places where there are so many member funcs that we had to split it, but I don't think that is the case here, so would rather have it in directoryentry.go with the struct and the other funcs. I don't care if we leave fileinfo.go with just the type StatT struct in it and nothing else, or move that into directoryentry.go.

@luthermonson luthermonson marked this pull request as ready for review May 14, 2026 18:29
@luthermonson
Copy link
Copy Markdown
Contributor Author

I will address your feedback later tonight

Per review feedback, keep the directoryEntry method alongside the
type's other methods. StatT struct stays in fileinfo.go.
@luthermonson
Copy link
Copy Markdown
Contributor Author

Moved statT() into directoryentry.go next to Sys() in a212379. Left the StatT struct in fileinfo.go (the second of the two options you offered). Ready for another look.

@deitch deitch merged commit 82055b4 into diskfs:master May 15, 2026
20 checks passed
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.

2 participants