[Rivet] rivet-mkhtml recursively removes ${pwd}/plots without warning

Andy Buckley andy.buckley at cern.ch
Thu Oct 8 12:03:08 BST 2015


Hi David,

I'm not really sure why it would be a surprise. We equally don't warn or 
stop users from running rivet if the output .yoda file already exists, 
nor re. overwriting of the files and directories from rivet-cmp histos.

The core Unix shell tools also don't complain when they would overwrite 
an existing file -- unless you specifically tell them to do so (for 
those which have such an option). Personally I prefer the convenience of 
the tools not objecting to overwrites. A priori if I run any command 
that would logically write into the same dir as a previous run, I should 
not expect my existing data to remain intact -- that's not just 
restricted to Rivet & friends!

I was going to add the printed warning that you suggested, then changed 
my mind -- by the time they've seen the message the damage is already 
done, and we'd "need" to add similar messages to every tool in the Rivet 
(and YODA) suite. It just seems like extra noise to me. But maybe others 
disagree?

Andy


On 08/10/15 11:48, David Bjergaard wrote:
> Hi All,
>
> Luckily I didn't lose any plots that I was attached to, but I did have a ./plots
> folder that was using to store intermediate results.  Removing any files without
> warning the user is kind of scary which is what I think this line does:
>      > if os.path.exists(opts.OUTPUTDIR) and not os.path.realpath(opts.OUTPUTDIR)==os.getcwd():
>      >     import shutil
>      >     shutil.rmtree(opts.OUTPUTDIR)
> Why can't you throw an exception and say "OUTPUTDIR not empty, please use -f to
> force overwriting", or less ideal but still better "OUTPUTDIR is not empty,
> removing" so that its less of a surprise when all the subdirectories in
> OUTPUTDIR have mysteriously vanished.
>
>      David
> _______________________________________________
> Rivet mailing list
> Rivet at projects.hepforge.org
> https://www.hepforge.org/lists/listinfo/rivet
>


-- 
Dr Andy Buckley, Lecturer / Royal Society University Research Fellow
Particle Physics Expt Group, University of Glasgow


More information about the Rivet mailing list