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 perl store bindings #12543

Merged
merged 1 commit into from
Feb 21, 2025
Merged

Conversation

B4dM4n
Copy link
Contributor

@B4dM4n B4dM4n commented Feb 21, 2025

Motivation

Hydra currently fails to show the build dependencies of it's builds (NixOS/hydra#1401) with an error like this:

error: not an absolute path: 'Nix::Store=SCALAR(0x3f5338e8)'

The invalid path the error is referring to, is produced in the current Perl bindings itself.

Context

When #9863 converted the Nix::Store free functions into member functions, the implicit this argument was not accounted for when iterating over the variable number of arguments in some functions.

The following functions are affected:

  • computeFSClosure
  • topoSortPaths (this causes the hydra error)
  • exportPaths

flake.nix reproducing the error:

{
  # Current rev of github:NixOS/nix/2.26-maintenance
  inputs.nix.url = "github:NixOS/nix/0d039d4abec82c7c7c2787edea7fd3c732965f82";

  inputs.nixpkgs.follows = "nix/nixpkgs";

  outputs = {
    self,
    nixpkgs,
    nix,
    ...
  }: {
    packages.x86_64-linux.default =
      nixpkgs.legacyPackages.x86_64-linux.writers.writePerlBin "example" {
        libraries = [nix.hydraJobs.perlBindings.x86_64-linux];
      } ''
        use Nix::Store;

        my $store = Nix::Store->new();

        $store->computeFSClosure(0,0);
        # error: not an absolute path: '0' at /nix/store/y1g5c8wz7s2fr29fliq06v161asj6npr-example/bin/example line 6.

        $store->topoSortPaths();
        # error: not an absolute path: 'Nix::Store=SCALAR(0x3eca46b0)' at /nix/store/7vxyv8kcv01dz0gjs9cys27frbqj5bir-example/bin/example line 9.

        $store->exportPaths(1);
        # error: not an absolute path: '1' at /nix/store/ras8ghkb0pff4zwp8jycg48p5y3qgfdq-example/bin/example line 12.
      '';
  };
}

Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

When NixOS#9863 converted the `Nix::Store` free functions into member functions, the
implicit `this` argument was not accounted for when iterating over the variable
number of arguments in some functions.
@B4dM4n B4dM4n requested a review from edolstra as a code owner February 21, 2025 10:51
@edolstra edolstra added the backport 2.26-maintenance Automatically creates a PR against the branch label Feb 21, 2025
@edolstra edolstra merged commit 223f82e into NixOS:master Feb 21, 2025
12 checks passed
@Ericson2314
Copy link
Member

Ericson2314 commented Feb 21, 2025

@B4dM4n As the person that made the change introducing the bug, thank you!! Very nice work investigating this!

@B4dM4n B4dM4n deleted the fix-perl-store-bindings branch February 21, 2025 15:18
mergify bot added a commit that referenced this pull request Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.26-maintenance Automatically creates a PR against the branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants