Skip to content

Use the S3 key as the default ouput file name#5

Open
calvn wants to merge 1 commit into
kickstarter:masterfrom
calvn:use_key_name
Open

Use the S3 key as the default ouput file name#5
calvn wants to merge 1 commit into
kickstarter:masterfrom
calvn:use_key_name

Conversation

@calvn

@calvn calvn commented Apr 6, 2016

Copy link
Copy Markdown

No description provided.

@ktheory

ktheory commented Apr 6, 2016

Copy link
Copy Markdown
Contributor

@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.

@calvn

calvn commented Apr 7, 2016

Copy link
Copy Markdown
Author

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.

@ktheory

ktheory commented Apr 7, 2016

Copy link
Copy Markdown
Contributor

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).

@calvn

calvn commented Apr 7, 2016

Copy link
Copy Markdown
Author

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

calvn commented Apr 7, 2016

Copy link
Copy Markdown
Author

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

calvn commented Apr 7, 2016

Copy link
Copy Markdown
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants