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 (backport #12543) #12545

Open
wants to merge 1 commit into
base: 2.26-maintenance
Choose a base branch
from

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot 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.


This is an automatic backport of pull request #12543 done by [Mergify](https://mergify.com).

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.

(cherry picked from commit 5cf9e18)
@mergify mergify bot requested a review from edolstra as a code owner February 21, 2025 14:47
@mergify mergify bot added automatic backport This PR is a backport produced by automation (does not trigger backporting) merge-queue labels Feb 21, 2025
@Ericson2314
Copy link
Member

What the hell is that test failure! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automatic backport This PR is a backport produced by automation (does not trigger backporting) merge-queue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants