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

David Grellscheid david.grellscheid at durham.ac.uk
Thu Oct 8 12:22:42 BST 2015


Hi!

Please keep the core behaviour as it is now. Andy has mentioned most of
the arguments already. We've had it the other way round before, and that
was a real pain to work with. I much prefer the silent convenience of
overwriting the existing output.

The issue is more in the naming I think. A directory name that has Rivet
explicitly in the name is less likely to have pre-existed. Or we check
for a hidden 0-size file in the directory before deleting, to make sure
the directory is one of ours.

  David



On 08/10/15 12:03, Andy Buckley wrote:
> 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
>>
> 
> 


More information about the Rivet mailing list