From 7df1ba5d82f7e685eb7816f94e9bc09951f29177 Mon Sep 17 00:00:00 2001 From: "John K. Luebs" Date: Thu, 5 Oct 2023 21:29:45 -0500 Subject: [PATCH] RestoreMetadata improved error messages --- src/duplicacy_entry.go | 6 +++--- src/duplicacy_utils_others.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/duplicacy_entry.go b/src/duplicacy_entry.go index 14e73ca..62dfc28 100644 --- a/src/duplicacy_entry.go +++ b/src/duplicacy_entry.go @@ -586,7 +586,7 @@ func (entry *Entry) RestoreMetadata(fullPath string, fileInfo os.FileInfo, setOw var err error fileInfo, err = os.Lstat(fullPath) if err != nil { - LOG_ERROR("RESTORE_STAT", "Failed to retrieve the file info: %v", err) + LOG_ERROR("RESTORE_STAT", "Failed to retrieve the file info on %s: %v", entry.Path, err) return false } } @@ -606,7 +606,7 @@ func (entry *Entry) RestoreMetadata(fullPath string, fileInfo os.FileInfo, setOw if !entry.IsLink() && fileInfo.Mode()&fileModeMask != entry.GetPermissions() { err := os.Chmod(fullPath, entry.GetPermissions()) if err != nil { - LOG_ERROR("RESTORE_CHMOD", "Failed to set the file permissions: %v", err) + LOG_ERROR("RESTORE_CHMOD", "Failed to set the file permissions on %s: %v", entry.Path, err) return false } } @@ -616,7 +616,7 @@ func (entry *Entry) RestoreMetadata(fullPath string, fileInfo os.FileInfo, setOw modifiedTime := time.Unix(entry.Time, 0) err := os.Chtimes(fullPath, modifiedTime, modifiedTime) if err != nil { - LOG_ERROR("RESTORE_CHTIME", "Failed to set the modification time: %v", err) + LOG_ERROR("RESTORE_CHTIME", "Failed to set the modification time on %s: %v", entry.Path, err) return false } } diff --git a/src/duplicacy_utils_others.go b/src/duplicacy_utils_others.go index 7907a0b..a91d207 100644 --- a/src/duplicacy_utils_others.go +++ b/src/duplicacy_utils_others.go @@ -38,7 +38,7 @@ func SetOwner(fullPath string, entry *Entry, fileInfo os.FileInfo) bool { if entry.UID != -1 && entry.GID != -1 { err := os.Lchown(fullPath, entry.UID, entry.GID) if err != nil { - LOG_ERROR("RESTORE_CHOWN", "Failed to change uid or gid: %v", err) + LOG_ERROR("RESTORE_CHOWN", "Failed to change uid or gid on %s: %v", entry.Path, err) return false } }