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

buildenv: read propagated-user-env-packages line-by-line #27427

Merged
merged 1 commit into from Jul 17, 2017

Conversation

ttuegel
Copy link
Member

@ttuegel ttuegel commented Jul 16, 2017

Motivation

Since 3cb745d, the format of
propagated-user-env-packages has changed and propagated packages have not been
included by buildenv, including in the system environment.

The buildenv builder is modified to read propagated-user-env-packages
line-by-line, instead of expecting all packages on one line.

Testing
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • 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.

This is a rebuild-the-world bugfix, so nobody is going to merge this into staging until those boxes above are checked.

Input from any Perl experts is welcome. I think this will work now, but even with 16 cores it will take me a minute or two to find out. 🙄

@Ericson2314 Several things were broken by this. I expect if you had run the NixOS tests before merging, you would have discovered that and prevented this.

@mention-bot
Copy link

@ttuegel, thanks for your PR! By analyzing the history of the files in this pull request, we identified @edolstra, @aszlig and @rasendubi to be potential reviewers.

@Ericson2314
Copy link
Member

Ericson2314 commented Jul 16, 2017

@ttuegel Sorry! I've been unsure of exactly how much testing staging PRs are supposed to receive---exhaustive testing is easier without a mass rebuild of course, and rebuilding both stdenvs as I have been doing already takes a while.

In this specific case, I tried to grep for all instances of the changed files' names and audit them, but regrettably forgot that one. Part of the problem might have been that I originally I didn't intend to mess with propagated-user-env-packages, but then had to due to the the symlinking that occurs between it an the other.


I don't know Perl, but your change looks correct based on what is there before, and certainly the idea is right---hence my approval.

@ttuegel
Copy link
Member Author

ttuegel commented Jul 16, 2017

This patch is not correct. Apparently, Perl does not trim trailing newlines when reading a file line-wise. 🙄

Since 3cb745d, the format of
propagated-user-env-packages has changed and propagated packages have not been
included by buildenv, including in the system environment.

The buildenv builder is modified to read propagated-user-env-packages
line-by-line, instead of expecting all packages on one line.
@ttuegel ttuegel force-pushed the bugfix/buildenv-propagated branch from 380c5ca to dce958a Compare July 16, 2017 21:07
@vcunat
Copy link
Member

vcunat commented Jul 17, 2017

There's also a buildenv script in nix-env – does that mean it's broken now?

@ttuegel
Copy link
Member Author

ttuegel commented Jul 17, 2017

There's also a buildenv script in nix-env – does that mean it's broken now?

Yes. Both the Perl script in the released version and the unreleased C++ version are now broken.

@Ericson2314
Copy link
Member

Ericson2314 commented Jul 17, 2017

Oh jeeze, did not realize I was changing an interface of Nix itself. Well, if we want to keep my change, Nix can be compatible with both the old and the new by reading in the entire file and breaking on white-space (in a double loop for example). I would be happy to make the patch or the reversion.

@ttuegel
Copy link
Member Author

ttuegel commented Jul 17, 2017

Well, if we want to keep my change, Nix can be compatible with both the old and the new by reading in the entire file and breaking on white-space (in a double loop for example).

I think it would be better just to use buildEnv from Nixpkgs for nix-env. Note that Nix already depends on Nixpkgs because nix-shell uses runCommand. Making Nix compatible with both conventions doesn't suit the purpose of allowing spaces in store paths.

Arguably, Nix should not depend on Nixpkgs at all, but if it's going to, it should at least depend on high-level interfaces.

I would be happy to make the patch or the reversion.

I may be alone, but I would prefer not to revert this. I think newline-separated lists is the correct way to do it and ultimately the way we must go. We have already had one rebuild due to this, I would hate to revert it, incur another rebuild, and then eventually bring it back and get another rebuild.

@ttuegel
Copy link
Member Author

ttuegel commented Jul 17, 2017

OK, this works correctly on NixOS. Because it's a platform independent change, I expect it will work on macOS, too. It would be difficult to check every package that depends on this, because it's a mass rebuild, but if it's still broken, it's at least less broken now.

@oxij
Copy link
Member

oxij commented Jul 23, 2017 via email

@Ericson2314
Copy link
Member

Ericson2314 commented Jul 23, 2017

NixOS/nix#1480 and NixOS/nix#1482 are the Nix 1.12 and 1.11 PRs, respectably, for being compatible with space-separated or line-separated entries.

@oxij
Copy link
Member

oxij commented Jul 23, 2017 via email

@oxij
Copy link
Member

oxij commented Jul 23, 2017 via email

@Ericson2314
Copy link
Member

Ericson2314 commented Jul 23, 2017

@oxij I'm not against reverting---it would be more work for me as other commits of mine on top rely on it and also would have to be reverted but I have already caused more work and pain than than that from the reversion for many other people.

But I do think the line-based way is ultimately better, which I think everyone agrees. Insofar that the patches move us one step closer to that, and do not interfere with a revert, I see no issues with merging them once I can test them.

Also, keep in mind

  • For users that can update Nix manually, doing so is a more immediate solution than waiting for the channels to catch up to the revert.

  • As this PR has been merged, it already destined to hit master at some point.

@oxij
Copy link
Member

oxij commented Jul 24, 2017 via email

@Ericson2314
Copy link
Member

Ericson2314 commented Jul 24, 2017

@oxij Ah, I didn't realize that was an easy revert---I got confused with the Darwin problems I also caused which are less so. edit Ah but it causes a merge conflict with staging where I did do follow-up commits. I decided the hash-breakage is worse than that + pain of double mass rebuild---I'll deal with that tomorrow. [N.B this PR is still on staging; the merge conflict will for the next few hours prevent it making it to master and getting us in an inconsistent state.]

propagates at least some of the problems directly into /nix/store

Woah. Ok that's real bad CC @edolstra. I'm reverting now.

Which, by the way, is another reason to use buildEnv from nixpkgs in nix instead of the builtin buildenv, but I digress.

Well, it is interesting and not coincident that the breakage I cause both this this and Darwin nix-env stem from impurities. I would like to see some real solutions to the long-standing warts around both of those.

@Ericson2314
Copy link
Member

Done in b087618

Ericson2314 added a commit that referenced this pull request Jul 24, 2017
As @oxij points out in [1], this breakage is especially serious because
it changes the contents of built environments without a corresonding
change in their hashes. Also, the revert is easier than I thought.

This reverts commit 3cb745d.

[1]: #27427 (comment)
@Ericson2314
Copy link
Member

@oxij Now that that is done, I would like to talk about changing the format in a more controlled process. @ttuegel This unfortunately would mean yet another mass rebuild, but are you still interested in switching away from space-separated?

I wouldn't be opposed to \0 as a deliminator. My reasoning for '\n'-deliminated was that, as we don't support arbitrary path, it is both easiest to read as a human, and easiest to work with in lousy scripting languages.

@FRidh
Copy link
Member

FRidh commented Jul 24, 2017

@Ericson2314 so will you merge master into staging now then?


I've just encountered an odd bug on staging that doesn't happen on master.

$ nix-build -A python.pkgs.oslo-config
these derivations will be built:
  /nix/store/96ywyrxfhl7lqi07mdjx0zqbnwcv0izj-python2.7-oslo.config-2.5.0.drv
building path(s) ‘/nix/store/wgb3i1kchx8g09qxsgg2yvyfjxpafyya-python2.7-oslo.config-2.5.0’
unpacking sources
unpacking source archive /nix/store/y7wdfdh7jfic9j1bss9v6qw32zbvgbz1-oslo.config-2.5.0.tar.gz
source root is oslo.config-2.5.0
setting SOURCE_DATE_EPOCH to timestamp 1444662971 of file oslo.config-2.5.0/setup.cfg
patching sources

builder for ‘/nix/store/96ywyrxfhl7lqi07mdjx0zqbnwcv0izj-python2.7-oslo.config-2.5.0.drv’ failed with exit code 1
error: build of ‘/nix/store/96ywyrxfhl7lqi07mdjx0zqbnwcv0izj-python2.7-oslo.config-2.5.0.drv’ failed

Another failure without any helpful output. Note that b087618 doesn't matter.

@ttuegel
Copy link
Member Author

ttuegel commented Jul 24, 2017

I wouldn't be opposed to \0 as a deliminator. My reasoning for '\n'-deliminated was that, as we don't support arbitrary path, it is both easiest to read as a human, and easiest to work with in lousy scripting languages.

The only thing I have to say is: if we are going to use something weird (i.e. not \n and not ) then we should use one of the ASCII delimiter characters.

@oxij
Copy link
Member

oxij commented Jul 24, 2017 via email

@Ericson2314
Copy link
Member

Ericson2314 commented Jul 24, 2017

@oxij So I'm now thinking it's import that when reading we support both ' ' and whatever the new deliminator is, not only so new Nix supports old nixpkgs, but so that packages from different nixpkgs can be mixed together. It wouldn't be a breaking change for Nix or Nixpkgs, but just a bump of lib/minver.nix. The old deliminator, ' ' would be considered deprecated, however. Down the road, when Nixpkgs has been using the new deliminator for a major release or two, we can then stop accepting it on read---a breaking change but one causing little breakage in practice.

Given that plan, however, I find using '\0' somewhat unpalatable because that would mean using '\0' and ' ' as deliminator which strikes me as very odd / giving a false sense of security. But, I could be convinced as the plan is to deprecate ' ' eventually anyways.

@oxij
Copy link
Member

oxij commented Jul 28, 2017 via email

jerith666 added a commit to jerith666/nixpkgs that referenced this pull request Aug 5, 2017
@jerith666
Copy link
Contributor

Noting here that both b087618 and f6f40e3 were nominal reverts of 3cb745d. They were merged in 9be4084, where the approach of f6f40e3 was taken. So the net result on both master and staging currently is not an exact revert of 3cb745d.

I'm not familiar enough with nix to really say whether that matters.

However, I'm in the process of building a nix expr for OpenJDK 9 over in #27194, and need to know whether I should be using echo -n or printWords in my 9.nix, which is a copy of 8.nix. Thanks!

@Ericson2314
Copy link
Member

@jerith666 it probably doesn't matter, but try printWords.

NeQuissimus pushed a commit to NeQuissimus/nixpkgs that referenced this pull request Sep 22, 2017
* openjdk 8: code cleanup

as recommended by 0xABAB in NixOS#27194

* openjdk 9: init at ea build 176

this starts with copy of 8.nix and just updates hashes and replaces 8
with 9.  it also tweaks the version handling because we aren't dealing
with an update version yet.

* openjdk 9: adapt patches from openjdk 8

fix-java-home: surrounding code changed slightly

swing-use-gtk-jdk9: location of the file being patched changed due to
modularization

read-truststore-from-env: the code that handles the trustStore was
refactored out into a helper class in upstream commit
http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/904861872c0e

adlc_updater: this isn't present anymore

* openjdk 9: make two more warnings-as-errors non-fatal

this requires that we switch to configureFlagsArray to deal with
whitespace

the errors being suppressed are show below:

* For target support_native_java.desktop_libawt_xawt_awt_Robot.o:
/tmp/nix-build-openjdk-9ea-b176.drv-0/jdk9-jdk-9+176/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c: In function 'isXCompositeDisplay':
/tmp/nix-build-openjdk-9ea-b176.drv-0/jdk9-jdk-9+176/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c:152:50: error: embedded '\0' in format
[-Werror=format-contains-nul]
     snprintf(NET_WM_CM_Sn, sizeof(NET_WM_CM_Sn), "_NET_WM_CM_S%d\0", screenNumber);
                                                  ^
/tmp/nix-build-openjdk-9ea-b176.drv-0/jdk9-jdk-9+176/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c:152:50: error: embedded '\0' in format
[-Werror=format-contains-nul]
cc1: all warnings being treated as errors
* For target support_native_jdk.hotspot.agent_libsa_ps_core.o:
/tmp/nix-build-openjdk-9ea-b176.drv-0/jdk9-jdk-9+176/hotspot/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c: In function 'read_exec_segments':
/tmp/nix-build-openjdk-9ea-b176.drv-0/jdk9-jdk-9+176/hotspot/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c:834:7: error: ignoring return value of 'pread', declared
with attribute warn_unused_result [-Werror=unused-result]
       pread(ph->core->exec_fd, interp_name, exec_php->p_filesz, exec_php->p_offset);
       ^
cc1: all warnings being treated as errors

* openjdk 9: ea+176 -> ea+180

* openjdk 9: TODO disable infinality patches, at least to start

the code being patched here seems to have changed substantially or
perhaps even disappeared altogether.  need to investigate whether
these patches are still relevant.

* openjdk 9: update installPhase for modularization

* separate jdk and jre images are now present under build/*/images

* samples have been removed (JEP 298)
  -- TODO that JEP says demos will be gone too, but it seems some are still present?

* bina directory is no longer present

* openjdk 9: TODO handle *.pf files or purge this code completely

* openjdk 9: update minimal jre components

in particular, the name of the config option for headless has changed,
per https://bugs.openjdk.java.net/browse/JDK-8163102

* TODO about echo -n vs printWords, NixOS#27427
NeQuissimus pushed a commit that referenced this pull request Sep 27, 2017
* openjdk 8: code cleanup

as recommended by 0xABAB in #27194

* openjdk 9: init at ea build 176

this starts with copy of 8.nix and just updates hashes and replaces 8
with 9.  it also tweaks the version handling because we aren't dealing
with an update version yet.

* openjdk 9: adapt patches from openjdk 8

fix-java-home: surrounding code changed slightly

swing-use-gtk-jdk9: location of the file being patched changed due to
modularization

read-truststore-from-env: the code that handles the trustStore was
refactored out into a helper class in upstream commit
http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/904861872c0e

adlc_updater: this isn't present anymore

* openjdk 9: make two more warnings-as-errors non-fatal

this requires that we switch to configureFlagsArray to deal with
whitespace

the errors being suppressed are show below:

* For target support_native_java.desktop_libawt_xawt_awt_Robot.o:
/tmp/nix-build-openjdk-9ea-b176.drv-0/jdk9-jdk-9+176/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c: In function 'isXCompositeDisplay':
/tmp/nix-build-openjdk-9ea-b176.drv-0/jdk9-jdk-9+176/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c:152:50: error: embedded '\0' in format
[-Werror=format-contains-nul]
     snprintf(NET_WM_CM_Sn, sizeof(NET_WM_CM_Sn), "_NET_WM_CM_S%d\0", screenNumber);
                                                  ^
/tmp/nix-build-openjdk-9ea-b176.drv-0/jdk9-jdk-9+176/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c:152:50: error: embedded '\0' in format
[-Werror=format-contains-nul]
cc1: all warnings being treated as errors
* For target support_native_jdk.hotspot.agent_libsa_ps_core.o:
/tmp/nix-build-openjdk-9ea-b176.drv-0/jdk9-jdk-9+176/hotspot/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c: In function 'read_exec_segments':
/tmp/nix-build-openjdk-9ea-b176.drv-0/jdk9-jdk-9+176/hotspot/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c:834:7: error: ignoring return value of 'pread', declared
with attribute warn_unused_result [-Werror=unused-result]
       pread(ph->core->exec_fd, interp_name, exec_php->p_filesz, exec_php->p_offset);
       ^
cc1: all warnings being treated as errors

* openjdk 9: ea+176 -> ea+180

* openjdk 9: TODO disable infinality patches, at least to start

the code being patched here seems to have changed substantially or
perhaps even disappeared altogether.  need to investigate whether
these patches are still relevant.

* openjdk 9: update installPhase for modularization

* separate jdk and jre images are now present under build/*/images

* samples have been removed (JEP 298)
  -- TODO that JEP says demos will be gone too, but it seems some are still present?

* bina directory is no longer present

* openjdk 9: TODO handle *.pf files or purge this code completely

* openjdk 9: update minimal jre components

in particular, the name of the config option for headless has changed,
per https://bugs.openjdk.java.net/browse/JDK-8163102

* TODO about echo -n vs printWords, #27427

(cherry picked from commit 02fe120)
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

7 participants