@@ -54,6 +54,7 @@ import (
5454 "go.podman.io/common/pkg/umask"
5555 is "go.podman.io/image/v5/storage"
5656 "go.podman.io/storage/pkg/archive"
57+ "go.podman.io/storage/pkg/chrootarchive"
5758 "go.podman.io/storage/pkg/fileutils"
5859 "go.podman.io/storage/pkg/idtools"
5960 "go.podman.io/storage/pkg/lockfile"
@@ -1207,11 +1208,10 @@ func (c *Container) exportCheckpoint(options ContainerCheckpointOptions) error {
12071208 if mp == "" {
12081209 return fmt .Errorf ("volume %s is not mounted, cannot export: %w" , volume .Name (), define .ErrInternal )
12091210 }
1210-
1211- input , err := archive .TarWithOptions (mp , & archive.TarOptions {
1211+ input , err := chrootarchive .Tar (mp , & archive.TarOptions {
12121212 Compression : archive .Uncompressed ,
12131213 IncludeSourceDir : true ,
1214- })
1214+ }, mp )
12151215 if err != nil {
12161216 return fmt .Errorf ("reading volume directory %q: %w" , v .Dest , err )
12171217 }
@@ -1226,12 +1226,12 @@ func (c *Container) exportCheckpoint(options ContainerCheckpointOptions) error {
12261226 }
12271227 }
12281228
1229- input , err := archive .TarWithOptions (c .bundlePath (), & archive.TarOptions {
1229+ bundle := c .bundlePath ()
1230+ input , err := chrootarchive .Tar (bundle , & archive.TarOptions {
12301231 Compression : options .Compression ,
12311232 IncludeSourceDir : true ,
12321233 IncludeFiles : includeFiles ,
1233- })
1234-
1234+ }, bundle )
12351235 if err != nil {
12361236 return fmt .Errorf ("reading checkpoint directory %q: %w" , c .ID (), err )
12371237 }
@@ -1312,10 +1312,10 @@ func (c *Container) checkpoint(ctx context.Context, options ContainerCheckpointO
13121312 }
13131313 defer shmDirTarFile .Close ()
13141314
1315- input , err := archive . TarWithOptions (c .config .ShmDir , & archive.TarOptions {
1315+ input , err := chrootarchive . Tar (c .config .ShmDir , & archive.TarOptions {
13161316 Compression : archive .Uncompressed ,
13171317 IncludeSourceDir : true ,
1318- })
1318+ }, c . config . ShmDir )
13191319 if err != nil {
13201320 return nil , 0 , err
13211321 }
@@ -1488,7 +1488,7 @@ func (c *Container) importPreCheckpoint(input string) error {
14881488
14891489 defer archiveFile .Close ()
14901490
1491- err = archive .Untar (archiveFile , c .bundlePath (), nil )
1491+ err = chrootarchive .Untar (archiveFile , c .bundlePath (), nil )
14921492 if err != nil {
14931493 return fmt .Errorf ("unpacking of pre-checkpoint archive %s failed: %w" , input , err )
14941494 }
@@ -1751,7 +1751,7 @@ func (c *Container) restore(ctx context.Context, options ContainerCheckpointOpti
17511751 }
17521752 defer shmDirTarFile .Close ()
17531753
1754- if err := archive .UntarUncompressed (shmDirTarFile , c .config .ShmDir , nil ); err != nil {
1754+ if err := chrootarchive .UntarUncompressed (shmDirTarFile , c .config .ShmDir , nil ); err != nil {
17551755 return nil , 0 , err
17561756 }
17571757 }
@@ -1791,7 +1791,7 @@ func (c *Container) restore(ctx context.Context, options ContainerCheckpointOpti
17911791 if mountPoint == "" {
17921792 return nil , 0 , fmt .Errorf ("unable to import volume %s as it is not mounted: %w" , volume .Name (), err )
17931793 }
1794- if err := archive .UntarUncompressed (volumeFile , mountPoint , nil ); err != nil {
1794+ if err := chrootarchive .UntarUncompressed (volumeFile , mountPoint , nil ); err != nil {
17951795 return nil , 0 , fmt .Errorf ("failed to extract volume %s to %s: %w" , volumeFilePath , mountPoint , err )
17961796 }
17971797 }
0 commit comments