From 473be23153aed6e04ec4d687991ce8998b2e8d5b Mon Sep 17 00:00:00 2001 From: Mike Farah Date: Sun, 15 Jan 2023 11:36:52 +1100 Subject: [PATCH] Log info message when unable to chown file #1521 --- pkg/yqlib/chown_linux.go | 9 ++++++++- release_notes.txt | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/pkg/yqlib/chown_linux.go b/pkg/yqlib/chown_linux.go index 3913662b..174a7948 100644 --- a/pkg/yqlib/chown_linux.go +++ b/pkg/yqlib/chown_linux.go @@ -12,7 +12,14 @@ func changeOwner(info fs.FileInfo, file *os.File) error { if stat, ok := info.Sys().(*syscall.Stat_t); ok { uid := int(stat.Uid) gid := int(stat.Gid) - return os.Chown(file.Name(), uid, gid) + + err := os.Chown(file.Name(), uid, gid) + if err != nil { + // this happens with snap confinement + // not really a big issue as users can chown + // the file themselves if required. + log.Info("Skipping chown: %v", err) + } } return nil } diff --git a/release_notes.txt b/release_notes.txt index 0b697eee..3cc78097 100644 --- a/release_notes.txt +++ b/release_notes.txt @@ -1,3 +1,7 @@ +4.30.8: + - Log info message when unable to chown file in linux (e.g. snap confinement) #1521 + + 4.30.7: - Fixed bug in splice operator #1511 - Fixed value operator bug #1515