Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* s3cmd: Don't fail when a local node is a directory

  and we expected a file. (as if for example /etc/passwd 
  was a dir)



git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/trunk@442 830e0280-6d2a-0410-9c65-932aecc39d9d
  • Loading branch information...
commit 2402847dc85025be2fd00c199c8685d7745f418b 1 parent 2edf0e8
ludvigm authored
Showing with 28 additions and 1 deletion.
  1. +6 −0 ChangeLog
  2. +19 −1 run-tests.py
  3. +3 −0  s3cmd
View
6 ChangeLog
@@ -1,5 +1,11 @@
2010-10-25 Michal Ludvig <mludvig@logix.net.nz>
+ * s3cmd: Don't fail when a local node is a directory
+ and we expected a file. (as if for example /etc/passwd
+ was a dir)
+
+2010-10-25 Michal Ludvig <mludvig@logix.net.nz>
+
* s3cmd, S3/S3.py: Ignore inaccessible (and missing) files
on upload.
* run-tests.py: Extended [sync] test to verify correct
View
20 run-tests.py
@@ -112,6 +112,9 @@ def compile_list(_list, regexps = False):
if run_tests.count(test_counter) == 0 or exclude_tests.count(test_counter) > 0:
return skip()
+ if not cmd_args:
+ return skip()
+
p = Popen(cmd_args, stdout = PIPE, stderr = STDOUT, universal_newlines = True)
stdout, stderr = p.communicate()
if retcode != p.returncode:
@@ -151,7 +154,7 @@ def test_s3cmd(label, cmd_args = [], **kwargs):
def test_mkdir(label, dir_name):
if os.name in ("posix", "nt"):
- cmd = ['mkdir']
+ cmd = ['mkdir', '-p']
else:
print "Unknown platform: %s" % os.name
sys.exit(1)
@@ -169,6 +172,8 @@ def test_rmdir(label, dir_name):
sys.exit(1)
cmd.append(dir_name)
return test(label, cmd)
+ else:
+ return test(label, [])
def test_flushdir(label, dir_name):
test_rmdir(label + "(rm)", dir_name)
@@ -297,6 +302,19 @@ def pbucket(tail):
must_find = must_find)
+## ====== Remove 'demo' directory
+test_rmdir("Remove 'demo/'", "testsuite-out/xyz/demo/")
+
+
+## ====== Create dir with name of a file
+test_mkdir("Create some-file.xml dir", "testsuite-out/xyz/demo/some-file.xml")
+
+
+## ====== Skip dst dirs
+test_s3cmd("Skip over dir", ['sync', '%s/xyz' % pbucket(1), 'testsuite-out'],
+ must_find = "WARNING: testsuite-out/xyz/demo/some-file.xml is a directory - skipping over")
+
+
## ====== Clean up local destination dir
test_flushdir("Clean testsuite-out/", "testsuite-out")
View
3  s3cmd
@@ -930,6 +930,9 @@ def cmd_sync_remote2local(args):
if e.errno in (errno.EPERM, errno.EACCES):
warning(u"%s not writable: %s" % (dst_file, e.strerror))
continue
+ if e.errno == errno.EISDIR:
+ warning(u"%s is a directory - skipping over" % dst_file)
+ continue
raise e
except KeyboardInterrupt:
try: dst_stream.close()
Please sign in to comment.
Something went wrong with that request. Please try again.