oniony / TMSU

TMSU lets you tags your files and then access them through a nifty virtual filesystem from any other application.
Other
2.02k stars 117 forks source link

VFS untag: crash if using path from file browser #235

Open mpeter50 opened 2 years ago

mpeter50 commented 2 years ago

The VFS in the tag folders only list other tags and the files directory, through which the tag links can be seen. If you copy such a path, which is like tagfs/tags/music/good/files/mysong.mp3, and issue rm on it (rm 'tagfs/tags/music/good/files/mysong.mp3'), rm will fail with this error:

rm: cannot remove 'tagfs/tags/music/good/files/mysong.mp3': Software caused connection abort

After this, the VFS mount is not accessible, listing it's content fails with this error:

ls: cannot access 'tagfs': Transport endpoint is not connected

This can be fixed by unmounting the vfs with root permissions.

After a forced unmount, running tmsu vfs --verbose --options=allow_other tagfs and trying again the same rm command reveals that the problem is caused by that the VFS searches for files (from the path) as a tag, but since it isn't one, it crashes:

...
tmsu: BEGIN getTaggedEntryAttr([mysong.mp3])
tmsu: committing transaction
tmsu: END getTaggedEntryAttr([mysong.mp3])
tmsu: END GetAttr(tags/music/good/files/mysong.mp3)
tmsu: BEGIN Unlink(tags/music/good/files/mysong.mp3)
tmsu: could not retrieve tag 'files'.
[process exits here]

(note: edited the logs with the example paths above)

As a workaround, running the same rm command but without the /files in the path untags the file as expected, but since the files are not listed in the tag directories themselves, it can't be done from a file manager. So it works like this: tagfs/tags/music/good/mysong.mp3. Also, the files are accessible this way too, without the file directory in the path, so running ls tagfs/tags/music/good/mysong.mp3 shows the link that is also shown by ls tagfs/tags/music/good/files/mysong.mp3

This is probably new behavior since a certain version, as the examples on the wiki show ls commands without the last files directory, so the problem might be that the unlink function hasn't been actualized to the new vfs layout.

The TMSU version on which I've experienced this is 0.7.5

oniony commented 2 years ago

Yep, thanks for reporting this. I believe your conclusion is correct: I haven't updated the VFS code to handle the change in path.