NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.07k stars 14.08k forks source link

sqitchPg does not work on NixOS 23.11 #275647

Open datafoo opened 10 months ago

datafoo commented 10 months ago

Describe the bug

sqitchPg does not work on NixOS 23.11

Steps To Reproduce

Steps to reproduce the behavior:

  1. Use channel https://channels.nixos.org/nixos-23.11
  2. Install sqitchPg
    environment.systemPackages = [
      pkgs.sqitchPg
    ];
  3. Try to use sqitch
    [root@mymachine:/etc/nixos]# sqitch --version
    Constants from lexical variables potentially modified elsewhere are no longer permitted at /nix/store/afz9z2iczjx13i66ymwwinwp2zvgc1ck-perl-5.38.0/lib/perl5/5.38.0/constant.pm line 41.
    BEGIN failed--compilation aborted at /nix/store/afz9z2iczjx13i66ymwwinwp2zvgc1ck-perl-5.38.0/lib/perl5/5.38.0/constant.pm line 45.
    Compilation failed in require at /nix/store/afz9z2iczjx13i66ymwwinwp2zvgc1ck-perl-5.38.0/lib/perl5/5.38.0/Getopt/Long.pm line 222.
    BEGIN failed--compilation aborted at /nix/store/afz9z2iczjx13i66ymwwinwp2zvgc1ck-perl-5.38.0/lib/perl5/5.38.0/Getopt/Long.pm line 222.
    Compilation failed in require at /nix/store/f18qfbr6y94k43g7nija4rhvg1xjnggr-perl5.38.0-App-Sqitch-1.4.0/lib/perl5/site_perl/5.38.0/App/Sqitch.pm line 9.
    BEGIN failed--compilation aborted at /nix/store/f18qfbr6y94k43g7nija4rhvg1xjnggr-perl5.38.0-App-Sqitch-1.4.0/lib/perl5/site_perl/5.38.0/App/Sqitch.pm line 9.
    Compilation failed in require at /nix/store/bij7i7q4bwy5jr0a5kyb85hq9awnj8gv-sqitch-pg-1.4.0/bin/.sqitch-wrapped line 13.
    BEGIN failed--compilation aborted at /nix/store/bij7i7q4bwy5jr0a5kyb85hq9awnj8gv-sqitch-pg-1.4.0/bin/.sqitch-wrapped line 13.

Expected behavior

sqitch commands should work. In the case of sqitch --version, it should just return the version such as:

[root@mymachine:/etc/nixos]# sqitch --version
.sqitch-wrapped (App::Sqitch) v1.3.1

Additional context

I pinned NixOS on various commits to try to pinpoint where this failure appears.

So, I suspect the failure was introduced with PR #241848.

Notify maintainers

@stigtsp

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
- system: `"x86_64-linux"`
 - host os: `Linux 6.1.65, NixOS, 23.11 (Tapir), 23.11.1494.b4372c4924d9`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - channels(me): `"home-manager-23.05.tar.gz"`
 - channels(root): `"nixos-23.11"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Add a :+1: reaction to issues you find important.

stigtsp commented 10 months ago

Likely fixed by updating perlPackages.AppSqitch to 1.4.0

https://metacpan.org/release/DWHEELER/App-Sqitch-v1.4.0/source/Changes

datafoo commented 10 months ago

You can notice the text App-Sqitch-1.4.0 within the logs I posted earlier. So I suspect the latest of NixOS 23.11 is already using sqitch 1.4.0 but that does not fix the problem.

stigtsp commented 10 months ago

You can notice the text App-Sqitch-1.4.0 within the logs in posted earlier. So I suspect the latest of NixOS 23.11 is already using sqitch 1.4.0 but that does not fix the problem.

Ah yes! You are right, sorry was looking at an outdated nixpkgs checkout. I'll have a look at this.

stigtsp commented 10 months ago

Hi there, I'm having some problems reproducing this:

On d02ffbbe834b (latest 23.11):

$ nix build .#sqitchPg; and result/bin/sqitch --version                                                                                                                                                                                                                                           
.sqitch-wrapped (App::Sqitch) v1.4.0

On 7d1cd12633cb12eb05014ccd33d6931691b52ce9 (latest master):

$ nix build .#sqitchPg; and result/bin/sqitch --version                                                                                                                                                                                                                                                  
.sqitch-wrapped (App::Sqitch) v1.4.0

Can you confirm the commit you're on?

datafoo commented 10 months ago

I have checked out nixpkgs locally and ran the same commands as you did.

[me@mymachine:~/dev/public/nixpkgs]$ git co master 
Switched to branch 'master'
Your branch is up to date with 'origin/master'.

[me@mymachine:~/dev/public/nixpkgs]$ git st
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

[me@mymachine:~/dev/public/nixpkgs]$ git last 
commit 7d1cd12633cb12eb05014ccd33d6931691b52ce9 (HEAD -> master, upstream/master, origin/master, origin/HEAD)
Merge: 1a499bdaea04 0066ffc7444a
Author: Nick Cao <nickcao@nichi.co>
Date:   Wed Dec 20 09:29:43 2023 -0500

    Merge pull request #275634 from Kiskae/nvidia/535.43.22

    linuxPackages.nvidia_x11_vulkan_beta: 535.43.20 -> 535.43.22

[me@mymachine:~/dev/public/nixpkgs]$ nix build .#sqitchPg

[me@mymachine:~/dev/public/nixpkgs]$ result/bin/sqitch --version
Constants from lexical variables potentially modified elsewhere are no longer permitted at /nix/store/fx9hkrym88ahxkibcqnkl8907vakbqvg-perl-5.38.2/lib/perl5/5.38.2/constant.pm line 41.
BEGIN failed--compilation aborted at /nix/store/fx9hkrym88ahxkibcqnkl8907vakbqvg-perl-5.38.2/lib/perl5/5.38.2/constant.pm line 45.
Compilation failed in require at /nix/store/fx9hkrym88ahxkibcqnkl8907vakbqvg-perl-5.38.2/lib/perl5/5.38.2/Getopt/Long.pm line 222.
BEGIN failed--compilation aborted at /nix/store/fx9hkrym88ahxkibcqnkl8907vakbqvg-perl-5.38.2/lib/perl5/5.38.2/Getopt/Long.pm line 222.
Compilation failed in require at /nix/store/wg3dab1g2gn94b4948sdq9z5q4fg1c3d-perl5.38.2-App-Sqitch-1.4.0/lib/perl5/site_perl/5.38.2/App/Sqitch.pm line 9.
BEGIN failed--compilation aborted at /nix/store/wg3dab1g2gn94b4948sdq9z5q4fg1c3d-perl5.38.2-App-Sqitch-1.4.0/lib/perl5/site_perl/5.38.2/App/Sqitch.pm line 9.
Compilation failed in require at /nix/store/dp2qkk54w9fxzj6zy94kakv5cl2bhy07-sqitch-pg-1.4.0/bin/.sqitch-wrapped line 13.
BEGIN failed--compilation aborted at /nix/store/dp2qkk54w9fxzj6zy94kakv5cl2bhy07-sqitch-pg-1.4.0/bin/.sqitch-wrapped line 13.

[me@mymachine:~/dev/public/nixpkgs]$ git co nixos-23.11 
Switched to branch 'nixos-23.11'
Your branch is up to date with 'upstream/nixos-23.11'.

[me@mymachine:~/dev/public/nixpkgs]$ git st
On branch nixos-23.11
Your branch is up to date with 'upstream/nixos-23.11'.

nothing to commit, working tree clean

[me@mymachine:~/dev/public/nixpkgs]$ git last 
commit d02ffbbe834b5599fc5f134e644e49397eb07188 (HEAD -> nixos-23.11, upstream/nixos-23.11)
Merge: 9de4582e6679 20a44fa86515
Author: Peder Bergebakken Sundt <pbsds@hotmail.com>
Date:   Mon Dec 18 18:49:22 2023 +0100

    Merge pull request #275069 from NixOS/backport-272697-to-release-23.11

    [Backport release-23.11] xyce: 7.6.0 -> 7.7.0

[me@mymachine:~/dev/public/nixpkgs]$ nix build .#sqitchPg

[me@mymachine:~/dev/public/nixpkgs]$ result/bin/sqitch --version
Constants from lexical variables potentially modified elsewhere are no longer permitted at /nix/store/afz9z2iczjx13i66ymwwinwp2zvgc1ck-perl-5.38.0/lib/perl5/5.38.0/constant.pm line 41.
BEGIN failed--compilation aborted at /nix/store/afz9z2iczjx13i66ymwwinwp2zvgc1ck-perl-5.38.0/lib/perl5/5.38.0/constant.pm line 45.
Compilation failed in require at /nix/store/afz9z2iczjx13i66ymwwinwp2zvgc1ck-perl-5.38.0/lib/perl5/5.38.0/Getopt/Long.pm line 222.
BEGIN failed--compilation aborted at /nix/store/afz9z2iczjx13i66ymwwinwp2zvgc1ck-perl-5.38.0/lib/perl5/5.38.0/Getopt/Long.pm line 222.
Compilation failed in require at /nix/store/f18qfbr6y94k43g7nija4rhvg1xjnggr-perl5.38.0-App-Sqitch-1.4.0/lib/perl5/site_perl/5.38.0/App/Sqitch.pm line 9.
BEGIN failed--compilation aborted at /nix/store/f18qfbr6y94k43g7nija4rhvg1xjnggr-perl5.38.0-App-Sqitch-1.4.0/lib/perl5/site_perl/5.38.0/App/Sqitch.pm line 9.
Compilation failed in require at /nix/store/bij7i7q4bwy5jr0a5kyb85hq9awnj8gv-sqitch-pg-1.4.0/bin/.sqitch-wrapped line 13.
BEGIN failed--compilation aborted at /nix/store/bij7i7q4bwy5jr0a5kyb85hq9awnj8gv-sqitch-pg-1.4.0/bin/.sqitch-wrapped line 13.
datafoo commented 10 months ago

I am not familiar with Perl but I found out that:

Constants from lexical variables potentially modified elsewhere are no longer permitted […] This usage was deprecated, and as of Perl 5.32 is no longer allowed

Source: https://perldoc.perl.org/perldiag#Constants-from-lexical-variables-potentially-modified-elsewhere-are-no-longer-permitted

There are mentions of perl-5.38 (> Perl 5.32) in my logs.

stigtsp commented 10 months ago

Hm, I'm still not able to reproduce on the commits you've provided.

This seems like an impurity, do you have the environment variable PERL5LIB set somehow?

stigtsp commented 10 months ago

Looking at the stack trace, the program is unable to import Getopt::Long (which is a core module). This indicates that it is attempting to use an incompatible version that module. My guess is that sqitchPg on your system is for some reason being called with an older version of perl - from some kind of impurity.

Can you provide the shebang of /nix/store/bij7i7q4bwy5jr0a5kyb85hq9awnj8gv-sqitch-pg-1.4.0/bin/.sqitch-wrapped?

stigtsp commented 10 months ago

I've checked the bij7i7q4bwy5jr0a5kyb85hq9awnj8gv derivation on cache.nixos.org, and cannot find any signs of incorrect shebangs there either.

Could you run strace -f sqitch --version by any chance and attach the output?

datafoo commented 10 months ago

Here is the output of strace -f sqitch --version: strace.txt

datafoo commented 10 months ago

do you have the environment variable PERL5LIB set somehow?

No, I do not think so as the following command does not display anything.

[me@mymachine:~]$ printenv PERL5LIB
datafoo commented 10 months ago

This seems like an impurity

That made me think and perform a test. When I restart my machine and login as root directly, there is no problem with running sqitch --version.

I also noticed something odd in the output of nix-shell -p nix-info --run "nix-info -m". I have migrated my machine and home-manager to NixOS 23.11 or so I believe:

[me@mymachine:~]$ sudo nix-channel --list
nixos https://channels.nixos.org/nixos-23.11

[me@mymachine:~]$ nix-channel --list
home-manager https://github.com/nix-community/home-manager/archive/release-23.11.tar.gz

Yet, the output of nix-shell -p nix-info --run "nix-info -m" shows:

- channels(me): `"home-manager-23.05.tar.gz"`
datafoo commented 10 months ago

Can you reproduce if: