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

Fix run-compiler for old /bin/sh #11228

Closed
wants to merge 1 commit into from

Conversation

asedeno
Copy link
Contributor

@asedeno asedeno commented May 30, 2023

If you try to assign and export on the same line on some older /bin/sh implementations, it complains:

$ export "NAME=value"
NAME=value: is not an identifier

Also, as written, the name and value are quoted together. This also makes old /bin/sh sad:

$ "NAME=value"
NAME=value: not found

This commit rewrites run-compiler's assignments and exports to work with old /bin/sh, splitting assignment and export into two separate statements, and only quote the value. So now we have:

NAME="value"
export NAME

While we're here, make the same change to the two supporting assign+export lines preceeding the script to be consistent with how exports work throughout the rest of configure.ac.

If you try to assign and export on the same line on some older /bin/sh
implementations, it complains:

```
$ export "NAME=value"
NAME=value: is not an identifier
```

Also, as written, the name and value are quoted together. This also
makes old /bin/sh sad:

```
$ "NAME=value"
NAME=value: not found
```

This commit rewrites run-compiler's assignments and exports to work
with old /bin/sh, splitting assignment and export into two separate
statements, and only quote the value. So now we have:

```
NAME="value"
export NAME
```

While we're here, make the same change to the two supporting
assign+export lines preceeding the script to be consistent with how
exports work throughout the rest of configure.ac.
@github-actions github-actions bot added the build label May 30, 2023
@emanuele6
Copy link
Contributor

Splitting assignments and export into multiple commands to make the script work in older systems with an sh interpreters that doesn't comply with POSIX issue 6 or issue 7 is fine. 👍

Also, as written, the name and value are quoted together. This also makes old /bin/sh sad:

$ "NAME=value"
NAME=value: not found

That makes any sh sad, not only old sh. :(
Assignments only need to be quoted if they are an argument to a command like export.

@asedeno
Copy link
Contributor Author

asedeno commented May 31, 2023

That makes any sh sad, not only old sh. :( Assignments only need to be quoted if they are an argument to a command like export.

Fair enough, we can rewrite the commit message to drop that note if we like.

@bagder
Copy link
Member

bagder commented May 31, 2023

Thanks!

@bagder bagder closed this in 5a02393 May 31, 2023
bch pushed a commit to bch/curl that referenced this pull request Jul 19, 2023
If you try to assign and export on the same line on some older /bin/sh
implementations, it complains:

```
$ export "NAME=value"
NAME=value: is not an identifier
```

This commit rewrites run-compiler's assignments and exports to work with
old /bin/sh, splitting assignment and export into two separate
statements, and only quote the value. So now we have:

```
NAME="value"
export NAME
```

While we're here, make the same change to the two supporting
assign+export lines preceeding the script to be consistent with how
exports work throughout the rest of configure.ac.

Closes curl#11228
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

3 participants