I have advised UNIX developers in the past on catching stupid things people
do. I do stupid things from time to time.  I was a tester for a number of
the old Digital Corporation OS developments. For example, they put some
simple catches in compilers to disallow certain command requests.

You don't have to do anything, but I just thought you might like to know
and think about a warning when -f is used and a file name is not consistent
with tarball names.

May you never do stupid things,
Vince

On Thu, Aug 20, 2020 at 12:03 AM Michał Górny <mgo...@gentoo.org> wrote:

> On Wed, 2020-08-19 at 21:05 -0600, Vince Eccles wrote:
> > Dear sirs,
> >
> > I worked all day on debugging some important coding in FORTRAN. It was
> > tested and working. I decided it was time to tar up the new code and send
> > it to a backup machine.
> >
> > I intended to type:
> >
> > tar -zcf src.tar.gz ./various_*/*.f90 *.f90
> >
> > which would have places all the fortran codes in a compressed tar file
> that
> > I would transfer to a new machine.
> >
> > However, I typed:
> >
> > tar -zcf ./various_/*.f90 *.f90
> >
> > and the tar blasted all of my fortran files. I had a backup from two days
> > ago, but the lost effort was horrific.
> >
> > There needs to be a test to make sure stupid things don't happen.
> >
>
> How is it supposed to know that someone's doing something stupid?
>  Pattern expansion is done by shell, not tar.  If you want to be safer,
> don't use '-f' and instead redirect stdout.
>
>   tar -zc ./various_/*.f90 *.f90 > src.tar.gz
>
> --
> Best regards,
> Michał Górny
>
>

Reply via email to