From 7645051510182e6f391a76c9cf46d97751333e53 Mon Sep 17 00:00:00 2001 From: Josh Powers Date: Wed, 1 Feb 2023 08:26:10 -0700 Subject: [PATCH 1/2] fix(disk): correctly replace /dev in /dev/mapper Only replace the first instance of /dev in a /dev/mapper string. Otherwise, if an LVM group is named dev it will replace that as well. fixes: #1411 --- disk/disk_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/disk/disk_linux.go b/disk/disk_linux.go index 3911af9..b6a3adc 100644 --- a/disk/disk_linux.go +++ b/disk/disk_linux.go @@ -341,7 +341,7 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro } if strings.HasPrefix(d.Device, "/dev/mapper/") { - devpath, err := filepath.EvalSymlinks(common.HostDev(strings.Replace(d.Device, "/dev", "", -1))) + devpath, err := filepath.EvalSymlinks(common.HostDev(strings.Replace(d.Device, "/dev", "", 1))) if err == nil { d.Device = devpath } From d22f23812541b6c5cb0bdacc54f21c4e6c1edcbf Mon Sep 17 00:00:00 2001 From: Josh Powers Date: Thu, 2 Feb 2023 13:00:15 -0700 Subject: [PATCH 2/2] lint: resolve lint issues in master --- internal/common/binary.go | 1 + internal/common/common.go | 1 + 2 files changed, 2 insertions(+) diff --git a/internal/common/binary.go b/internal/common/binary.go index 446c359..5e8d43d 100644 --- a/internal/common/binary.go +++ b/internal/common/binary.go @@ -21,6 +21,7 @@ package common // high-performance serialization, especially for large data structures, // should look at more advanced solutions such as the encoding/gob // package or protocol buffers. + import ( "errors" "io" diff --git a/internal/common/common.go b/internal/common/common.go index 323402d..c1e96ca 100644 --- a/internal/common/common.go +++ b/internal/common/common.go @@ -6,6 +6,7 @@ package common // - linux (amd64, arm) // - freebsd (amd64) // - windows (amd64) + import ( "bufio" "bytes"