Hello,

I'm seeing unusual behavior creating archives using --format=posix and then
attempting to extract them using the --exclude option.   The --exclude
option appears to work for files in the first several sub-directories, but
not for sub-directories further down (~100 characters in), e.g.

# Versions
cat /etc/redhat-release
CentOS release 5 (Final)
/usr/local/bin/tar --version|grep tar
tar (GNU tar) 1.23

# BEGIN SCRIPT

#!/bin/bash
# Create directory to tar with 'txt' and 'doc' files
mkdir -p
/tmp/one/two/three/four/five/six/seven/eight/nine/ten/eleven/twelve/thirteen/fourteen/fifteen/sixteen/seventeen
cd /tmp/one
touch 1.doc 1.txt
cd
/tmp/one/two/three/four/five/six/seven/eight/nine/ten/eleven/twelve/thirteen/fourteen/fifteen
touch 15.doc 15.txt
cd
/tmp/one/two/three/four/five/six/seven/eight/nine/ten/eleven/twelve/thirteen/fourteen/fifteen/sixteen
touch 16.doc 16.txt

# Create archive
/usr/local/bin/tar -C /tmp/ --format=posix --create --file=/tmp/one.tar one

# Extract archive, excluding '*.txt'
mkdir /tmp/extract
/usr/local/bin/tar --extract --format=posix --exclude='*.txt'
--file=/tmp/one.tar -C /tmp/extract/

# List extracted files

# CORRECT - Excluded '*.txt'
ls /tmp/extract/one/
# OUTPUT:  1.doc  two

# CORRECT - Excluded '*.txt'
ls
/tmp/extract/one/two/three/four/five/six/seven/eight/nine/ten/eleven/twelve/thirteen/fourteen/fifteen
# OUTPUT:  15.doc  sixteen

# INCORRECT - '*.txt' exists
ls
/tmp/extract/one/two/three/four/five/six/seven/eight/nine/ten/eleven/twelve/thirteen/fourteen/fifteen/sixteen
# OUTPUT:  16.doc  16.txt  seventeen

# END SCRIPT

I have tried the above script using --format=gnu instead of --format=posix
and it appears to work correctly (e.g. The output of directory 'sixteen'
shows only the file '16.doc' and correctly excludes '16.txt')

Should I assume that POSIX is not fully supported (with --exclude) reading
the following?
http://www.gnu.org/software/tar/manual/tar.html#SEC130
http://www.gnu.org/software/tar/manual/tar.html#SEC142

And that for some reason --extract doesn't work beyond 100 characters
(path+file name) for --format=posix archives?

Any advice or suggestions on additional debugging steps is appreciated.
Thank you,
Matthew

Reply via email to