octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem using copyfile and movefile


From: Michael Goffioul
Subject: Re: Problem using copyfile and movefile
Date: Tue, 27 Feb 2007 21:48:50 +0100
User-agent: Thunderbird 1.5.0.9 (Windows/20061207)


It would be OK to have these as built-in functions, but I think some
care is needed to implement them.  You need to be careful about read
and write errors and possibly preserving access and modification time
stamps.  Also, moving a file should be done with rename if possible
(only works if source and target files are on the same filesystem) but
should still work by copy and remove if not (and in that case, you
definitely must be careful about open/read/write/close errors).  All
these little details add up to the reason that I chose to use cp and
mv, which presumably have all the bugs worked out.

Rather than inventing a solution just for Octave, I think it would
probably be good to use gnulib for these kinds of things, and to
enhance gnulib if there is some missing functionality.

I had a look at gnulib and found copy-file, which copy one file into another. Due to the dependencies, this would add a significant set of files to the source tree. Besides this, you still have to implement the logic of file overwrite, directory recursive copy and so on. Is it worth to add all these additional files for the single operation of binary copy of a file with mod/acl preserving (which can be implemented with a few lines,
even with error detection)?

Michael.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]