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

p11-kit fails to build locally on non-NixOS systems (single-user install) due to failing tests on master #96715

Open
mjlbach opened this issue Aug 31, 2020 · 28 comments

Comments

@mjlbach
Copy link
Contributor

mjlbach commented Aug 31, 2020

Describe the bug
p11-kit builds on nixos/hydra, but fails on non-nixos systems in single-user installs (not multi-user) due to failing test.

Similar issue: #72838

test-conf: common/test.c:612: p11_test_copy_setgid: Assertion `false && "this code should not be reached"' failed.
./build/litter/tap-driver.sh: line 639: 56517 Aborted                 (core dumped) "$@"
ERROR: test-conf - missing test plan

============================================================================
Testsuite summary for p11-kit 0.23.21
============================================================================
# TOTAL: 743
# PASS:  741
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 2
============================================================================
See ./test-suite.log
Please report to https://github.com/p11-glue/p11-kit/issues
============================================================================
make[4]: *** [Makefile:4928: test-suite.log] Error 1
make[4]: Leaving directory '/build/source'
make[3]: *** [Makefile:5036: check-TESTS] Error 2
make[3]: Leaving directory '/build/source'
make[2]: *** [Makefile:5640: check-am] Error 2
make[2]: Leaving directory '/build/source'
make[1]: *** [Makefile:4813: check-recursive] Error 1
make[1]: Leaving directory '/build/source'
make: *** [Makefile:5643: check] Error 2
builder for '/nix/store/r6mh4dp2vqlhfr5j7x6wpdy9snp6bl08-p11-kit-0.23.21.drv' failed with exit code 2
error: build of '/nix/store/r6mh4dp2vqlhfr5j7x6wpdy9snp6bl08-p11-kit-0.23.21.drv' failed

To Reproduce
Steps to reproduce the behavior:

  1. nix-shell -I nixpkgs=https://github.com/nixos/nixpkgs/archive/master.tar.gz -p p11-kit --check

Expected behavior
p11-kit succeeded on hydra, so I assumed it would succeed locally

Additional context
I ran into this issue trying to review #94637

Notify maintainers
None, recent/involved: @worldofpeace @FRidh

Metadata

❯ nix-shell -p nix-info --run "nix-info -m"
these paths will be fetched (0.00 MiB download, 0.00 MiB unpacked):
  /nix/store/iinpypz3m7d68kqcb043qi9iiwvsm6pm-nix-info
copying path '/nix/store/iinpypz3m7d68kqcb043qi9iiwvsm6pm-nix-info' from 'https://cache.nixos.org'...
 - system: `"x86_64-linux"`
 - host os: `Linux 5.7.16-200.fc32.x86_64, Fedora, 32 (Workstation Edition)`
 - multi-user?: `no`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.7`
 - channels(michael): `"nixos-unstable-20.09pre239318.c59ea8b8a0e, nixpkgs-20.09pre240426.f9567594d5a"`
 - nixpkgs: `/home/michael/.nix-defexpr/channels/nixpkgs`
@worldofpeace
Copy link
Contributor

This is labeled as a channel blocker because p11-kit is in the gnome3 closure.
cc @nixos/gnome

@worldofpeace
Copy link
Contributor

worldofpeace commented Aug 31, 2020

I couldn't reproduce this @mjlbach on NixOS 20.09

- system: `"x86_64-linux"`
 - host os: `Linux 5.4.59, NixOS, 20.09.20200810.dirty (Nightingale)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.4pre20200721_ff314f1`
 - channels(root): `""`
 - nixpkgs: `/nix/store/blavjn6via2al4msbnc01vvhn36l8xiz-fm6qxbi0l03mykyzrafjinxkm4jxxnn9-source`

@mjlbach
Copy link
Contributor Author

mjlbach commented Aug 31, 2020

@worldofpeace Thanks for checking, I'm not sure what it could be about my local system then. I can try to debug/test on a couple vms.

edit: I've reproduced now on two non-nixos systems (fedora 32 and ubuntu 18.04)

@mjlbach mjlbach changed the title p11-kit fails to build locally due to failing tests on master p11-kit fails to build locally on non-NixOS systems due to failing tests on master Aug 31, 2020
@worldofpeace
Copy link
Contributor

worldofpeace commented Aug 31, 2020

@mjlbach Yeah, from looking at https://hydra.nixos.org/job/nixpkgs/trunk/p11-kit.x86_64-linux it seems on nixos linux the build is successful. We actually happen to have the tests on darwin disabled (perhaps for a similar reason). I'm not sure there's a way to detect in stdenv non-nixos linux to disable the test as well. Though there could be an actual issue.

@mjlbach
Copy link
Contributor Author

mjlbach commented Aug 31, 2020

Updated the issue title and description to make it more clear this does not affect NixOS, but rather linux systems using nix.

@mjlbach
Copy link
Contributor Author

mjlbach commented Aug 31, 2020

One option would be to have an "allowlist" for tests. Something like (not sure if this is the right platform name)

doCheck = hostPlatform.system == "x86_64-nixos"

Although i'm curious why exactly it fails on non-nixos systems.

@andersk
Copy link
Contributor

andersk commented Aug 31, 2020

My hostPlatform.system on NixOS is

$ nix eval -f '<nixpkgs>' hostPlatform.system
"x86_64-linux"

which I assume is the same as non-NixOS.

@mjlbach
Copy link
Contributor Author

mjlbach commented Aug 31, 2020

My hostPlatform.system on NixOS is

$ nix eval -f '<nixpkgs>' hostPlatform.system
"x86_64-linux"

which I assume is the same as non-NixOS.

Yes, that's what I was hoping was not the case (my nixos machine is unfortunately inaccessible right now) . Maybe there should be a stdenv.isNixOS... Not sure how widespread these sorts of failures are.

@andersk
Copy link
Contributor

andersk commented Aug 31, 2020

Based on looking at the p11_test_copy_setgid code, perhaps this happens when you have /tmp on a filesystem mounted nosuid?

@mjlbach
Copy link
Contributor Author

mjlbach commented Aug 31, 2020

Yes, that seems to be the case:

$ mount
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,seclabel)

Although this seems to be standard for systemd managed systems? (ubuntu, fedora, etc.)

@andersk
Copy link
Contributor

andersk commented Aug 31, 2020

Actually, the callers of p11_test_copy_setgid pass in BUILDDIR rather than /tmp, so it might be some other filesystem that matters.

@andersk
Copy link
Contributor

andersk commented Aug 31, 2020

/run maybe? See NixOS/nix#2957.

@mjlbach
Copy link
Contributor Author

mjlbach commented Aug 31, 2020

I'm not sure how to verify that, but based on the issue description I tried

 TMPDIR=/tmp nix-shell -I nixpkgs=https://github.com/nixos/nixpkgs/archive/master.tar.gz -p p11-kit --check

And still reproduced my issue

@vcunat
Copy link
Member

vcunat commented Aug 31, 2020

This doesn't block a channel, right?

@vcunat
Copy link
Member

vcunat commented Aug 31, 2020

BTW, I don't reproduce the issue on my sandboxed non-NixOS builder (Ubuntu 18.04 as well) or a NixOS one; both have nosuid /tmp.

Current master, result /nix/store/j9199a0p4847pc1f1czjfrkw7nf6f0rn-p11-kit-0.23.21.

@worldofpeace worldofpeace removed the 1.severity: channel blocker Blocks a channel label Aug 31, 2020
@worldofpeace
Copy link
Contributor

This doesn't block a channel, right?

Yep, I forgot to unlabel it.

@mjlbach
Copy link
Contributor Author

mjlbach commented Aug 31, 2020

@vcunat Thanks for the info. Are you using a single or multi-user install? I have sandboxing (explicitly) enabled on both the ubuntu and fedora vms, but it's installed via single-user (not sure if this matters, but I have no idea what other substantive difference there could be).

@vcunat
Copy link
Member

vcunat commented Aug 31, 2020

Yes, multi-user.

@mjlbach mjlbach changed the title p11-kit fails to build locally on non-NixOS systems due to failing tests on master p11-kit fails to build locally on non-NixOS systems (single-user install) due to failing tests on master Aug 31, 2020
@mjlbach
Copy link
Contributor Author

mjlbach commented Aug 31, 2020

I've confirmed this issue only affects systems in single-user install.

@mjlbach
Copy link
Contributor Author

mjlbach commented Aug 31, 2020

One issue is that in order to use multi-user installs on redhat based linux distributions, it seems you have to disable SELinux

@stale
Copy link

stale bot commented Mar 5, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 5, 2021
runeksvendsen added a commit to runeksvendsen/reflex-dom that referenced this issue Sep 6, 2021
@jonathanlking
Copy link
Contributor

I think I might be running into this issue too (single-user install, Ubuntu).
From bisecting, it seems to be a regression since building with meson 3ca33e5.

nix build --rebuild github:NixOS/nixpkgs/nixos-23.05#p11-kit works, but nix build --rebuild github:NixOS/nixpkgs/nixos-23.11#p11-kit doesn't.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 1, 2024
@vcunat
Copy link
Member

vcunat commented Jan 1, 2024

It sounds OK to me to just disable this problematic tests (in nixpkgs), if it helps some users. Feel free to try that out and send a pull request.

@jonathanlking
Copy link
Contributor

jonathanlking commented Jan 1, 2024

The two problematic tests are test-rpc and test-conf.
I looked to see if there was a way to configure this through meson, and therefore the nix mesonCheckFlags, but there doesn't appear to be one yet (see mesonbuild/meson#6999 and mesonbuild/meson#11502).

I think the next option is to patch the meson.build file to remove these tests.
@vcunat does that sound reasonable? (If so, I'll try that out and open a PR 🙂)

@vcunat
Copy link
Member

vcunat commented Jan 1, 2024

Yes, that does sound OK to me.

@jtojnar
Copy link
Member

jtojnar commented Jan 1, 2024

Actually, the callers of p11_test_copy_setgid pass in BUILDDIR rather than /tmp, so it might be some other filesystem that matters.

Looks like this was actually done in p11-glue/p11-kit#17 precisely to work around this problem.

And apparently, you also made a PR to skip the tests that need suid on nosuid file systems: p11-glue/p11-kit#319

So I would expect this to be resolved.

Maybe @jonathanlking is experiencing a different issue?

@jtojnar
Copy link
Member

jtojnar commented Jan 1, 2024

From bisecting, it seems to be a regression since building with meson 3ca33e5.

Looking at the diff, maybe we need to bring back the FAKED_MODE environment variable?

@jonathanlking
Copy link
Contributor

@jtojnar good spot, thanks!
Yes, adding back the preCheck step that sets FAKED_MODE makes things build again 🎉
I intend to open a PR with that change now.

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

No branches or pull requests

7 participants