1
0
Fork 0
forked from mirrors/tar-split

archive/tar: don't treat multiple file system links as a tar hardlink

Do not assume that if stat shows multiple links that we should mark the
file as a hardlink in the tar format.  If the hardlink link was not
referenced, this caused a link to "/".  On an overlay file system, all
files have multiple links.

The caller must keep the inode references and set TypeLink, Size = 0,
and LinkName themselves.

Change-Id: I873b8a235bc8f8fbb271db74ee54232da36ca013
Reviewed-on: https://go-review.googlesource.com/13045
Reviewed-by: Ian Lance Taylor <iant@golang.org>

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2015-08-03 12:26:38 -04:00
parent 3b34dbd368
commit 4d4b53c78b

View file

@ -28,10 +28,5 @@ func statUnix(fi os.FileInfo, h *Header) error {
h.AccessTime = statAtime(sys) h.AccessTime = statAtime(sys)
h.ChangeTime = statCtime(sys) h.ChangeTime = statCtime(sys)
// TODO(bradfitz): major/minor device numbers? // TODO(bradfitz): major/minor device numbers?
if fi.Mode().IsRegular() && sys.Nlink > 1 {
h.Typeflag = TypeLink
h.Size = 0
// TODO(vbatts): Linkname?
}
return nil return nil
} }