Skip to content

Commit c0a6477

Browse files
committed
comparison fails if PAXRecord is nil
Signed-off-by: Martin Zihlmann <[email protected]>
1 parent bd7a3b1 commit c0a6477

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pkg/diff/diff.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,14 @@ func (d *differ) diffTarEntry(ctx context.Context, node *EventTreeNode, in [2]Ev
888888
ent0.Header.Mode &= 0x0FFF
889889
ent1.Header.Mode &= 0x0FFF
890890
}
891+
pax0 := ent0.Header.PAXRecords
892+
if pax0 == nil {
893+
pax0 = map[string]string{}
894+
}
895+
pax1 := ent1.Header.PAXRecords
896+
if pax1 == nil {
897+
pax1 = map[string]string{}
898+
}
891899
var errs []error
892900
if diff := cmp.Diff(ent0, ent1, cmpOpts...); diff != "" {
893901
ev := Event{
@@ -899,7 +907,7 @@ func (d *differ) diffTarEntry(ctx context.Context, node *EventTreeNode, in [2]Ev
899907
if err := d.raiseEvent(ctx, node, ev, "tarentry"); err != nil {
900908
errs = append(errs, err)
901909
}
902-
} else if diff := cmp.Diff(ent0.Header.PAXRecords, ent1.Header.PAXRecords, paxOpts...); diff != "" {
910+
} else if diff := cmp.Diff(pax0, pax1, paxOpts...); diff != "" {
903911
ev := Event{
904912
Type: EventTypeTarEntryMismatch,
905913
Inputs: in,

0 commit comments

Comments
 (0)