Bug 768724

Summary: tar does not extract files with names not matching the current locale
Product: Red Hat Enterprise Linux 6 Reporter: Peter Klotz <peter.klotz>
Component: tarAssignee: Pavel Raiskup <praiskup>
Status: CLOSED ERRATA QA Contact: Branislav Blaškovič <bblaskov>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2CC: azelinka, bblaskov, kdudka
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: tar-1.23-4.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 13:49:33 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
tar file that demonstrates the bug
none
proposed fix none

Description Peter Klotz 2011-12-18 11:26:28 UTC
Created attachment 548372 [details]
tar file that demonstrates the bug

Description of problem:

tar 1.23 (RHEL 6.2) does not extract files that contain characters that do not match the current locale. It only happens if a directory is given that is to be extracted.

Version-Release number of selected component (if applicable):

tar 1.23

How reproducible:
Always

Steps to Reproduce:
1. Call "tar xf 100.tar 100" to extract directory "100" from attached tar file
2. 
3.
  
Actual results:
One only obtains "100/file2a" and "100/md5sums" but not file "100/file1ä".

When called with "tar xf 100.tar" without specifying a directory, all three files are extracted.
It seems that pattern matching fails for the file containing the ISO8859-1 character when tar is run in an UTF-8 environment.

Expected results:
All 3 files should be extracted.

Additional info:
tar 1.15.1 (RHEL 5.7) and tar 1.26 (Upstream) work correctly and extract all three files.

Comment 2 Kamil Dudka 2011-12-18 12:54:53 UTC
This behavior is caused by the implementation of fnmatch() from glibc.  A possible fix would be to switch tar to use the fnmatch implementation from gnulib, which is already there but not used.

Luckily, in your case you do not use the wildcard matching anyway.  So I would suggest to just disable the wildcard matching by the --no-wildcards option.  Note that --no-wildcards is now the default behavior in the upstream tar.

Comment 3 Peter Klotz 2011-12-19 07:30:32 UTC
Thanks Kamil.

I was not even aware of wildcard matching being used in my case.

Since for me a workaround exists, I can deal with this behavior of tar.

It may however break existing scripts that are not that simple to fix.

Comment 6 Kamil Dudka 2012-01-16 12:00:04 UTC
Created attachment 555480 [details]
proposed fix

Sync the assertions about working fnmatch() with up2date tar.  This patch causes the autoconf checks to detect the fnmatch() implementation from RHEL-6 glibc as broken and use the fnmatch() implementation from gnulib instead.

Comment 12 errata-xmlrpc 2012-06-20 13:49:33 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-0849.html