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

./build fails on openbsd #282

Closed
KFDCompiled opened this issue Nov 30, 2021 · 9 comments
Closed

./build fails on openbsd #282

KFDCompiled opened this issue Nov 30, 2021 · 9 comments

Comments

@KFDCompiled
Copy link

 ./build -h
./build[409]: formula: parameter not set
@romkatv
Copy link
Owner

romkatv commented Nov 30, 2021

Looks like a bug in your /bin/sh. Can you try it with a different interpreter?

@KFDCompiled
Copy link
Author

that did it, worked fine with bash interpreter after I removed non-existent package install and added package g++. Here's a patchfile showing the two changes:

1c1
< #!/bin/sh
---
> #!/usr/local/bin/bash
94c94
<       command pkg_add install cmake gmake gcc git wget
---
>       command pkg_add cmake gmake gcc g++ git wget

@romkatv
Copy link
Owner

romkatv commented Nov 30, 2021

What's your default sh?

@KFDCompiled
Copy link
Author

default OpenBSD 7.0, which I believe is ksh

@romkatv
Copy link
Owner

romkatv commented Nov 30, 2021

Can you file a bug against ksh or against OpenBSD? I really think that build -h should work with a POSIX sh.

@KFDCompiled
Copy link
Author

Do you have any information that I can include to substantiate bug report? I'm looking for something more than "well, the developer said their code was POSIX compliant..."

@romkatv
Copy link
Owner

romkatv commented Dec 2, 2021

I'm looking for something more than "well, the developer said their code was POSIX compliant..."

I don't think they'll argue.

I'm attaching a reduced file: build.txt

I believe the following will fail on your machine:

curl -fsSLo build.sh https://github.com/romkatv/gitstatus/files/7639815/build.txt
/bin/sh ./build.sh

I don't know how to reduce this file further without having access to your /bin/sh. However, the file is simple enough to see that it's POSIX compliant. One can search for "END" to verify that all expansions of formula about which /bin/sh complains are within a heredoc that shouldn't be expanded.

From https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html chapter 2.7.4:

If any part of word is quoted, [...] the here-document lines shall not be expanded.

@KFDCompiled
Copy link
Author

You're correct, the reduced build.txt also fails with error:
build.sh[392]: formula: parameter not set

I submitted a bug report to [email protected]

@romkatv
Copy link
Owner

romkatv commented Dec 27, 2021

I submitted a bug report to [email protected]

I just saw it. You've attached the full script instead of the reduced one. The smaller the script, the higher the chances anyone will look at it. It's also less work for the maintainers. Ideally, you would need to reduce it to the minimum. You have access to the broken shell, so it's not much work to reduce the script even if you don't understand what it does. But even just submitting the script I've reduced would've been better than submitting the full thing.

FWIW, I was unable to reproduce this bug with ksh in Debian. I don't know which version it is; it does not respond to --version or -V. Edit: $KSH_VERSION is "@(#)MIRBSD KSH R58 2020/03/27".

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

No branches or pull requests

2 participants