@@ -865,10 +865,17 @@ func (d *differ) diffTarEntries(ctx context.Context, node *EventTreeNode, in [2]
865
865
866
866
func (d * differ ) diffTarEntry (ctx context.Context , node * EventTreeNode , in [2 ]EventInput ) (dirsToBeRemovedIfEmpty []string , retErr error ) {
867
867
var negligibleTarFields []string
868
+ var negligiblePAXFields map [string ]struct {}
868
869
if d .o .IgnoreTimestamps {
869
870
negligibleTarFields = append (negligibleTarFields , "ModTime" , "AccessTime" , "ChangeTime" , "PAXRecords" )
871
+ negligiblePAXFields = map [string ]struct {}{"mtime" : {}, "atime" : {}, "ctime" : {}}
872
+ }
873
+ discardFunc := func (k , _ string ) bool {
874
+ _ , ok := negligiblePAXFields [k ]
875
+ return ok
870
876
}
871
877
cmpOpts := []cmp.Option {cmpopts .IgnoreUnexported (TarEntry {}), cmpopts .IgnoreFields (tar.Header {}, negligibleTarFields ... )}
878
+ paxOpts := []cmp.Option {cmpopts .IgnoreMapEntries (discardFunc )}
872
879
ent0 , ent1 := * in [0 ].TarEntry , * in [1 ].TarEntry
873
880
if d .o .IgnoreFileOrder {
874
881
// cmpopts.IgnoreFields cannot be used for int
@@ -892,6 +899,16 @@ func (d *differ) diffTarEntry(ctx context.Context, node *EventTreeNode, in [2]Ev
892
899
if err := d .raiseEvent (ctx , node , ev , "tarentry" ); err != nil {
893
900
errs = append (errs , err )
894
901
}
902
+ } else if diff := cmp .Diff (ent0 .Header .PAXRecords , ent1 .Header .PAXRecords , paxOpts ... ); diff != "" {
903
+ ev := Event {
904
+ Type : EventTypeTarEntryMismatch ,
905
+ Inputs : in ,
906
+ Diff : diff ,
907
+ Note : fmt .Sprintf ("name %q" , ent0 .Header .Name ),
908
+ }
909
+ if err := d .raiseEvent (ctx , node , ev , "tarentry" ); err != nil {
910
+ errs = append (errs , err )
911
+ }
895
912
} else {
896
913
// entry matches, so no need to retain the extracted files and dirs
897
914
// (but dirs cannot be removed until processing all the tar entries in the layer)
0 commit comments