[SAGA-RG] Some more questions

Hartmut Kaiser hkaiser at cct.lsu.edu
Tue Oct 30 14:41:31 CDT 2007


 
Andre,
 
> > 2. What is supposed to happen when the source is a directory, the
> >    recursive flag is set, and the target is a file? I assume remove
> >    target, create target dir, and copy? And if overwrite flag is
> >    not set, throw AlreadyExists?
> 
> Uhm, tough one!  Unix shell would say:
> 
>   koks merzky /tmp : mkdir a
>   koks merzky /tmp : touch a/a b
>   koks merzky /tmp : cp -Rf a b
>   cp: cannot overwrite non-directory `b' with directory `a'
> 
> We don't have an exception for this.  So, yes, I would concur 
> with your interpretation: the target file should get removed, 
> and a target dir with the same name should get created.

Deleting a file in the case the user wanted to delete a directory is bad,
IMHO. I'ld suggest to throw an AlreadyExists exeption.

> > 3. What is supposed to happen with a recursive copy where 
> the overwrite
> >    flag is NOT set, and some of the destinations already 
> exist? Copy to
> >    the non-existing destinations and throw AlreadyExists?
> 
> Puh, no idea!  The POSIX C API has no recursive directory 
> copy, and the POSIX shells have no notion of overwrite flags 
> (only of !overwrite -- -f/--force has a slightly different meaning).  
> 
> I agree that your interpretation seems the most logical one, 
> but I would assume that it would make sense not to make any 
> assumptions on what files got copied before the exception 
> gets raised.  Also, the exception should name the target 
> entry causing the trouble.

Agreed.

Regards Hartmut




More information about the saga-rg mailing list