-
-
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
Test OSH on real shell scripts #161
Comments
How do we contribute after testing the scripts? |
If the script doesn't behave the same way that it does under bash, then definitely file a bug here. If it works, you can simply reply to this bug (#161) or you can post a message on #oil-discuss at https://oilshell.zulipchat.com/ . I'd like to hear success stories! Also, I added an option for "deep testing", which I should document. After installing OSH, you can now do this:
If foo.sh has a shebang of It's also possible to view the debug stream like this:
I've mentioned this in a few places, but I should write a blog post about it: https://github.com/oilshell/oil/wiki/Debugging-Completion-Scripts Thanks for asking and let me know if you have problems testing! Someone already reported a Ctrl-C bug that I didn't know about, so I'm sure there are more issues. Everybody tickles a different part of the shell :) |
This wiki page will have some ideas of things to test: https://github.com/oilshell/oil/wiki/Shell-Programs-That-Run-Under-OSH |
Pure Bash programs tend to use more obscure Bash features and thus are good for testing. @dylanaraps has quite a few of them, e.g., https://github.com/dylanaraps/pure-bash-bible, https://github.com/dylanaraps/birch, etc. |
The popular shell script neofetch is non-functional when ran through osh. It simply outputs four errors.
|
I'm willing to help in any way I can. I've been following this project for quite a while. 👍 It might be a better first step to test some POSIX These would also make a good |
Of note, osh is 0/6 on running your codegolf snippets @dylanaraps. |
@dylanaraps I recognize your project because @Crestwave mentioned it! If you are interested in contributing to Oil I'm available to help, either here or on https://oilshell.zulipchat.com @wertercatt A list of all the failures would be useful! |
|
Yes the
|
Hm and the fibonacci script tickles a strictness errors I recognize... I'm not sure yet if it justifies relaxing them. |
If you'd like to avoid the "Command not found" error you can just add the : 1
history -p $[{1..31},i+=_,_=i-_] As it's a "golf" to save 2 characters I drop the builtin ( |
The popular interactive shell enhancement thefuck also breaks when osh usage is attempted. (/bin/bash demonstration included for clarity.)
|
https://gist.github.com/wertercatt/5820fe28f9e107a55d6f28929c919c8f |
Decided to test random shell scripts in my /usr/bin/ as well, and found one from a popular program that completely crashes osh! https://gist.github.com/wertercatt/a84e728ef0d87e6478f2ce072f36d715
|
@wertercatt Thanks, I just filed that as #361 and fixed it. These bug reports are great! Keep them coming. They all seem valid, so please open new issues rather than adding to this one. They will be less likely to get lost that way! (And yes help is appreciated :) I will help anyone get up to speed with the code, which is plain Python with a bunch of build steps that are automated.) |
FWIW I went back and tried some of the codegolf ones:
The others don't work because:
FizzBuzz doesn't work for me in bash 4.3 or 4.4?
The last two releases have fixed a ton of stuff due to ble.sh and some reports from Crestwave! I think #679 to run neofetch is getting close. |
What's wrong with the output? If you're referring to the error messages, only stdout is counted in the golf and the stderr junk is intended. You can prepend it with The prime numbers program works with The divisors program doesn't work even with workarounds for the lack of The FizzBuzz program doesn't work even with workarounds for the lack of osh$ echo $((1?2?3:4:5))
echo $((1?2?3:4:5))
^
[ interactive ]:1: Parser expected Id.Arith_Colon, got Id.Arith_QMark $ echo $((1?2?3:4:5))
3
|
Ah OK thanks for the diagnosis. Even after 4 years of writing a shell those programs give me headaches :-) But they are useful for finding bugs -- I filed an issue for what I suspect is a parsing error. Keep the reports coming -- I think Oil is converging, given that
And C++ translation is working out too, so Oil will eventually be fast. |
FWIW there are more than 17 issues fixed for the next release, so it should be a significant jump in compatibility. Thanks for all the reports! |
@dylanaraps Thanks for accepting the patch to neofetch! I mentioned this on the latest release: http://www.oilshell.org/blog/2020/04/release-0.8.pre4.html (if you haven't seen it already) I tried neofetch from head under OSH 0.8.pre4 and it works great. It's slow as expected, but we've been making good progress on that ! As mentioned in the release notes I'm curious how much of neofetch runs on these invocations, e.g. is it closer to 1K lines or 9K lines? So #687 for coverage has been on my mind. And it would also be useful for ble.sh. I'm also looking for shell experts to help test and design Oil. For example I want to fix original neofetch issue: #679
compared with
|
Another big program to test is Paludis, Exherbo package manager. It is written in C++ but rely heavily on Bash scripts for the package format. According to tokei, its codebase contains ~16000 lines of shell code. |
This is one of the best ways to help the project! Find some important / interesting shell scripts, and run them with OSH.
There are a bunch of ideas in test/wild.sh, and published with each release:
http://www.oilshell.org/release/0.5.0/test/wild.wwz/
Off the top of my head, these capture the flag scripts are interesting:
https://github.com/janosgyerik/capture-the-flag
The text was updated successfully, but these errors were encountered: