Skip to content

Download: Create files with 0644, support directory structures#278

Merged
kytrinyx merged 2 commits intoexercism:masterfrom
petertseng:downloads
Jan 23, 2016
Merged

Download: Create files with 0644, support directory structures#278
kytrinyx merged 2 commits intoexercism:masterfrom
petertseng:downloads

Conversation

@petertseng
Copy link
Copy Markdown
Member

This fixes two issues with downloads #276 and #277. More detailed explanations in the corresponding commit messages.

When downloading a submission with `exercism download`, previously the
files would get written with 0755 (u+rwx g+rx o+rx). In discussion in
issue #276 we decided we would like the files to be non-executable, as
we don't want to encourage the behavior of executing an arbitrary remote
file.

The user still has the option of either running the file in the
appropriate manner for the language or explicitly chmodding if desired.

Fixes #276
A recent change to exercism [1] allows it to preserve directory
structures in submissions. However, `exercism download` currently cannot
handle such submissions. For example, a submission with `dir/file.txt`
would attempt to write `dir/file.txt` without `dir` existing, and fail.

To fix this, we create any containing directories before writing files.

Fixes #277

[1] exercism/exercism@2dc984d
Comment thread cmd/download.go
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know about how similar this code is starting to get with https://github.com/exercism/cli/blob/master/user/item.go#L51 - maybe could use some unification? I'm unsure of where I'd put the code though, so I'd take suggestions on that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just leave it for now. We can do some refactoring in a second step.

kytrinyx added a commit that referenced this pull request Jan 23, 2016
Download: Create files with 0644, support directory structures
@kytrinyx kytrinyx merged commit 7d682ff into exercism:master Jan 23, 2016
@kytrinyx
Copy link
Copy Markdown
Member

Thank you!

@petertseng petertseng deleted the downloads branch January 4, 2017 13:16
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