organize feature deletes destination folder, is surprising
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Snapcraft |
Fix Released
|
High
|
Sergio Schvezov |
Bug Description
I'm snapping an app that installs python packages to /usr/local/
I think I ought to be able to do this with the following in my snapcraft.yaml:
```
wxpython:
plugin: python
source: whatever
organize:
usr/
```
However the following code from snapcraft (pluginhandler.
```
def _organize(self):
for key in organize_fileset:
src = os.path.
dst = os.path.
if os.path.
if os.path.isdir(dst):
```
...will *delete* the destination (usr/lib) before copying the source files in. This is surprising, to say the least, and I can't think of a situation where this is the intended behavior. I suggest the following logic instead:
* If source is a directory, walk through all files recursively in src.
* attempt to copy file to dst, reserving the part of the path after source. If it already exists, error and exit.
* If source and dest are file paths, attempt to copy src to dest. If the destination file already exists, error and exit.
I don't think the 'organize' feature should ever delete files in the destination. The canonical example of this feature being used seems to be https:/
summary: |
- organize feature deleted destination folder, is surprising + organize feature deletes destination folder, is surprising |
Changed in snapcraft: | |
status: | New → Triaged |
importance: | Undecided → High |
assignee: | nobody → Sergio Schvezov (sergiusens) |
milestone: | none → 2.17 |
Changed in snapcraft: | |
status: | Fix Committed → Fix Released |
https:/ /github. com/snapcore/ snapcraft/ pull/780