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

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

Re: File archivers and special DOS/Windows device names


From: Eli Zaretskii
Subject: Re: File archivers and special DOS/Windows device names
Date: Thu, 9 Aug 2001 09:16:23 +0300

On Tue, 7 Aug 2001, Tauno Voipio wrote:

> > If  archive  contains file with special name (such as prn, lpt1, com1,
> > con,  etc) it will be extracted to this device instead of file. Tested
> > with  pkzipc, WinRAR, rar, WinZip, tar (cygwin port under windows). In
> > case of WinZip and tar file will be extracted silently, in other cases
> > overwrite confirmation required.
> >
> > This  problem is only DOS/Windows specific. Tested on Windows NT/2000.
> > To  test:  make  sure  PRN:  (usually  PRN:  is  an alias to LPT1:) is
> > functioning  (that  is  you have printer connected to LPT1) and try to
> > extract  attached  ZIP,  TAR or RAR archive. It should print 1 page on
> > PCL-compatible printer.
> >
> 
> Please note that this is a property of the DOS-based file system in
> Microsoft operating systems. The file name does not need the colon after the
> name to be recognised as a device name. Besides, the extension of the file
> is totally ignored.

True.

> The tool cannot have a list of reserved names, as any
> loadable device driver name is included as a special by the Microsoft
> system.

You don't need a list of reserved names: just stat the file name and
see if st_mode has the S_IFCHR bit set.  The DJGPP port of GNU Tar
version 1.12a does that; see

  ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/tar112ab.zip

> If it is not allowed to change the file name, there is no way to do the
> thing gracefully on Microsoft operating systems.

You have no other way but rename the file: there are devices that will
wedge the machine if you try to write to them.  FWIW, the
above-mentioned port renames the files by prepending an underscore `_'
to them.



reply via email to

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