bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: CYGWIN tar extract hangs when filename matches MSDOS port


From: Eli Zaretskii
Subject: Re: CYGWIN tar extract hangs when filename matches MSDOS port
Date: Thu, 21 Nov 2002 08:25:25 +0200 (IST)

On Thu, 21 Nov 2002, Jonathan Engdahl wrote:

> Under Cygwin (updated just today), tar-1.13.25-1 hangs whenever a filename
> matches an MSDOS port name, such as COM or AUX.

Right.  What's more embarrassing, the same happens with file names like 
aux.c or com2.txt.

> The attached file is a hacked up extract.c that tries to fix the problem by
> skipping offending files.

The right way (IMHO) is to stat each file name Tar finds in the archive 
and see if the st_mode has the character device bit set.  This is because 
the set of device names is unlimited: a device driver installed by 
DOS/Windows startup files can use _any_ name up to 8 characters.  
Examples of names of standard devices you didn't catch are "CLOCK$", 
"EMM000", etc.  OTOH, your quick hack is too retrictive: there's no need 
to skip files named "COM" or "COMfoobar".

In fact, there's no need to skip any files at all.  If `stat' tells Tar
that the file's name is reserved, Tar should rename the file.  A simple
renaming technique is to prepend a `_' to the original name (and repeat 
the whole process to make sure the result is not itself a character 
device name). 

FWIW, the DJGPP port of Tar 1.12a (you can find it on
www.simtel.net/pub/djgpp/v2gnu/) implements the above method.  It's a pity
this patch (and others as well), though submitted to the maintainer, were
never integrated into the official sources. 

> Tar creation might need to be fixed also.

Why?  Such names are only dangerous on DOS/Windows, where no real file 
can have such a name.  So Tar will never see such files on DOS/Windows, 
and on Posix systems these names are just normal file names.




reply via email to

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