From b6f794952aa5fd0c289671fb5145586488a463f3 Mon Sep 17 00:00:00 2001 From: Noel Cower Date: Sat, 7 Dec 2019 16:15:15 -0800 Subject: [PATCH] Handle bash <() redirection There's probably a better way to detect these specifically, but since mtar preserves symlinks by default, it's a special case. --- mtar.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mtar.go b/mtar.go index ecd7056..6fb1136 100644 --- a/mtar.go +++ b/mtar.go @@ -366,10 +366,14 @@ func addFile(w *tar.Writer, src, dest string, opts *FileOpts, allowRecursive boo hdr.Typeflag = tar.TypeDir hdr.Name = dest + "/" case st.Mode()&os.ModeSymlink == os.ModeSymlink: - hdr.Typeflag = tar.TypeSymlink hdr.Name = dest link, err := os.Readlink(src) failOnError("cannot resolve symlink", err) + if strings.HasPrefix(src, "/proc/self/fd/") && strings.HasPrefix(link, "pipe:[") && strings.HasSuffix(link, "]") { // Special case: <(proc) pipe + needBuffer = true + break + } + hdr.Typeflag = tar.TypeSymlink hdr.Linkname = link default: log.Print("skipping file: ", src, ": cannot add file") -- 2.45.2