@@ -131,16 +131,6 @@ const (
131
131
OverlayWhiteoutFormat
132
132
)
133
133
134
- const (
135
- modeISDIR = 0o40000 // Directory
136
- modeISFIFO = 0o10000 // FIFO
137
- modeISREG = 0o100000 // Regular file
138
- modeISLNK = 0o120000 // Symbolic link
139
- modeISBLK = 0o60000 // Block special file
140
- modeISCHR = 0o20000 // Character special file
141
- modeISSOCK = 0o140000 // Socket
142
- )
143
-
144
134
// IsArchivePath checks if the (possibly compressed) file at the given path
145
135
// starts with a tar file header.
146
136
func IsArchivePath (path string ) bool {
@@ -358,7 +348,7 @@ func FileInfoHeader(name string, fi os.FileInfo, link string) (*tar.Header, erro
358
348
if err != nil {
359
349
return nil , err
360
350
}
361
- hdr .Mode = fillGo18FileTypeBits ( int64 (chmodTarEntry (os .FileMode (hdr .Mode ))), fi )
351
+ hdr .Mode = int64 (chmodTarEntry (os .FileMode (hdr .Mode )))
362
352
name , err = canonicalTarName (name , fi .IsDir ())
363
353
if err != nil {
364
354
return nil , fmt .Errorf ("tar: cannot canonicalize path: %w" , err )
@@ -370,31 +360,6 @@ func FileInfoHeader(name string, fi os.FileInfo, link string) (*tar.Header, erro
370
360
return hdr , nil
371
361
}
372
362
373
- // fillGo18FileTypeBits fills type bits which have been removed on Go 1.9 archive/tar
374
- // https://github.com/golang/go/commit/66b5a2f
375
- func fillGo18FileTypeBits (mode int64 , fi os.FileInfo ) int64 {
376
- fm := fi .Mode ()
377
- switch {
378
- case fm .IsRegular ():
379
- mode |= modeISREG
380
- case fi .IsDir ():
381
- mode |= modeISDIR
382
- case fm & os .ModeSymlink != 0 :
383
- mode |= modeISLNK
384
- case fm & os .ModeDevice != 0 :
385
- if fm & os .ModeCharDevice != 0 {
386
- mode |= modeISCHR
387
- } else {
388
- mode |= modeISBLK
389
- }
390
- case fm & os .ModeNamedPipe != 0 :
391
- mode |= modeISFIFO
392
- case fm & os .ModeSocket != 0 :
393
- mode |= modeISSOCK
394
- }
395
- return mode
396
- }
397
-
398
363
// ReadSecurityXattrToTarHeader reads security.capability, security,image
399
364
// xattrs from filesystem to a tar header
400
365
func ReadSecurityXattrToTarHeader (path string , hdr * tar.Header ) error {
0 commit comments