[Top][All Lists]

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

[Help-tar] --exclude partially working with --format=posix ?

From: Matthew Peterson
Subject: [Help-tar] --exclude partially working with --format=posix ?
Date: Tue, 22 Jun 2010 14:09:10 -0700


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


# 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


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?

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,

reply via email to

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