docker-s3-sync icon indicating copy to clipboard operation
docker-s3-sync copied to clipboard

Use the S3 key as the default ouput file name

Open calvn opened this issue 8 years ago • 6 comments

calvn avatar Apr 06 '16 19:04 calvn

@cleung2010 Hi! Thank you for using docker-s3-sync.

Were you having a problem that this change fixed? Curious what the motivation is for this pull request.

ktheory avatar Apr 06 '16 21:04 ktheory

I would think that setting the DESTINATION path would be like cp or mv, where if you you don't specify the filename, the target file will have the same name as the source. Currently if the destination is a directory, the filename will default to out which is a bit odd.

calvn avatar Apr 07 '16 14:04 calvn

Currently if the destination is a directory, the filename will default to out which is a bit odd.

Oh, good point. I'd always fully specified the destination instead of giving a directory.

What about the case when the S3 key contains slashes? For example, path/to/s3_file.

Would you expect the file to live in /destination/path/to/s3_file? In that case, you'll need to mkdir -p $(dirname $S3_KEY).

If you'd expect it to live in /destination/s3_file, you'll want to write the file to $(basename $S3_KEY).

ktheory avatar Apr 07 '16 14:04 ktheory

Right, I don't know what is the right call here, whether it should be /destination/path/to/s3_file or /destination/s3_file.

calvn avatar Apr 07 '16 14:04 calvn

Actually, if the image is used to sync a single file I think it would make more sense to use $(basename $S3_KEY) rather than making the directory tree for the file.

calvn avatar Apr 07 '16 18:04 calvn

Also encountered a potential problem with the sync.sh. If OWNER_UID is not provided, the file will be owned by root:root, but the mv command might get permission denied if sync.sh is not executed by root. Changing it to cp eliminated the problem since the file is globally readable by default.

calvn avatar Apr 07 '16 19:04 calvn