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

nocasematch shell option doesn't seem to work #701

Closed
Crestwave opened this issue Apr 7, 2020 · 10 comments · Fixed by #1748
Closed

nocasematch shell option doesn't seem to work #701

Crestwave opened this issue Apr 7, 2020 · 10 comments · Fixed by #1748

Comments

@Crestwave
Copy link
Contributor

Forgot to open this issue yesterday; required for #627.

$ shopt -s nocasematch
$ [[ a == A ]]; echo $?
0
$ [[ A == a ]]; echo $?
0
osh$ shopt -s nocasematch
osh$ [[ a == A ]]; echo $?
1
osh$ [[ A == a ]]; echo $?
1
@andychu
Copy link
Contributor

andychu commented Apr 8, 2020

This is similar to #610 I believe. It's basically a flag on fnmatch() or glob().

I stubbed out a lot of the bash options as no-ops to get past superficial errors. So shopt -s nocasematch is a no-op now. Not sure if we should make it stricter or not.

Those test cases would be great to copy into spec/dbracket.test.sh if you any cycles:

https://github.com/oilshell/oil/wiki/Spec-Tests

In any case thanks for testing, this is helpful. I thought neofetch would be easier to run since it was bash 3.0 ... But it seems like it's within spitting distance.

@Crestwave
Copy link
Contributor Author

What do you mean by "if you any cycles"?

I thought neofetch would be easier to run since it was bash 3.0 ... But it seems like it's within spitting distance.

Definitely! I'm not sure if you saw it in the middle of all my babble in #679, but I was able to get a pretty good result with some temporary patches. After finding and patching the later issues I found, I can now get a perfect 1:1 Neofetch output!

@andychu
Copy link
Contributor

andychu commented Apr 8, 2020

This is great! Can you share the patch? I'm interested in how big it is.


I meant that I could use help putting these bugs in the spec test files with some pull requests. That is the first step and is often 50% of the work.

I forget if you have done that before? But it seems like you're one of the best equipped people to do that, i.e. you already are narrowing down the differences very precisely, which is hard for inexperienced shell users.

For example if you search for "failing" here you can see a bunch of commits that @akinomyoga and I added that are only tests:

http://www.oilshell.org/release/0.8.pre3/changelog.html

15ea657

5614b34

3e4ef40

(the way I find which file to add them do is: grep FOO spec/*.test.sh

Any spec tests that reveal a difference between Oil and other shells are accepted, even if we don't actually fix them. (But we almost always will if a real program relies on the behavior, although it's a question of priorities.)


Off the top my head:

I already added them for $_ and the xtrace output.


Anyway it's encouraging we're getting close to running neofetch. That's definite motivation for knocking off the rest of these issues.

Although I think we need to do a "word eval / split / glob overhaul" to fix many at once, and that may take awhile since it's a more fundamental change.

@andychu
Copy link
Contributor

andychu commented Apr 8, 2020

Also, the tests are published with every commit now, and I think it's kind of fun to see the numbers go up and down :)

http://travis-ci.oilshell.org/jobs/2020-04-07__20-22-13.wwz/_tmp/spec/osh.html

@Crestwave
Copy link
Contributor Author

This is great! Can you share the patch? I'm interested in how big it is.

Not too big, actually, now that you've fixed several of the issues: https://github.com/Crestwave/snippets/blob/master/neofetch.patch.

I forget if you have done that before?

Nope; I figured it would do just as much good as the mini-tests I include in these issues. But I'll check it out.

@andychu
Copy link
Contributor

andychu commented Apr 8, 2020

Yeah you're basically already writing them, which is why I asked :) However the spec tests clear up:

  • the behavior of other shells. We also consider non-bash shells. For example I learned that zsh also implements $_, and I learned about a few differences between zsh and bash there.
    • And I also learned that mksh and zsh implement $(<file), and zsh does something different there too.
  • The exact version of bash (right now we have a bash 4.4 binary, but we can upgrade whenever, as I just did for dash). This seems to matter for quite a few tests.

Feel free to ping me on Zulip if you have problems. A few other people have done it so it should be in pretty good condition. The first step is to run test/spec.sh smoke and see if that works on your machine. That runs the cases in spec/smoke.test.sh.

https://github.com/oilshell/oil/wiki/Spec-Tests

@BharathSatheeshKumar
Copy link

Try to parse and run ble.sh #653

@andychu
Copy link
Contributor

andychu commented Mar 4, 2023

@akinomyoga
Copy link
Collaborator

Just to add, ble.sh also uses nocasematch to implement the case-insensitive history search.

@andychu
Copy link
Contributor

andychu commented Jan 18, 2024

Fixed last year, late announcment - https://www.oilshell.org/blog/2024/01/release-0.19.0.html !

@andychu andychu closed this as completed Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants