Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent in-place editing of uploaded files if files are imported from the FTP folder #4539

Merged
merged 3 commits into from Sep 7, 2017

Conversation

Projects
None yet
3 participants
@mvdbeek
Copy link
Member

commented Sep 3, 2017

When importing files from the FTP folder files should not be
modified in-place by galaxy.

Also avoids removing uploaded files if the upload tool runs as a real user.

This also modifies relevant bare except: statements and modifies
the meaning of in_place in upload.py from no external chown script to
do not edit files in place if we keep the source file.

This fixes #4527 and #4300.

Prevent in-place editing if purge_source is false
When importing files from the FTP folder the admin can choose to prevent
purging of imported files. In this case the source file should not be
modified in-place by galaxy.

This also modifies relevant bare `except:` statements and modifies
the meaning of `in_place` in upload.py from no external chown script to
do not edit files in place if we keep the source file.

This fixes #4527.

mvdbeek added some commits Sep 3, 2017

Move instead of copying converted datasets when possible
shutil.move tries to move files by renaming them.  If that fails with
OSError (due to permission or cross-filesystem rename) it falls back to
copying files followed by removing them
(https://github.com/python/cpython/blob/2.7/Lib/shutil.py#L279). By
using shutil.move and catching permission problems we avoid an
unnecessary copy if source and destination are on the same filesystem.

Also avoids shutil.move if the upload tool is run as real-user which
should fix #4300.

@mvdbeek mvdbeek changed the title Prevent in-place editing if purge_source is false Prevent in-place editing of uploaded files if files are imported from the FTP folder Sep 3, 2017

@mvdbeek

This comment has been minimized.

Copy link
Member Author

commented Sep 3, 2017

@bernt-matthias it would be great if you could give this a try and see if it fixes #4300.

@bernt-matthias

This comment has been minimized.

Copy link
Contributor

commented Sep 7, 2017

As I just realized this week #4300 was caused by missing permissions. But I still tested the changes and can verify that file upload as real user (using #4275) works.

@jmchilton jmchilton merged commit 57ff68e into galaxyproject:dev Sep 7, 2017

6 checks passed

api test Build finished. 284 tests run, 0 skipped, 0 failed.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
framework test Build finished. 161 tests run, 0 skipped, 0 failed.
Details
integration test Build finished. 44 tests run, 0 skipped, 0 failed.
Details
lgtm analysis: JavaScript No alert changes
Details
toolshed test Build finished. 579 tests run, 0 skipped, 0 failed.
Details

@mvdbeek mvdbeek deleted the mvdbeek:purge_source branch Jun 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.