cern-fts / davix

High-performance file management over WebDAV / HTTP
GNU Lesser General Public License v2.1
84 stars 36 forks source link

davix-get writes empty file on failure #55

Open jellykells opened 3 years ago

jellykells commented 3 years ago

Consider the following case:

  1. Use davix-get to retrieve a file from a remote server.

  2. The retrieval is successful and the file is written. :)

  3. Use davix-get again to retrieve an updated version of the same file.

  4. The retrieval fails due to some error (e.g. name resolution failure), and the old file is overwritten with an empty file. :(

For some context, I use davix to synchronize SSL certificates between multiple remote computers. A temporary failure caused davix to overwrite the certificates with empty files, resulting in errors from the programs using those certificates.

jellykells commented 3 years ago

One way this behavior can be worked around is by using a logical operator in bash:

davix-get [OPTIONS ...] <url> [temporary_file] && mv [temporary_file] [local_file]

But ideally davix-get wouldn't write the empty file at all.