Explorar el Código

Fix files in subdirectories creating bad whiteout

Closes #23863

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
(cherry picked from commit 1c0f6653ba82c933885719478e90c13f8d7e32b7)
Signed-off-by: Tibor Vass <tibor@docker.com>
Derek McGowan hace 9 años
padre
commit
3fba11f7c6
Se han modificado 1 ficheros con 2 adiciones y 1 borrados
  1. 2 1
      pkg/archive/archive_linux.go

+ 2 - 1
pkg/archive/archive_linux.go

@@ -23,7 +23,8 @@ func (overlayWhiteoutConverter) ConvertWrite(hdr *tar.Header, path string, fi os
 	// convert whiteouts to AUFS format
 	// convert whiteouts to AUFS format
 	if fi.Mode()&os.ModeCharDevice != 0 && hdr.Devmajor == 0 && hdr.Devminor == 0 {
 	if fi.Mode()&os.ModeCharDevice != 0 && hdr.Devmajor == 0 && hdr.Devminor == 0 {
 		// we just rename the file and make it normal
 		// we just rename the file and make it normal
-		hdr.Name = WhiteoutPrefix + hdr.Name
+		dir, filename := filepath.Split(hdr.Name)
+		hdr.Name = filepath.Join(dir, WhiteoutPrefix+filename)
 		hdr.Mode = 0600
 		hdr.Mode = 0600
 		hdr.Typeflag = tar.TypeReg
 		hdr.Typeflag = tar.TypeReg
 		hdr.Size = 0
 		hdr.Size = 0