oxvg cli incorrectly identifies files as directories if not run in hidden mode
the oxvg cli tool will incorrectly identify files as directories and refuse to process them if you aren't running with -./--hidden:
$ ll svgs/
total 1.3M
-rw-r--r-- 1 solonovamax solonovamax 9.6K Dec 9 2020 archlinux-logo-dark-scalable.518881f04ca9.svg
-rw-r--r-- 1 solonovamax solonovamax 2.1K Sep 24 17:39 banner.svg
-rw-r--r-- 1 solonovamax solonovamax 51K Sep 24 17:39 blobs-d.svg
-rw-r--r-- 1 solonovamax solonovamax 870K Mar 18 2023 Inkscape_About_Screen_Isometric_madness_HdG4la4.svg
-rw-r--r-- 1 solonovamax solonovamax 156K Oct 10 2014 Trajans-Column-lower-animated.svg
-rw-r--r-- 1 solonovamax solonovamax 162K Oct 7 2014 Wikipedia-logo-v2.svg
$ ./target/release/oxvg optimise svgs/ -r -o output/
svgs/archlinux-logo-dark-scalable.518881f04ca9.svg: Is a directory (os error 21)
svgs/banner.svg: Is a directory (os error 21)
svgs/blobs-d.svg: Is a directory (os error 21)
svgs/Inkscape_About_Screen_Isometric_madness_HdG4la4.svg: Is a directory (os error 21)
svgs/Trajans-Column-lower-animated.svg: Is a directory (os error 21)
svgs/Wikipedia-logo-v2.svg: Is a directory (os error 21)
$ ./target/release/oxvg optimise svgs/ -r -o output/ --hidden
"svgs/banner.svg" (2.1KB) -> "output/banner.svg" (1.1KB) (49.46%)
"svgs/Trajans-Column-lower-animated.svg" (159.5KB) -> "output/Trajans-Column-lower-animated.svg" (48.0KB) (69.90%)
"svgs/Wikipedia-logo-v2.svg" (165.4KB) -> "output/Wikipedia-logo-v2.svg" (116.7KB) (29.43%)
"svgs/archlinux-logo-dark-scalable.518881f04ca9.svg" (9.8KB) -> "output/archlinux-logo-dark-scalable.518881f04ca9.svg" (4.2KB) (56.85%)
"svgs/blobs-d.svg" (51.7KB) -> "output/blobs-d.svg" (41.3KB) (20.13%)
"svgs/Inkscape_About_Screen_Isometric_madness_HdG4la4.svg" (889.9KB) -> "output/Inkscape_About_Screen_Isometric_madness_HdG4la4.svg" (614.4KB) (30.96%)
using oxvg compiled from source using the latest commit (9be92b636d5eb2ebeca6c8d2ce196a9038b07557)
Hey Solo, I can't seem to replicate the issue. Are there any more details you can provide (OS, rustc --version, etc)?
Output
$ ./target/release/oxvg optimise crates/oxvg_optimiser/benches/ -r -o output/
"crates/oxvg_optimiser/benches/simple.svg" (0.3KB) -> "output/simple.svg" (0.1KB) (71.86%)
"crates/oxvg_optimiser/benches/banner.svg" (2.1KB) -> "output/banner.svg" (1.1KB) (49.46%)
"crates/oxvg_optimiser/benches/Trajans-Column-lower-animated.svg" (159.5KB) -> "output/Trajans-Column-lower-animated.svg" (48.0KB) (69.90%)
"crates/oxvg_optimiser/benches/nest/svg.svg" (4.5KB) -> "output/nest/svg.svg" (4.2KB) (5.41%)
"crates/oxvg_optimiser/benches/Wikipedia-logo-v2.svg" (165.4KB) -> "output/Wikipedia-logo-v2.svg" (116.7KB) (29.43%)
"crates/oxvg_optimiser/benches/blobs-d.svg" (51.7KB) -> "output/blobs-d.svg" (41.3KB) (20.13%)
"crates/oxvg_optimiser/benches/archlinux-logo-dark-scalable.518881f04ca9.svg" (9.8KB) -> "output/archlinux-logo-dark-scalable.518881f04ca9.svg" (4.2KB) (56.85%)
"crates/oxvg_optimiser/benches/Inkscape_About_Screen_Isometric_madness_HdG4la4.svg" (889.9KB) -> "output/Inkscape_About_Screen_Isometric_madness_HdG4la4.svg" (614.4KB) (30.96%)
Howdy, is this still an issue for you? I'll close the issue soon as there doesn't seem to be any way to replicate it
Hi, I forgot to reply sooner, very sorry about that.
I'm still able to replicate this on the latest commit (dc8c07c), however instead of emitting the "Is a directory (os error 21)" message, it just prints nothing. when running with the --hidden flag, it works as expected.
OS: Arch Linux 6.17.6-arch1-1 x86_64
rustc version: rustc 1.88.0 (6b00bc388 2025-06-23)
Just tested with the latest rustc version (1.91.1, ed61e7d7e 2025-11-07), and I'm able to reproduce with it as well.
Are the source files for the SVGs matching a pattern in a .gitignore file by any chance?
Are the source files for the SVGs matching a pattern in a
.gitignorefile by any chance?
I was working in a directory under this repo, so maybe? if it's in your gitignore, then yes
Yes, I have *.svg listed in .gitignore, so I think that might be the cause. In that case I think this issue is expected behaviour.
Is there perhaps some docs that may have misled you that needs updating?
Yes, I have
*.svglisted in.gitignore, so I think that might be the cause. In that case I think this issue is expected behaviour.
ah, alright
Is there perhaps some docs that may have misled you that needs updating?
I never looked at the docs tbh and just assumed it would work.
imo, it doesn't make a ton of sense for something like oxvg to parse gitignore files, however if you think that's an important feature then by all means keep it. however at the very least, I think it would be good to add an option called something like --no-ignore-vcs/--no-ignore (from ripgrep) or -- (from fd) with a description similar to the flags that ripgrep/fd gives:
- https://man.archlinux.org/man/rg.1#FILTER_OPTIONS
- https://man.archlinux.org/man/fd.1#I,
- https://man.archlinux.org/man/fd.1#no
having an option to disable it would quickly indicate to anyone running --help that this is a thing which exists & also how to disable it
Makes sense, I’m using the same library as ripgrep to walk directories, however when I first implemented it I thought it would be simpler to consolidate handling gitignore and hidden files under one flag.
Sounds like it’ll be easier to use if it’s consistent with other tools instead.
it doesn't make a ton of sense for something like oxvg to parse gitignore files
We do want this as default behaviour though, as we wouldn’t want to process node_modules, for example