-
-
Notifications
You must be signed in to change notification settings - Fork 163
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
Support shopt -s dotglob #2194
Support shopt -s dotglob #2194
Conversation
7ffc60b
to
04bb106
Compare
OK, I managed to resolve my problem from before: But I cannot tell from the GitHub interface where specifically to look to investigate the failing jobs; clicking on any single job takes me to a |
Cool, I will look at this! Oh there is a URL hidden in the logs. https://github.com/oils-for-unix/oils/actions/runs/12284550355/job/34280567011?pr=2194 I switched from SSH to HTTP copying, and it introduced a lot of spew, which has hidden it I can fix that In the mean time I go to https://op.oilshell.org/uuu/github-jobs/ which is linked on https://www.oilshell.org/ and then look for the CI results Thanks for the help! |
Oh actually you can see a few more failures here https://op.oilshell.org/uuu/github-jobs/8712/
I am not sure what happened, I guess the default behavior changed somehow? |
10bd6ee
to
5e1fc27
Compare
Thanks, I managed to fix those problems. I have some questions, though. First, I am not sure how to properly declare the @@ -45,12 +45,12 @@ class LibcTest(unittest.TestCase):
def testGlob(self):
print('GLOB')
- print(libc.glob('*.py'))
+ print(libc.glob('*.py', 0))
# This will not match anything!
- print(libc.glob('\\'))
+ print(libc.glob('\\', 0))
# This one will match a file named \
- print(libc.glob('\\\\'))
+ print(libc.glob('\\\\', 0))
def testRegex(self):
#print(libc.regcomp(r'.*\.py')) Finally, one of the previously-failing tests in # NOTE: libc's glob function can return '.' and '..',
# which are typically not of interest. Filtering in
# this manner is similar (possibly identical?) to the
# default bash setting of 'setopt -s
# globskipdots'. However, this does not appear to
# faithfully reproduce the globskipdots' OFF setting,
# so supporting that option fully would require more
# than simply wrapping this in an if statement.
tmp = [s for s in results if s not in ['.', '..']]
results = tmp
n = len(results) Is it OK to have that test pass in this manner? It is complete happenstance: we support neither of the two features ( |
Wow this looks great, thank you! Thanks for tracking down all the Python and C++ stuff I think it can be OK to just pass If we don't support globskipdots, then maybe we can tweak the test so it doesn't pass? I guess we are missing test coverage? |
5e1fc27
to
ea5a7c9
Compare
OK, I have updated the globstar test to make sure it continues to fail. I also corrected my comment in |
ea5a7c9
to
b47c838
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this!
osh/glob_.py
Outdated
# setting of 'setopt -s globskipdots'. Supporting that | ||
# option fully would require more than simply wrapping | ||
# this in an if statement. | ||
tmp = [s for s in results if s not in ['.', '..']] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's fair not to support globskipdots
now ... I didn't even know that existed.
I think this change is ready because it makes more tests pass.
But it may be a good idea to rewrite it so it doesn't make an extra copy. This is not idiomatic Python, but it makes sense in C++
Something like:
n = 0
for s in results:
if s not in ('.', '..'): # better to use a tuple in mycpp, for efficient translation
out.append(s)
n += 1
return n
This is necessary to keep it failing with the recent change to glob._py.
b47c838
to
fe4711e
Compare
Great, thank you! Now I remember I didn't start a Zulip thread about how to implement |
Related to #610.
The Python build seems okay, but I could use some help getting the ninja build to pass; my attempt at defining GLOB_PERIOD doesn't seem to work.