sync raises "list index out of range" when local destination file already exists #88

Closed
dustinboswell opened this Issue Nov 16, 2012 · 3 comments

Comments

Projects
None yet
2 participants
@dustinboswell

assume local file foo.txt already exists

$> s3cmd sync s3://...foo.txt foo.txt

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
An unexpected error has occurred.
Please report the following lines to:
s3tools-bugs@lists.sourceforge.net
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Problem: IndexError: list index out of range
S3cmd: 1.1.0-beta3

Traceback (most recent call last):
File "/usr/local/bin/s3cmd", line 1800, in
main()
File "/usr/local/bin/s3cmd", line 1741, in main
cmd_func(args)
File "/usr/local/bin/s3cmd", line 967, in cmd_sync
return cmd_sync_remote2local(args)
File "/usr/local/bin/s3cmd", line 690, in cmd_sync_remote2local
remote_list[remote_list.keys()[0]]['local_filename'] = deunicodise(destination_base)
IndexError: list index out of range

Here is my config if it matters:

[default]
bucket_location = US
cloudfront_host = cloudfront.amazonaws.com
default_mime_type = binary/octet-stream
delete_removed = False
dry_run = False
enable_multipart = True
encoding = UTF-8
encrypt = False
follow_symlinks = False
force = False
get_continue = False
guess_mime_type = True
host_base = s3.amazonaws.com
host_bucket = %(bucket)s.s3.amazonaws.com
human_readable_sizes = False
invalidate_on_cf = False
list_md5 = False
log_target_prefix =
mime_type =
multipart_chunk_size_mb = 15
preserve_attrs = True
progress_meter = True
proxy_host =
proxy_port = 0
recursive = False
recv_chunk = 4096
reduced_redundancy = False
simpledb_host = sdb.amazonaws.com
skip_existing = False
socket_timeout = 300
urlencoding_mode = normal
use_https = True
verbosity = WARNING

@mdomsch

This comment has been minimized.

Show comment Hide comment
@mdomsch

mdomsch Mar 9, 2013

Member

This fails similarly in 1.5.0-alpha2 head 454c20e

Member

mdomsch commented Mar 9, 2013

This fails similarly in 1.5.0-alpha2 head 454c20e

@mdomsch mdomsch closed this Mar 9, 2013

@mdomsch mdomsch reopened this Mar 9, 2013

@mdomsch

This comment has been minimized.

Show comment Hide comment
@mdomsch

mdomsch Mar 9, 2013

Member

INFO: Found 1 remote files, 1 local files
INFO: Applying --exclude/--include
DEBUG: CHECK: foo.txt
DEBUG: PASS: 'foo.txt'
INFO: Verifying attributes...
DEBUG: Comparing filelists (direction: remote -> local)
DEBUG: CHECK: foo.txt
DEBUG: IGNR: foo.txt (transfer not needed)
INFO: Summary: 0 remote files to download, 0 local files to delete, 0 local files to hardlink
DEBUG: DeUnicodising u'/var/tmp/t/foo.txt' using UTF-8

Problem: IndexError: list index out of range
S3cmd: 1.5.0-alpha2

Traceback (most recent call last):
File "./s3cmd", line 2092, in
main()
File "./s3cmd", line 2032, in main
cmd_func(args)
File "./s3cmd", line 1191, in cmd_sync
return cmd_sync_remote2local(args)
File "./s3cmd", line 763, in cmd_sync_remote2local
_set_local_filename(remote_list, destination_base)
File "./s3cmd", line 753, in _set_local_filename
remote_list[remote_list.keys()[0]]['local_filename'] = deunicodise(destination_base)
IndexError: list index out of range

Member

mdomsch commented Mar 9, 2013

INFO: Found 1 remote files, 1 local files
INFO: Applying --exclude/--include
DEBUG: CHECK: foo.txt
DEBUG: PASS: 'foo.txt'
INFO: Verifying attributes...
DEBUG: Comparing filelists (direction: remote -> local)
DEBUG: CHECK: foo.txt
DEBUG: IGNR: foo.txt (transfer not needed)
INFO: Summary: 0 remote files to download, 0 local files to delete, 0 local files to hardlink
DEBUG: DeUnicodising u'/var/tmp/t/foo.txt' using UTF-8

Problem: IndexError: list index out of range
S3cmd: 1.5.0-alpha2

Traceback (most recent call last):
File "./s3cmd", line 2092, in
main()
File "./s3cmd", line 2032, in main
cmd_func(args)
File "./s3cmd", line 1191, in cmd_sync
return cmd_sync_remote2local(args)
File "./s3cmd", line 763, in cmd_sync_remote2local
_set_local_filename(remote_list, destination_base)
File "./s3cmd", line 753, in _set_local_filename
remote_list[remote_list.keys()[0]]['local_filename'] = deunicodise(destination_base)
IndexError: list index out of range

@mdomsch

This comment has been minimized.

Show comment Hide comment
@mdomsch

mdomsch Mar 14, 2013

Member

above PR fixes this, closing as it is merged.

Member

mdomsch commented Mar 14, 2013

above PR fixes this, closing as it is merged.

@mdomsch mdomsch closed this Mar 14, 2013

ksauzz pushed a commit to ksauzz/s3cmd that referenced this issue Feb 14, 2014

fix sync single remote file to existing local file traceback, bug 88
fixes s3tools#88

We were getting a traceback:

remote_list[remote_list.keys()[0]]['local_filename'] = deunicodise(destination_base)
IndexError: list index out of range

In this instance, remote_list length is 0 because the file is on the
update_list instead.  We'll get to process that in a bit.  The right
thing to do in _set_local_filename() is to simply return if the list
length is zero - there's nothing for us to do.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment