Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glob patterns like "*/z1.txt" don't work (ie when a glob happens before / it seems) #29

Closed
timotheecour opened this issue Jul 24, 2018 · 6 comments
Labels
type: bug Something isn't working as intended or expected.

Comments

@timotheecour
Copy link
Collaborator

timotheecour commented Jul 24, 2018

/cc @citycide this bug seems serious:

on linux:

find pwd
/tmp/d03
/tmp/d03/A1
/tmp/d03/A1/z2.txt
/tmp/d03/A1/Z2.txt
/tmp/d03/a1
/tmp/d03/a1/z1.txt

echo toSeq(walkGlob("a1/z1.txt"))
@["a1/z1.txt"]
echo toSeq(walkGlob("*/z1.txt"))
@[] # BUG
echo toSeq(walkGlob("a?/z1.txt"))
@[]  # BUG
echo toSeq(walkGlob("a?/z?.txt"))
@[]  # BUG
@haltcase haltcase added type: bug Something isn't working as intended or expected. help wanted Extra attention is needed labels Jul 24, 2018
haltcase pushed a commit that referenced this issue Jul 25, 2018
@haltcase haltcase added status: in progress Work has started to close the issue. and removed help wanted Extra attention is needed labels Jul 25, 2018
haltcase added a commit that referenced this issue Aug 2, 2018
Closes #29

```
foo/a.txt
bar/a.txt
baz/a.txt
```

```nim
import glob
import sequtils

echo toSeq(walkGlob("*/a.txt"))
# -> @["foo/a.txt", "bar/a.txt", "baz/a.txt"]
```
@timotheecour
Copy link
Collaborator Author

timotheecour commented Aug 2, 2018

@citycide can we reopen? still doesn't work properly:
in example above, do:
cd ..

ls */*/z1.txt
d03/a1/z1.txt  d04/a1/z1.txt
import glob,sequtils
echo toSeq(walkGlob("*/*/z1.txt"))
@[]

@timotheecour timotheecour changed the title BUG: glob patterns like "*/z1.txt" don't work (ie when a glob happens before / it seems) [TODO] BUG: glob patterns like "*/z1.txt" don't work (ie when a glob happens before / it seems) Aug 2, 2018
@haltcase haltcase reopened this Aug 10, 2018
@haltcase haltcase changed the title [TODO] BUG: glob patterns like "*/z1.txt" don't work (ie when a glob happens before / it seems) glob patterns like "*/z1.txt" don't work (ie when a glob happens before / it seems) Aug 10, 2018
@timotheecour
Copy link
Collaborator Author

@citycide friendly ping :) this bug really limits usability of this otherwise excellent tool ...

@haltcase
Copy link
Owner

Yeah I'm working on it but it hasn't been as simple as I thought it would be. Still in progress.

@timotheecour
Copy link
Collaborator Author

timotheecour commented Aug 23, 2018

@citycide can you adapt https://github.com/git/git/blob/master/wildmatch.c to Nim (either via importc or via manual conversion, maybe starting gradually, starting from importc)? that seems like exactly what we want

top-level glob can use it as a building block; and we can implement BFS/DFS search on top of that.
this is exactly what I did in my own (private... but I can revive and share it if needed) glob function for D

happy to discuss implementation details; but I think it could make sense to start from importc to reuse code, incorporate it in higher level wrappers, and (in a later stage, if needed), gradually convert importc to nim

@haltcase
Copy link
Owner

@timotheecour that doesn't support extended glob features like {} groups and patterns. It's also not the problem area: matching works fine as-is, it's the file system traversal that is difficult because we need to partially match directories along the way.

@data-man
Copy link

doesn't support extended glob features like {} groups and patterns

Exactly!
So I prefer filename_match from FLTK.

@haltcase haltcase added status: pending release Issue is resolved but waiting to be released. and removed status: in progress Work has started to close the issue. labels Sep 26, 2018
@haltcase haltcase removed the status: pending release Issue is resolved but waiting to be released. label Oct 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working as intended or expected.
Projects
None yet
Development

No branches or pull requests

3 participants