From 717ecab64d1a5592275ececacb391cb768e4e289 Mon Sep 17 00:00:00 2001 From: Felicitas Pojtinger Date: Tue, 25 Jan 2022 04:14:19 +0100 Subject: [PATCH] feat: Enable appending to tar archives created outside of STFS by seeking over EOF mark manually --- pkg/recovery/index.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/recovery/index.go b/pkg/recovery/index.go index 351384e..faffb60 100644 --- a/pkg/recovery/index.go +++ b/pkg/recovery/index.go @@ -103,9 +103,17 @@ func Index( } if hdr == nil { - // EOF + // Try to skip over the next file mark; this makes it possible to append to a tar file created by i.e. GNU tar + if _, err := reader.Drive.Read(make([]byte, config.MagneticTapeBlockSize*2)); err != nil { + if err == io.EOF { + // EOF + break + } - break + return err + } + + continue } if i >= offset {