Skip to content

bash: upgrade default version to 5#133495

Merged
happysalada merged 3 commits intoNixOS:stagingfrom
happysalada:upgrade_bash
Sep 12, 2021
Merged

bash: upgrade default version to 5#133495
happysalada merged 3 commits intoNixOS:stagingfrom
happysalada:upgrade_bash

Conversation

@happysalada
Copy link
Copy Markdown
Contributor

Motivation for this change

bash default version upgrade

cc @SuperSandro2000 @06kellyjac

@vcunat just leaving a comment here to test this on hydra at some point to verify nothing major breaks. (no rush, I know you are busy).

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • 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 packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • 21.11 Release Notes (or backporting 21.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@github-actions github-actions bot added the 6.topic: stdenv Standard environment label Aug 11, 2021
This was referenced Aug 11, 2021
@06kellyjac
Copy link
Copy Markdown
Member

related: #131681

please update the PR title to match contributing, the same as the last one would do.

Also FYI you can make a new separate branch and push it over the one you were using for the last PR
git push <remote> <branch with new changes>:<branch you are pushing to>

e.g. git push origin upgrade_bash:bash_default_upgrade --force

@happysalada happysalada changed the title Upgrade bash Upgrade default bash version to 5 Aug 11, 2021
@happysalada happysalada changed the title Upgrade default bash version to 5 bash: upgrade default version to 5 Aug 11, 2021
@happysalada
Copy link
Copy Markdown
Contributor Author

Thank you, will definitely remember that one.

@ofborg ofborg bot added 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-linux-stdenv This PR causes stdenv to rebuild on Linux and must target a staging branch. 8.has: clean-up This PR removes packages or removes other cruft 8.has: package (new) This PR adds a new package labels Aug 11, 2021
@ofborg ofborg bot requested review from andir, edolstra, lovek323 and np August 11, 2021 13:48
@ofborg ofborg bot added 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. labels Aug 11, 2021
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This lowPrio should be moved from bashInteractive (5) to bashInteractive_4.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Well spotted, thank you!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed.

@happysalada
Copy link
Copy Markdown
Contributor Author

@vcunat when you have a moment, if you can run a hydra jobset for this PR, it would be great. I know you are busy, no rush.
This PR is fairly simple, so hopefully it should go smoothly.

@andersk
Copy link
Copy Markdown
Contributor

andersk commented Aug 20, 2021

Should we keep bash_5 and bashInteractive_5 around as aliases (or vice versa) for those who might have already been using them?

@happysalada
Copy link
Copy Markdown
Contributor Author

I personally would tend to say no, as the upgrade should be straightforward. (I know I'm biased toward breaking things, to signify that something has changed, so I'm open to other opinions).
Perhaps we should add something in the next release notes ? I would prefer to do that in another PR after this one has been merged.

@06kellyjac
Copy link
Copy Markdown
Member

I don't see a reason not to do an update to the release notes and docs in this same PR

@github-actions github-actions bot added the 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS label Aug 20, 2021
@vcunat
Copy link
Copy Markdown
Member

vcunat commented Aug 29, 2021

Hydra is quite busy with security rebuild from OpenSSL (master now, 21.05 soon), so it will take at least a few days before there's capacity for that.

@happysalada
Copy link
Copy Markdown
Contributor Author

No worries, I'll ping again next week. Thank you for having checked!

@happysalada
Copy link
Copy Markdown
Contributor Author

A hydra job has been created on aarch64-linux for this https://hydra.nixos.org/jobset/nixpkgs/bash-5#tabs-evaluations
no failure due to this upgrade has been detected.
It's not a complete assurance that things are working, but it's a strong enough signal to merge in my opinion.
I will wait a couple more days in case people are against this.

@nrdxp
Copy link
Copy Markdown

nrdxp commented Sep 11, 2021

I would actually merge this right now, but it looks like some conflicts have cropped up...

@SuperSandro2000 SuperSandro2000 added the 2.status: merge conflict This PR has merge conflicts with the target branch label Sep 11, 2021
somehow `read -N 0` behavior changed in bash 5. `read -d ''` has identical behavior
the purpose of the function is to read stdin and exit 1 on a null byte (i.e. if stdin is the content of a binary)

(cherry picked from commit 5d0acf2)
@happysalada
Copy link
Copy Markdown
Contributor Author

Just rebased, merging then. Thank you all for the time and care given to this!

@happysalada happysalada merged commit 30a04a1 into NixOS:staging Sep 12, 2021
@happysalada happysalada deleted the upgrade_bash branch September 12, 2021 00:48
@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Sep 12, 2021
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. and removed 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-linux-stdenv This PR causes stdenv to rebuild on Linux and must target a staging branch. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. labels Sep 12, 2021
@trofi
Copy link
Copy Markdown
Contributor

trofi commented Oct 31, 2021

Broke one mrsh test: https://hydra.nixos.org/build/155384906 (bash changed behaviour).

@happysalada
Copy link
Copy Markdown
Contributor Author

@trofi sorry about that! The failure isn't super clear from reading the logs. I'm curious about the change of behavior if you have more information. You probably know this but the bash changelog is not complete and so it makes it very hard to know what will actually break.

@trofi
Copy link
Copy Markdown
Contributor

trofi commented Nov 1, 2021

I only superficially looked at the test. It compares the output from mrsh (unchanged) to ouput from bash on the same test script (bash changed from 4 to 5). Let me try to dig the details out.

@trofi
Copy link
Copy Markdown
Contributor

trofi commented Nov 1, 2021

The following command changed behaviour under sh (but not bash):

a=~/foo:~/bar:~/baz; echo $a
$ nix build -f '<nixpkgs>' bash bash_4
$ ls -l
lrwxrwxrwx 1 slyfox users 55 Nov  1 21:52 result -> /nix/store/wadmyilr414n7bimxysbny876i2vlm5r-bash-5.1-p8
lrwxrwxrwx 1 slyfox users 56 Nov  1 21:52 result-1 -> /nix/store/4y0aacvxrkj3v7wayxpfxjda3km7c72a-bash-4.4-p23

$ /nix/store/wadmyilr414n7bimxysbny876i2vlm5r-bash-5.1-p8/bin/sh -c 'a=~/foo:~/bar:~/baz; echo $a'
/home/slyfox/foo:~/bar:~/baz
$ /nix/store/wadmyilr414n7bimxysbny876i2vlm5r-bash-5.1-p8/bin/bash -c 'a=~/foo:~/bar:~/baz; echo $a'
/home/slyfox/foo:/home/slyfox/bar:/home/slyfox/baz
$ /nix/store/4y0aacvxrkj3v7wayxpfxjda3km7c72a-bash-4.4-p23/bin/bash -c 'a=~/foo:~/bar:~/baz; echo $a'
/home/slyfox/foo:/home/slyfox/bar:/home/slyfox/baz
$ /nix/store/4y0aacvxrkj3v7wayxpfxjda3km7c72a-bash-4.4-p23/bin/sh -c 'a=~/foo:~/bar:~/baz; echo $a'
/home/slyfox/foo:/home/slyfox/bar:/home/slyfox/baz

sh under bash-5 stopped expanding ~ in the middle of a string before :. Not sure if it's intended or not.

@andersk
Copy link
Copy Markdown
Contributor

andersk commented Nov 1, 2021

Looks intentional. From the bash-5.1-beta changelog:

  1. Changes to Bash

    g. Avoid performing tilde expansion after `:' in words that look like assignment statements when in posix mode.

Although, hmm, that seems to contradict POSIX, which says:

In an assignment (see XBD Variable Assignment), multiple tilde-prefixes can be used: at the beginning of the word (that is, following the <equals-sign> of the assignment), following any unquoted <colon>, or both.

@andersk
Copy link
Copy Markdown
Contributor

andersk commented Nov 1, 2021

I reported a Bash bug about the apparent POSIX violation with some more context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: stdenv Standard environment 8.has: changelog This PR adds or changes release notes 8.has: clean-up This PR removes packages or removes other cruft 8.has: documentation This PR adds or changes documentation 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants