Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update go-diskfs package to 1.5.0 #3190

Merged
merged 1 commit into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
github.com/cpuguy83/go-md2man/v2 v2.0.6
github.com/cyphar/filepath-securejoin v0.4.1
github.com/digitalocean/go-qemu v0.0.0-20221209210016-f035778c97f7
github.com/diskfs/go-diskfs v1.4.1
github.com/diskfs/go-diskfs v1.5.0
github.com/docker/go-units v0.5.0
github.com/elastic/go-libaudit/v2 v2.6.1
github.com/foxcpp/go-mockdns v1.1.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ github.com/digitalocean/go-qemu v0.0.0-20221209210016-f035778c97f7 h1:3OVJAbR131
github.com/digitalocean/go-qemu v0.0.0-20221209210016-f035778c97f7/go.mod h1:K4+o74YGNjOb9N6yyG+LPj1NjHtk+Qz0IYQPvirbaLs=
github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U=
github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE=
github.com/diskfs/go-diskfs v1.4.1 h1:iODgkzHLmvXS+1VDztpW53T+dQm8GQzi20y9yUd5UCA=
github.com/diskfs/go-diskfs v1.4.1/go.mod h1:+tOkQs8CMMog6Nvljg8DGIxEXrgL48iyT3OM3IlSz74=
github.com/diskfs/go-diskfs v1.5.0 h1:0SANkrab4ifiZBytk380gIesYh5Gc+3i40l7qsrYP4s=
github.com/diskfs/go-diskfs v1.5.0/go.mod h1:bRFumZeGFCO8C2KNswrQeuj2m1WCVr4Ms5IjWMczMDk=
github.com/djherbis/times v1.6.0 h1:w2ctJ92J8fBvWPxugmXIv7Nz7Q3iDMKNx9v5ocVH20c=
github.com/djherbis/times v1.6.0/go.mod h1:gOHeRAz2h+VJNZ5Gmc/o7iD9k4wW7NMVqieYCY99oc0=
github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI=
Expand Down
7 changes: 5 additions & 2 deletions pkg/iso9660util/iso9660util.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"path/filepath"
"runtime"

"github.com/diskfs/go-diskfs/backend/file"
"github.com/diskfs/go-diskfs/filesystem"
"github.com/diskfs/go-diskfs/filesystem/iso9660"
"github.com/sirupsen/logrus"
Expand All @@ -27,6 +28,7 @@ func Write(isoPath, label string, layout []Entry) error {
return err
}

backendFile := file.New(isoFile, false)
defer isoFile.Close()

workdir, err := os.MkdirTemp("", "diskfs_iso")
Expand All @@ -39,7 +41,7 @@ func Write(isoPath, label string, layout []Entry) error {
}
logrus.Debugf("Creating iso file %s", isoFile.Name())
logrus.Debugf("Using %s as workspace", workdir)
fs, err := iso9660.Create(isoFile, 0, 0, 0, workdir)
fs, err := iso9660.Create(backendFile, 0, 0, 0, workdir)
if err != nil {
return err
}
Expand Down Expand Up @@ -81,11 +83,12 @@ func IsISO9660(imagePath string) (bool, error) {
return false, err
}
defer imageFile.Close()
backendFile := file.New(imageFile, true)

fileInfo, err := imageFile.Stat()
if err != nil {
return false, err
}
_, err = iso9660.Read(imageFile, fileInfo.Size(), 0, 0)
_, err = iso9660.Read(backendFile, fileInfo.Size(), 0, 0)
return err == nil, nil
}
Loading