Glob fails to link if there's only one file
See original GitHub issueWhen I try to use glob with only one file in the source directory, dotbot fails to create the link with “Nonexistent source for…”
- defaults:
link:
relink: true
glob: true
force: true
- link:
~/.config/broot: broot/*
.
├── broot
│ └── conf.hjson
❯ ./install
Nonexistent source for ~/.config/broot : /home/jay/dotfiles/broot/*
==> Some tasks were not executed successfully
Adding a second file without changing anything else makes it function as expected. I would expect it to behave the same regardless of how many files are in the dir.
Why bother using glob if there’s only one file? Because it means if I add a second file later, I don’t need to also edit my install.conf.yaml. Almost always, I just want to symlink whatever is in the source directory. It took some squinting to even identify what was going wrong.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:7
- Comments:5 (3 by maintainers)
Top Results From Across the Web
glob.glob does not return any files in a fully qualified path?
This appears to be a bug in the "Evaluate expression" feature of pycharm : nothing is found there. Running the same code within...
Read more >path/filepath - Go Packages
Glob returns the names of all files matching pattern or nil if there is no matching file. The syntax of patterns is the...
Read more >glob expansion suddenly not working properly in loops
It seems this is only a problem when there is an extremely large number of files. I ran this command on the same...
Read more >glob - Greg's Wiki
"Glob" is the common name for a set of Bash features that match or expand specific types of patterns. Some synonyms for globbing...
Read more >fast-glob - npm
It's a very fast and efficient glob library for Node.js. ... Throw an error when symbolic link is broken if true or safely...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can confirm this with a new test case I created, and that it worked as of the last tagged version (v.1.19.0), and failed after a patch (that I wrote) was merged into
master
. I will develop a fix.I have a fix of a sort - line 73 of
link.py
goes from:to
… but I’m not sure the reason one would want to specify
glob: true
and yet not use any glob meta-chars. Essentially, the entireelif
stanza seems like it hides errors in usage and tries to guess the/a right thing to do. The immediately preceding stanza does the same thing, but throws an error if the result is a directory.Unless there is a clear use-case for allowing the use of
glob: true
and source path specifications without any glob meta-chars, I’d suggest always throwing an error.I suppose the possible use case is when people want to put
glob: true
into adefaults
block, but then again, the code is still hiding errors in use that aught to be corrected.Looking for feedback.