Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Merge pull request #504 from gottwald/devel-copyfix

Copy module: Error handling for missing permissions on the copy destination.
  • Loading branch information...
commit 62a36b67cae57593c22f5a0c28fa771821aa5b92 2 parents 53360d6 + e83b5db
@mpdehaan mpdehaan authored
Showing with 10 additions and 0 deletions.
  1. +10 −0 library/copy
10 library/copy
@@ -66,6 +66,16 @@ if dest:
if not os.path.exists(src):
exit_kv(rc=1, failed=1, msg="Source %s failed to transfer" % (src))
+if os.path.exists(dest):
+ # raise an error if copy has no permission on dest
+ if not os.access(dest, os.W_OK):
+ exit_kv(rc=1, failed=1, msg="Destination %s not writable" % (dest))
+ elif not os.access(dest, os.R_OK):
+ exit_kv(rc=1, failed=1, msg="Destination %s not readable" % (dest))
+ if not os.access(os.path.dirname(dest), os.W_OK):
+ exit_kv(rc=1, failed=1, msg="Destination %s not writable" % (dest))
md5sum = None
changed = False
if os.path.exists(dest):

0 comments on commit 62a36b6

Please sign in to comment.
Something went wrong with that request. Please try again.