From 69469e06ed4078b86ad73012686dc576226aef9a Mon Sep 17 00:00:00 2001 From: Adam Hughes Date: Thu, 15 Jul 2021 14:44:39 +0000 Subject: [PATCH 1/2] fix: deprecate UID/Gid in Descriptor type --- pkg/sif/sif.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/sif/sif.go b/pkg/sif/sif.go index 08f8d0ac..b63ef81d 100644 --- a/pkg/sif/sif.go +++ b/pkg/sif/sif.go @@ -309,8 +309,8 @@ type Descriptor struct { Ctime int64 // image creation time Mtime int64 // last modification time - UID int64 // system user owning the file - Gid int64 // system group owning the file + UID int64 // Deprecated: UID exists for historical compatibility and should not be used. + Gid int64 // Deprecated: Gid exists for historical compatibility and should not be used. Name [DescrNameLen]byte // descriptor name (string identifier) Extra [DescrMaxPrivLen]byte // big enough for extra data below } From 07e0151008f7266e939ddfc17088468d5dda48c8 Mon Sep 17 00:00:00 2001 From: Adam Hughes Date: Thu, 15 Jul 2021 16:07:08 +0000 Subject: [PATCH 2/2] fix: remove UID/GID from descriptor info output. These are now deprecated. Remove from human-readable output to reflect the change. --- pkg/sif/fmt.go | 2 -- pkg/sif/testdata/TestFileImage_FmtDescrInfo/One.golden | 2 -- pkg/sif/testdata/TestFileImage_FmtDescrInfo/Three.golden | 2 -- pkg/sif/testdata/TestFileImage_FmtDescrInfo/Two.golden | 2 -- 4 files changed, 8 deletions(-) diff --git a/pkg/sif/fmt.go b/pkg/sif/fmt.go index ee077e54..1e246791 100644 --- a/pkg/sif/fmt.go +++ b/pkg/sif/fmt.go @@ -134,8 +134,6 @@ func (fimg *FileImage) FmtDescrInfo(id uint32) string { s += fmt.Sprintln(" Filelen: ", v.Filelen) s += fmt.Sprintln(" Ctime: ", time.Unix(v.Ctime, 0).UTC()) s += fmt.Sprintln(" Mtime: ", time.Unix(v.Mtime, 0).UTC()) - s += fmt.Sprintln(" UID: ", v.UID) - s += fmt.Sprintln(" Gid: ", v.Gid) s += fmt.Sprintln(" Name: ", trimZeroBytes(v.Name[:])) switch v.Datatype { case DataPartition: diff --git a/pkg/sif/testdata/TestFileImage_FmtDescrInfo/One.golden b/pkg/sif/testdata/TestFileImage_FmtDescrInfo/One.golden index b3a1b2a1..ca87be68 100644 --- a/pkg/sif/testdata/TestFileImage_FmtDescrInfo/One.golden +++ b/pkg/sif/testdata/TestFileImage_FmtDescrInfo/One.golden @@ -8,6 +8,4 @@ Descr slot#: 0 Filelen: 62 Ctime: 2018-08-14 07:45:59 +0000 UTC Mtime: 2018-08-14 07:45:59 +0000 UTC - UID: 1002 - Gid: 1002 Name: busybox.deffile diff --git a/pkg/sif/testdata/TestFileImage_FmtDescrInfo/Three.golden b/pkg/sif/testdata/TestFileImage_FmtDescrInfo/Three.golden index b5e8d489..fe74b1a9 100644 --- a/pkg/sif/testdata/TestFileImage_FmtDescrInfo/Three.golden +++ b/pkg/sif/testdata/TestFileImage_FmtDescrInfo/Three.golden @@ -8,8 +8,6 @@ Descr slot#: 2 Filelen: 955 Ctime: 2018-08-14 07:47:36 +0000 UTC Mtime: 2018-08-14 07:47:36 +0000 UTC - UID: 1002 - Gid: 1002 Name: part-signature Hashtype: SHA384 Entity: 9F2B6C36D999A3E91CB3104720671590C12D4222 diff --git a/pkg/sif/testdata/TestFileImage_FmtDescrInfo/Two.golden b/pkg/sif/testdata/TestFileImage_FmtDescrInfo/Two.golden index 5a06db48..e18e9a57 100644 --- a/pkg/sif/testdata/TestFileImage_FmtDescrInfo/Two.golden +++ b/pkg/sif/testdata/TestFileImage_FmtDescrInfo/Two.golden @@ -8,8 +8,6 @@ Descr slot#: 1 Filelen: 704512 Ctime: 2018-08-14 07:45:59 +0000 UTC Mtime: 2018-08-14 07:45:59 +0000 UTC - UID: 1002 - Gid: 1002 Name: busybox.squash Fstype: Squashfs Parttype: *System