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

shell scripts in tests have the path #! /bin/bash hardwired #385

Open
rudolfII opened this issue May 19, 2022 · 3 comments · May be fixed by #418
Open

shell scripts in tests have the path #! /bin/bash hardwired #385

rudolfII opened this issue May 19, 2022 · 3 comments · May be fixed by #418

Comments

@rudolfII
Copy link

Perhaps sth like
#!/usr/bin/env bash
would be better (once the todo.sh itself uses that)

Thanks
Ruda

@inkarkat
Copy link
Member

todo.sh itself uses that already; the motivation for that was

Now runs on OpenBSD without errors.

Apparently nobody uses OpenBSD for development :-) (I've used FreeBSD once to troubleshoot issues only found on MacOS.) Still should change it, if only for consistency.

@rudolfII
Copy link
Author

I use OpenBSD; I can run todo.sh, but found that, eg, lsc, lsprj, ... do not work (they show nothing, though they should show something). Hence I tried to run the tests and found the fixed paths. I ran sed to replace those paths, ran the tests (I added '-' to the line 96:
-cd tests && ./$(notdir $@) $(TEST_OPTIONS)
to not stop at the first error) and found quite a few tests fail. The reason is (at least) due to the grep command, which differs between GNU and BSD, in particular:

GNU$ echo @home | grep -o "@[^ ]\\+"
@home
GNU$

while

BSD$ echo @home | grep -o "@[^ ]\\+"
BSD$

BSD does not recognize the \+ repetition. An easy way out could be, in this case
BSD$ echo @home | grep -o "@[^ ][^ ]*"
or use extended regexps with grep -E.

I will perhaps check all the grep calls and rewrite them for myself. (Though, todo.sh has started to seem too complex, so perhaps I will switch to sth. simpler, yet, based on PLAN9.) It still might be of some value to mention requirements somewhere on the project's page. It may, as happened to me, seem that todo.sh is 'just a simple shell script' that might easily run anywhere (with bash, unfortunately), but you actually need GNU grep, and maybe more.

Best regards and thanks,
Ruda

@inkarkat
Copy link
Member

Yeah, you've summarized the state of the code pretty well. Most users use the GNU toolchain (Linux, and Windows with Cygwin); MacOS has always been the problematic one with regards to compatibility, but the BSD family has never been in the focus so far; you might be the first one that attempts to use it there!

I'd certainly welcome a pull request that changes grep to extended regular expressions, if that (plus the use of env bash) already makes todo.sh usable on OpenBSD. Another problem might be with AWK, though. And if you plan to use any add-ons, these probably are even worse (mine included).

@hyperupcall hyperupcall linked a pull request Aug 16, 2023 that will close this issue
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants