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

snap/unsquashfs: pass -xattrs-include ^user. #14906

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions snap/squashfs/squashfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func (s *Snap) Unpack(src, dstDir string) error {
usw := newUnsquashfsStderrWriter()

var output bytes.Buffer
cmd := exec.Command("unsquashfs", "-n", "-f", "-d", dstDir, s.path, src)
cmd := exec.Command("unsquashfs", "-xattrs-include", "^user.", "-n", "-f", "-d", dstDir, s.path, src)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not supported by old versions of unsquashfs. We will need to see if we can drop all xattrs or if we need more elaborate logic.

cmd.Stderr = io.MultiWriter(&output, usw)
if err := cmd.Run(); err != nil {
return fmt.Errorf("cannot extract %q to %q: %v", src, dstDir, osutil.OutputErr(output.Bytes(), err))
Expand Down Expand Up @@ -234,7 +234,7 @@ func (s *Snap) withUnpackedFile(filePath string, f func(p string) error) error {
defer os.RemoveAll(tmpdir)

unpackDir := filepath.Join(tmpdir, "unpack")
if output, err := exec.Command("unsquashfs", "-n", "-i", "-d", unpackDir, s.path, filePath).CombinedOutput(); err != nil {
if output, err := exec.Command("unsquashfs", "-xattrs-include", "^user.", "-n", "-i", "-d", unpackDir, s.path, filePath).CombinedOutput(); err != nil {
return fmt.Errorf("cannot run unsquashfs: %v", osutil.OutputErr(output, err))
}

Expand Down Expand Up @@ -419,7 +419,7 @@ func (s *Snap) Walk(relative string, walkFn filepath.WalkFunc) error {
// ListDir returns the content of a single directory inside a squashfs snap.
func (s *Snap) ListDir(dirPath string) ([]string, error) {
output, stderr, err := osutil.RunSplitOutput(
"unsquashfs", "-no-progress", "-dest", "_", "-l", s.path, dirPath)
"unsquashfs", "-xattrs-include", "^user.", "-no-progress", "-dest", "_", "-l", s.path, dirPath)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need it with -l

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, probably not, that was overeager.

if err != nil {
return nil, osutil.OutputErrCombine(output, stderr, err)
}
Expand Down Expand Up @@ -640,7 +640,7 @@ func BuildDate(path string) time.Time {
N: 1,
}

cmd := exec.Command("unsquashfs", "-n", "-s", path)
cmd := exec.Command("unsquashfs", "-xattrs-include", "^user.", "-n", "-s", path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here with -s?

cmd.Env = []string{"TZ=UTC"}
cmd.Stdout = m
cmd.Stderr = m
Expand Down
Loading