bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-tar] tar corrupts on append


From: Renate Pyhel
Subject: [Bug-tar] tar corrupts on append
Date: Sat, 5 Mar 2016 18:12:34 -0500

Hi:

I was battling a bug on tar 1.27, built tar 1.28 and it's still there.

The tar spec says two (or more) empty 512 byte chunks at the end of a tar.
Various implementation put in different amounts.
It looks like appending when there are only two empty blocks at the end causes corruption.
Strangely enough, zero empty blocks seems to work reliably.
Four empty blocks works too.
Here is a test case that clearly fails:

#!/bin/sh

# This demonstrates that GNU tar 1.28 does not handle well when only 2 empty blocks terminate an archive

echo a>a
echo b>b
echo c>c
echo d>d
echo e>e
echo f>f
echo g>g
echo h>h
echo i>i

echo -e '\nCreating archive with a, b, c'
tar -v -cf data a b c
tar -v -tf data

echo -e '\nReducing empty blocks at the end'
#truncate data --size 3072 # zero empty blocks
truncate data --size 4096 # two empty blocks
#truncate data --size 5120 # four empty blocks
ls -l data
tar -v -tf data

echo -e '\nAdding d, e, f'
tar -v -rf data d e f
tar -v -tf data

echo -e '\nAdding g, h, i'
tar -v -rf data g h i
tar -v -tf data



reply via email to

[Prev in Thread] Current Thread [Next in Thread]