🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.4bsd
Article #373

Re: A serious bug in unix2dos/dos2unix

#373
From: Reinhard Zierke
Date: Wed, 16 Dec 1992 08:03
45 lines
2600 bytes
jbayer@ispi.COM (Jonathan Bayer) writes:

> haiying@cs.mcgill.ca (Haiying ZHANG) writes:
> 
> >   I came across this bug a while ago. This has to do with using wild
> >card in file names with unix2dos/dos2unix.
> 
> >   If you use a wild card in the file name, be it a single * or a ?
> >embedded in a pattern, these two handy utilities will wipe out your
> >entire current directory with the exception of the first file. It will
> >set all the rest of the file to size 0. 
> 
> >   Although the man page does mention anything about wild card in
> >filename making one believe that it is not supported, it should not in
> >any case cause serious damaging to your files. While I am at it, these
> >two programs look like a recompile of its DOS version. It should have
> >provided more - options such as -Rfp etc. as in cp. 
> 
> First, what system are you running on?

A student of mine had the same problems on a SPARCstation with SunOS 4.1.2

>                                         second, what are you trying to do?
> On a Sun system the dos2unix command is designed to operate on ONE file only,
> sending the output to the second file specification.  The wild cards are
> expanded by the shell, and all the program sees is a long list of filenames.
> 
> It appears that you may be using it improperly.

This explains what dos2unix does, but not WHY it has such strange behaviour.
Using software improperly MUST NOT lead to such damaging results. Beware
of such bad software engineering!

At least unix2dos/dos2unix has to check that it is invoked with exactly two
arguments, first of which is the input filename and the second one the output
filename, not a directory name.  Better still, unix2dos/dos2unix should behave
similar to mv/cp and allow an arbitrary number of files when the last argument
is a directory name.

Reinhard

-- 
Reinhard Zierke                   Universitaet Hamburg, FB Informatik
zierke@informatik.uni-hamburg.de  Vogt-Koelln-Strasse 30, D-2000 Hamburg 54
                                  Tel.: (040) 54715-295   Fax: -206
Technical Details
Message-ID: <zierke.724493009@rzdspc24>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!rzsun2.informatik.uni-hamburg.de!rzdspc24!zierke
References: <1992Dec12.224109.15621@cs.mcgill.ca> <2527@ispi.COM>

Show Full Headers
Complete Article Headers
Newsgroups: comp.bugs.4bsd
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!rzsun2.informatik.uni-hamburg.de!rzdspc24!zierke
From: zierke@rzdspc24.informatik.uni-hamburg.de (Reinhard Zierke)
Subject: Re: A serious bug in unix2dos/dos2unix
Message-ID: <zierke.724493009@rzdspc24>
Sender: news@informatik.uni-hamburg.de (Mr. News)
Organization: University of Hamburg, FRG
References: <1992Dec12.224109.15621@cs.mcgill.ca> <2527@ispi.COM>
Distirbution: world
Date: 16 Dec 92 08:03:29 GMT
Lines: 45