amoffat / supertag

A tag-based filesystem
https://amoffat.github.io/supertag/
GNU Affero General Public License v3.0
590 stars 25 forks source link

Problem tagging multiple files with glob expansion #14

Closed SeanPedersen closed 3 years ago

SeanPedersen commented 3 years ago

Hey, very cool project! I have been looking for a performant file tag organizer and this looks promising. I just have some UX issues I hope can be resolved without too much hassle.

Tagging multiple files at once My first issue is me wanting to tag multiple files in the same directory using a wildcard. I tried:

tag ln * escher/art

Expecting all files in my directory to be added to escher & art tags but instead I got an error:

Error: IO error: Os { code: 2, kind: NotFound, message: "No such file or directory" }

SeanPedersen commented 3 years ago

The similar project TMSU supports tagging multiple files at once with the following syntax: tmsu tag --tags="art escher" *

amoffat commented 3 years ago

I can't reproduce the tagging multiple files issue on linux. I'm on v0.1.3 and using wildcards work as expected. Are you on mac? What's your shell?

Can you move your second feedback to a separate issue just so we can keep the conversations separate? Thanks!

SeanPedersen commented 3 years ago

Hey I am on zsh that might be it... sure will move into new issue.

amoffat commented 3 years ago

If you wanted to try a little debugging on your end, the thing that I would check for your issue would be here. Put a println!('{}', files) there to see what your shell is expanding the glob to.

Then you'll need to run cargo run -- ln * escher/art from within the project directory (make sure your collection is mounted first). to see your print output.

SeanPedersen commented 3 years ago

Hey I went on a different route and reproduced the issue on bash (so zsh is not the problem). See these logs:

bash

[sean@archlinux escher]$ ps -p $$
    PID TTY          TIME CMD
  76687 pts/5    00:00:00 bash
[sean@archlinux escher]$ tag ln * escher/art
Error: IO error: Os { code: 2, kind: NotFound, message: "No such file or directory" }
[sean@archlinux escher]$ echo *
1189158-skull.jpg 1b1c7f958c081a74939f03cf6e71f2ca.jpg 228255184-mc-escher-desktop-wallpapers.jpg 5355f52716de7.jpg 895343_download-wallpapers-download-2560x1600-mc-escher-1600x1076_2560x1600_h.jpg dba77a133f98201556c32b2d207d3ab4.jpg df4ce0e2790d66624e2700e30881a9a4.jpg escher1.jpg EscherConvex_and_ConcaveLR.jpg Maurits_cornelis_escher-dragon.jpeg mc escher_www.wallpapername.com_29.jpg NqkRju0.jpg QOHhKUg.jpg waterfall.jpg XaJdc9N.jpg

zsh

 ✘ sean@archlinux  ~/Sync/MaData/Wallpapers/kunst/escher  ps -p $$
    PID TTY          TIME CMD
  22986 pts/3    00:00:01 zsh
 sean@archlinux  ~/Sync/MaData/Wallpapers/kunst/escher  tag ln * escher/art
Error: IO error: Os { code: 2, kind: NotFound, message: "No such file or directory" }
 ✘ sean@archlinux  ~/Sync/MaData/Wallpapers/kunst/escher  echo *
1189158-skull.jpg 1b1c7f958c081a74939f03cf6e71f2ca.jpg 228255184-mc-escher-desktop-wallpapers.jpg 5355f52716de7.jpg 895343_download-wallpapers-download-2560x1600-mc-escher-1600x1076_2560x1600_h.jpg dba77a133f98201556c32b2d207d3ab4.jpg df4ce0e2790d66624e2700e30881a9a4.jpg escher1.jpg EscherConvex_and_ConcaveLR.jpg Maurits_cornelis_escher-dragon.jpeg mc escher_www.wallpapername.com_29.jpg NqkRju0.jpg QOHhKUg.jpg waterfall.jpg XaJdc9N.jpg

The same error on bash and zsh. And both expand to the same files, as shown by `echo `

SeanPedersen commented 3 years ago

My guess is that you do not expand the paths to complete absolute paths? By that I mean echo * provides only the file names without the complete path.

amoffat commented 3 years ago

Hmm, no, relative files are expanded to canonical file paths here. If you run the ln command with -v, you should get some INFO level debugging output. What does it say?

SeanPedersen commented 3 years ago

tag -v ln * escher/art produces no additional output... and tag ln -v * escher/art throws an error: error: Found argument '-v' which wasn't expected, or isn't valid in this context

amoffat commented 3 years ago

Oh, I know what's going on. The optimized release build of supertag only includes ERROR level output. You'll have to run the ln command with cargo, from within the project repo:

➜  supertag git:(develop) ✗ cargo run -- -v ln src/*.rs code/rust
    Finished dev [unoptimized + debuginfo] target(s) in 0.04s
     Running `target/debug/tag -v ln src/lib.rs src/tag.rs code/rust`
[2021-01-01][10:07:38][1609524458.956][Thread: ThreadId(1)][Request: 0][cli-handlers][INFO] Running ln
[2021-01-01][10:07:38][1609524458.960][Thread: ThreadId(1)][Request: 0][cli][INFO] Linking files ["/home/amoffat/workspace/supertag/src/lib.rs", "/home/amoffat/workspace/supertag/src/tag.rs"] to "code/rust"
[2021-01-01][10:07:38][1609524458.960][Thread: ThreadId(1)][Request: 0][ops_wrapper][INFO] ln "/home/amoffat/workspace/supertag/src/lib.rs" to "code/rust"
[2021-01-01][10:07:38][1609524458.960][Thread: ThreadId(1)][Request: 0][sql][INFO] Adding file "/home/amoffat/workspace/supertag/src/lib.rs" to tags ["code", "rust"]
[2021-01-01][10:07:38][1609524458.961][Thread: ThreadId(1)][Request: 0][ops_wrapper][INFO] ln "/home/amoffat/workspace/supertag/src/tag.rs" to "code/rust"
[2021-01-01][10:07:38][1609524458.961][Thread: ThreadId(1)][Request: 0][sql][INFO] Adding file "/home/amoffat/workspace/supertag/src/tag.rs" to tags ["code", "rust"]
SeanPedersen commented 3 years ago

Strange that works as expected:

 sean@archlinux  ~/projects/rust/supertag   develop  cargo run -- ln src/*.rs code/rust
warning: couldn't execute `llvm-config --prefix` (error: No such file or directory (os error 2))
warning: set the LLVM_CONFIG_PATH environment variable to a valid `llvm-config` executable
   Compiling supertag v0.1.3 (/home/sean/projects/rust/supertag)
    Finished dev [unoptimized + debuginfo] target(s) in 1m 09s
     Running `target/debug/tag -v ln src/lib.rs src/tag.rs code/rust`
[2021-01-01][19:19:00][1609525140.335][Thread: ThreadId(1)][Request: 0][cli-handlers][INFO] Running ln
[2021-01-01][19:19:00][1609525140.346][Thread: ThreadId(1)][Request: 0][cli][INFO] Linking files ["/home/sean/projects/rust/supertag/src/lib.rs", "/home/sean/projects/rust/supertag/src/tag.rs"] to "code/rust"
[2021-01-01][19:19:00][1609525140.346][Thread: ThreadId(1)][Request: 0][ops_wrapper][INFO] ln "/home/sean/projects/rust/supertag/src/lib.rs" to "code/rust"
[2021-01-01][19:19:00][1609525140.346][Thread: ThreadId(1)][Request: 0][sql][INFO] Adding file "/home/sean/projects/rust/supertag/src/lib.rs" to tags ["code", "rust"]
[2021-01-01][19:19:00][1609525140.347][Thread: ThreadId(1)][Request: 0][ops_wrapper][INFO] ln "/home/sean/projects/rust/supertag/src/tag.rs" to "code/rust"
[2021-01-01][19:19:00][1609525140.347][Thread: ThreadId(1)][Request: 0][sql][INFO] Adding file "/home/sean/projects/rust/supertag/src/tag.rs" to tags ["code", "rust"]
SeanPedersen commented 3 years ago
 sean@archlinux  ~/projects/rust/supertag   develop  cargo run -- -v ln tests/common/* code/rust/tests
warning: couldn't execute `llvm-config --prefix` (error: No such file or directory (os error 2))
warning: set the LLVM_CONFIG_PATH environment variable to a valid `llvm-config` executable
    Finished dev [unoptimized + debuginfo] target(s) in 0.06s
     Running `target/debug/tag -v ln tests/common/dirs.rs tests/common/macros.rs tests/common/mod.rs tests/common/notify.rs tests/common/td.rs code/rust/tests`
[2021-01-01][19:50:45][1609527045.337][Thread: ThreadId(1)][Request: 0][cli-handlers][INFO] Running ln
[2021-01-01][19:50:45][1609527045.342][Thread: ThreadId(1)][Request: 0][cli][INFO] Linking files ["/home/sean/projects/rust/supertag/tests/common/dirs.rs", "/home/sean/projects/rust/supertag/tests/common/macros.rs", "/home/sean/projects/rust/supertag/tests/common/mod.rs", "/home/sean/projects/rust/supertag/tests/common/notify.rs", "/home/sean/projects/rust/supertag/tests/common/td.rs"] to "code/rust/tests"
[2021-01-01][19:50:45][1609527045.343][Thread: ThreadId(1)][Request: 0][ops_wrapper][INFO] ln "/home/sean/projects/rust/supertag/tests/common/dirs.rs" to "code/rust/tests"
[2021-01-01][19:50:45][1609527045.343][Thread: ThreadId(1)][Request: 0][sql][INFO] Adding file "/home/sean/projects/rust/supertag/tests/common/dirs.rs" to tags ["code", "rust", "tests"]
[2021-01-01][19:50:45][1609527045.344][Thread: ThreadId(1)][Request: 0][ops_wrapper][INFO] ln "/home/sean/projects/rust/supertag/tests/common/macros.rs" to "code/rust/tests"
[2021-01-01][19:50:45][1609527045.344][Thread: ThreadId(1)][Request: 0][sql][INFO] Adding file "/home/sean/projects/rust/supertag/tests/common/macros.rs" to tags ["code", "rust", "tests"]
[2021-01-01][19:50:45][1609527045.344][Thread: ThreadId(1)][Request: 0][ops_wrapper][INFO] ln "/home/sean/projects/rust/supertag/tests/common/mod.rs" to "code/rust/tests"
[2021-01-01][19:50:45][1609527045.345][Thread: ThreadId(1)][Request: 0][sql][INFO] Adding file "/home/sean/projects/rust/supertag/tests/common/mod.rs" to tags ["code", "rust", "tests"]
[2021-01-01][19:50:45][1609527045.345][Thread: ThreadId(1)][Request: 0][ops_wrapper][INFO] ln "/home/sean/projects/rust/supertag/tests/common/notify.rs" to "code/rust/tests"
[2021-01-01][19:50:45][1609527045.345][Thread: ThreadId(1)][Request: 0][sql][INFO] Adding file "/home/sean/projects/rust/supertag/tests/common/notify.rs" to tags ["code", "rust", "tests"]
[2021-01-01][19:50:45][1609527045.346][Thread: ThreadId(1)][Request: 0][ops_wrapper][INFO] ln "/home/sean/projects/rust/supertag/tests/common/td.rs" to "code/rust/tests"
[2021-01-01][19:50:45][1609527045.346][Thread: ThreadId(1)][Request: 0][sql][INFO] Adding file "/home/sean/projects/rust/supertag/tests/common/td.rs" to tags ["code", "rust", "tests"]

works as well.... maybe I should try building from source.

SeanPedersen commented 3 years ago

I used this method to install supertag:

curl -Ls https://github.com/amoffat/supertag/releases/latest/download/supertag-x86_64.AppImage > tag
sudo install tag /usr/local/bin

Are you sure the binary is up to date?

amoffat commented 3 years ago
➜  ~ /tmp/supertag-x86_64.AppImage --version
Supertag 0.1.3
➜  ~ /tmp/supertag-x86_64.AppImage mount test
Mounting to "/mnt/test"
Forked into background PID 2410482
➜  ~ /tmp/supertag-x86_64.AppImage ln tmp/*.png pics

I'm not sure what the differences are with our OSes that is causing this.

SeanPedersen commented 3 years ago

I am on Arch Linux with Kernel 5.9.14-arch1-1. Thought I should let you know I am no longer using supertag. I have completed a working prototype myself using Python with all my requirements satisfied: https://github.com/SeanPedersen/HyperTag

amoffat commented 3 years ago

For others who find this issue, I believe it related to #16 and fixed by ffa8921