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

cc-wrapper: disable POSIX compatibility #30483

Merged
merged 1 commit into from Nov 5, 2017
Merged

Conversation

abbradar
Copy link
Member

@abbradar abbradar commented Oct 16, 2017

Motivation for this change

When POSIXLY_CORRECT environment variable is set the script runs in sh compatibility mode, which fails because we use process piping in utils.sh. This patch explicitly disables POSIX compatibility mode.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

Checked by unsafe editing of script in Nix store and running the compiler on configure script which mysteriously failed before.

Copy link
Member

@Ericson2314 Ericson2314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should make the same change in ld-wrapper.sh, but +1 on concept.

@abbradar
Copy link
Member Author

abbradar commented Oct 16, 2017

@Ericson2314 fixed!

EDIT: Fixed also for GNAT.

@edolstra
Copy link
Member

I don't understand the motivation. Where are we setting POSIXLY_CORRECT? Why do we suddenly need to disable POSIX compatibility, whatever that is?

@abbradar
Copy link
Member Author

@edolstra A random configure script that I encountered sets POSIXLY_CORRECT environment variable and then runs GCC. Turns out bash reacts to that variable and turns POSIX compatibility mode (think sh instead of bash -- no Bash extensions) by default, which breaks our script. This patch explicitly always disables this compatibility mode, just in case.

P.S. I have no idea what Bash developers were thinking when they allowed an environment variable to change how a script is evaluated but oh well.

@abbradar
Copy link
Member Author

I'll merge this in several days if noone objects, preferrably after current staging gets in master so that I can proceed with #30433 and related work.

Copy link
Contributor

@orivej orivej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the third known case of POSIXLY_CORRECT or set -o posix causing trouble, the previous was in #28255 (comment)

@abbradar
Copy link
Member Author

abbradar commented Nov 4, 2017

I wanted to merge this with several additional wrapper patches but I still need to work on them some more. Feel free to batch this together with any mass rebuild change!

@dezgeg
Copy link
Contributor

dezgeg commented Nov 5, 2017

There's one gawk update right now, taking with it.

@dezgeg dezgeg merged commit 5f3b84e into NixOS:staging Nov 5, 2017
ajs124 pushed a commit that referenced this pull request May 21, 2021
I'm not sure why this patch was needed,
but it builds and works find without it now.
Maybe this is connected with
#30483
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants