Skip to content

ceph: fix python build - #369622

Merged
emilazy merged 1 commit into
NixOS:masterfrom
jfly:issue-359723-workaround
Jan 1, 2025
Merged

emilazy merged 1 commit into
NixOS:masterfrom
jfly:issue-359723-workaround

Conversation

@jfly

@jfly jfly commented Dec 31, 2024 •

Copy link
Copy Markdown
Contributor

trustme 1.2+ doesn't work with the old pinned version of cryptography that ceph needs. This vendors the previous version of trustme, which does work. How I got this:

git show fd30f2796b08596646c9a43fd439c4177f53c0ac~:pkgs/development/python-modules/trustme/default.nix > pkgs/tools/filesystems/ceph/old-python-packages/trustme.nix

I then added a warning on the top of the file, and updated the maintiner to myself.

This fixes #359723.

Unfortunately, the build goes on to fail trying to compile ceph itself. I see a bunch of errors that look like this. Hopefully someone more familiar with C++ can help figure this out:

/build/ceph-19.2.0/src/osd/osd_types.h: In lambda function:
/build/ceph-19.2.0/src/common/dout.h:196:73: error: call to non-'constexpr' function 'virtual unsigned int DoutPrefixProvider::get_subsys() const'
  196 |     dout_impl(pdpp->get_cct(), ceph::dout::need_dynamic(pdpp->get_subsys()), v) \
      |                                                         ~~~~~~~~~~~~~~~~^~
/build/ceph-19.2.0/src/common/dout.h:167:58: note: in definition of macro 'dout_impl'
  167 |       return (cctX->_conf->subsys.template should_gather<sub, v>());    \
      |                                                          ^~~
/build/ceph-19.2.0/src/osd/osd_types.h:3704:3: note: in expansion of macro 'ldpp_dout'
 3704 |   ldpp_dout(dpp, 10) << "build_prior all_probe " << all_probe << dendl;
      |   ^~~~~~~~~
/build/ceph-19.2.0/src/common/dout.h:63:20: note: 'virtual unsigned int DoutPrefixProvider::get_subsys() const' declared here
   63 |   virtual unsigned get_subsys() const = 0;
      |                    ^~~~~~~~~~

I've filed #369777 so we can fix this in a follow up PR.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.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.

Add a 👍 reaction to pull requests you find important.

@jfly
jfly requested a review from nh2 December 31, 2024 10:42
@github-actions github-actions Bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Dec 31, 2024
@ofborg
ofborg Bot requested review from adevress, johanot and krav December 31, 2024 11:13
@jfly
jfly force-pushed the issue-359723-workaround branch from a16d070 to 63abe6d Compare December 31, 2024 11:26
@emilazy

emilazy commented Dec 31, 2024 •

Copy link
Copy Markdown
Member

IIRC trustme is only needed indirectly through, like, tests for CherryPy or something. We shouldn’t continue to fork the entire Python cryptography ecosystem for Ceph when we can just put an override in Ceph to disable the tests for whatever package is bringing it in. (Sorry, it’s been a while and I don’t remember the exact package that looked like it needed messing with.)

The C++ failures could be GCC 14‐related, maybe. There might be upstream patches to pull down.

@jfly

jfly commented Dec 31, 2024

Copy link
Copy Markdown
Contributor Author

just put an override in Ceph to disable the tests for whatever package is bringing it in.

I looked into this, and unfortunately, it looks like requests-toolbelt (needed by cheroot, which is needed by cherrypy) is just the first of many packages in the build closure that need trustme for their tests.

Here's a query for this (run against master at the time of writing):

`NIXPKGS_REV=0541d0ed73655896748192b66b87777464a90e23; nix why-depends --derivation --all nixpkgs/$NIXPKGS_REV#ceph nixpkgs/$NIXPKGS_REV#ceph.python.pkgs.trustme`
$ NIXPKGS_REV=0541d0ed73655896748192b66b87777464a90e23; nix why-depends --derivation --all nixpkgs/$NIXPKGS_REV#ceph nixpkgs/$NIXPKGS_REV#ceph.python.pkgs.trustme
/nix/store/zih47f2z22pggkygkx4wdgai3fx0pg5d-ceph-19.2.0.drv
└───/nix/store/r3fw785alq1wpw5hga1s3ch9hm1ypffc-python3-3.11.11-env.drv
    ├───/nix/store/3f7pid4gzy9mqi6jndflzcyb1xgg2y28-python3.11-cheroot-10.0.1.drv
    │   └───/nix/store/sl2iznl5y1z2yfh2h44c3xdd34kpcmg7-python3.11-requests-toolbelt-1.0.0.drv
    │       └───/nix/store/pizkqfp3cwnapg3h2gh6d06zdk1pmcl0-python3.11-trustme-1.2.0.drv
    ├───/nix/store/g5h8v23jdfkwn183p4h7jph5mpw5m2yz-python3.11-cherrypy-18.10.0.drv
    │   ├───/nix/store/sl2iznl5y1z2yfh2h44c3xdd34kpcmg7-python3.11-requests-toolbelt-1.0.0.drv
    │   └───/nix/store/3f7pid4gzy9mqi6jndflzcyb1xgg2y28-python3.11-cheroot-10.0.1.drv
    ├───/nix/store/v2hp7c3jbszlp0cbqi433nhs3d1rx4yx-python3.11-google-auth-2.36.0.drv
    │   ├───/nix/store/s3qifqr9kbnd5270q9vdy3qkgzq17n8k-python3.11-aiohttp-3.11.9.drv
    │   │   ├───/nix/store/pizkqfp3cwnapg3h2gh6d06zdk1pmcl0-python3.11-trustme-1.2.0.drv
    │   │   ├───/nix/store/vmchjz639nny6ndw3x6ygcl8x7id87ia-python3.11-proxy-py-2.4.8.drv
    │   │   │   └───/nix/store/ld6396vvda7w5458qi3w1m71nqfchkxy-python3.11-httpx-0.27.2.drv
    │   │   │       ├───/nix/store/pizkqfp3cwnapg3h2gh6d06zdk1pmcl0-python3.11-trustme-1.2.0.drv
    │   │   │       ├───/nix/store/5i3ms3705wrklq24j4amr2alrmvn2dbf-python3.11-anyio-4.6.2.drv
    │   │   │       │   ├───/nix/store/pizkqfp3cwnapg3h2gh6d06zdk1pmcl0-python3.11-trustme-1.2.0.drv
    │   │   │       │   └───/nix/store/yr6r0q6gy2rm2pnid66wwljvx92iibfz-python3.11-trio-0.27.0.drv
    │   │   │       │       └───/nix/store/pizkqfp3cwnapg3h2gh6d06zdk1pmcl0-python3.11-trustme-1.2.0.drv
    │   │   │       ├───/nix/store/i2ws729dc1kfvhvqp9l943krwf913iww-python3.11-httpcore-1.0.6.drv
    │   │   │       │   ├───/nix/store/5i3ms3705wrklq24j4amr2alrmvn2dbf-python3.11-anyio-4.6.2.drv
    │   │   │       │   ├───/nix/store/yr6r0q6gy2rm2pnid66wwljvx92iibfz-python3.11-trio-0.27.0.drv
    │   │   │       │   └───/nix/store/ih7spq1p5hsn241xmk5siisj4mn0yfrv-python3.11-pytest-trio-0.8.0.drv
    │   │   │       │       └───/nix/store/yr6r0q6gy2rm2pnid66wwljvx92iibfz-python3.11-trio-0.27.0.drv
    │   │   │       └───/nix/store/ih7spq1p5hsn241xmk5siisj4mn0yfrv-python3.11-pytest-trio-0.8.0.drv
    │   │   └───/nix/store/rrp4f0d81jw2pm247wpqqap7c5dvlz9p-python3.11-aiohappyeyeballs-2.4.4.drv
    │   │       └───/nix/store/fnlky5psacfbdsln6lnvmr087k8ghj3j-python3.11-sphinx-autobuild-2024.09.19.drv
    │   │           ├───/nix/store/ld6396vvda7w5458qi3w1m71nqfchkxy-python3.11-httpx-0.27.2.drv
    │   │           ├───/nix/store/kl8xyd0vwlg4pdpvjcgbv3462pc9sp71-python3.11-watchfiles-0.24.0.drv
    │   │           │   └───/nix/store/5i3ms3705wrklq24j4amr2alrmvn2dbf-python3.11-anyio-4.6.2.drv
    │   │           └───/nix/store/pxyfpcxzszks3k67d0mwyjphcmg1g5al-python3.11-starlette-0.41.2.drv
    │   │               ├───/nix/store/5i3ms3705wrklq24j4amr2alrmvn2dbf-python3.11-anyio-4.6.2.drv
    │   │               ├───/nix/store/ld6396vvda7w5458qi3w1m71nqfchkxy-python3.11-httpx-0.27.2.drv
    │   │               └───/nix/store/yr6r0q6gy2rm2pnid66wwljvx92iibfz-python3.11-trio-0.27.0.drv
    │   ├───/nix/store/6pf0f33zgsslnqfs9mnrl1cbqbv113ia-python3.11-aioresponses-0.7.7.drv
    │   │   └───/nix/store/s3qifqr9kbnd5270q9vdy3qkgzq17n8k-python3.11-aiohttp-3.11.9.drv
    │   └───/nix/store/7pym8c2ls7fwg1qaca8rsw5981phm8px-python3.11-oauth2client-4.1.3.drv
    │       └───/nix/store/r7r08p4ygv5yps0snf5wdys3nijbd7xs-python3.11-httplib2-0.22.0.drv
    │           └───/nix/store/g7sx4zymnyfkcsfck7ir5lid5f9hda9i-python3.11-pytest-randomly-3.13.0.drv
    │               └───/nix/store/x2d2wirpgybbwk089cyc5zynngp0iv4f-python3.11-factory-boy-3.3.1.drv
    │                   └───/nix/store/xb1f9ihxyfhpdnd54yf2w6x9gw7j0xg3-python3.11-django-4.2.17.drv
    │                       ├───/nix/store/cgihi5442ship5m0nc2r21gnwkn02h1g-python3.11-selenium-4.25.0.drv
    │                       │   ├───/nix/store/1hh5s08lyrvrq02aak2f7r4j5wx42f87-python3.11-trio-websocket-0.11.1.drv
    │                       │   │   ├───/nix/store/pizkqfp3cwnapg3h2gh6d06zdk1pmcl0-python3.11-trustme-1.2.0.drv
    │                       │   │   ├───/nix/store/yr6r0q6gy2rm2pnid66wwljvx92iibfz-python3.11-trio-0.27.0.drv
    │                       │   │   └───/nix/store/ih7spq1p5hsn241xmk5siisj4mn0yfrv-python3.11-pytest-trio-0.8.0.drv
    │                       │   ├───/nix/store/yr6r0q6gy2rm2pnid66wwljvx92iibfz-python3.11-trio-0.27.0.drv
    │                       │   └───/nix/store/ih7spq1p5hsn241xmk5siisj4mn0yfrv-python3.11-pytest-trio-0.8.0.drv
    │                       └───/nix/store/g8c1psyzjcaby241350dh8ywr4z810cy-python3.11-geoip2-4.8.0.drv
    │                           ├───/nix/store/s3qifqr9kbnd5270q9vdy3qkgzq17n8k-python3.11-aiohttp-3.11.9.drv
    │                           └───/nix/store/hiy46gzcsfaiqaqz4li9g3zcfd62b1xb-python3.11-mocket-3.13.0.drv
    │                               ├───/nix/store/ld6396vvda7w5458qi3w1m71nqfchkxy-python3.11-httpx-0.27.2.drv
    │                               ├───/nix/store/s3qifqr9kbnd5270q9vdy3qkgzq17n8k-python3.11-aiohttp-3.11.9.drv
    │                               ├───/nix/store/akc8cgbcms4g0gnvw42nbdv09vpj8ch4-python3.11-pook-1.4.3.drv
    │                               │   └───/nix/store/s3qifqr9kbnd5270q9vdy3qkgzq17n8k-python3.11-aiohttp-3.11.9.drv
    │                               └───/nix/store/ih41x40x2palfkm3429ycryb8imp3yzm-python3.11-fastapi-0.115.6.drv
    │                                   └───/nix/store/pxyfpcxzszks3k67d0mwyjphcmg1g5al-python3.11-starlette-0.41.2.drv
    └───/nix/store/5d2ism97wl1g48ng5q1vx84zc4x3jygw-python3.11-kubernetes-18.20.0.drv
        └───/nix/store/v2hp7c3jbszlp0cbqi433nhs3d1rx4yx-python3.11-google-auth-2.36.0.drv

I played around with this a bit, trying to find the minimal set of disabling checks required to drop trustme from the build closure. Here's what I found:

  • requests-toolbelt
  • aiohttp
  • trio-websocket
  • anyio
  • httpx
  • trio

I personally prefer the change I've already implemented in this PR, but I'm happy to change it if folks prefer. @emilazy, what do you think?

The C++ failures could be GCC 14‐related, maybe. There might be upstream patches to pull down.

I briefly skimmed upstream's repo and didn't see any changes to the relevant functions in the build errors. I didn't look very hard, though. Do we need to address that to get this PR to land, or would it be OK to investigate that in a followup PR?

@emilazy

emilazy commented Dec 31, 2024

Copy link
Copy Markdown
Member

Since trustme is only required for tests and isn’t security critical in any way, I guess it should be fine to add yet another package here, and it’s probably better than disabling a bunch of tests, but it’s scary to imagine how many more times this might happen before upstream Ceph gets their stuff sorted… cc @mweinelt @natsukium for sign‐off on more Ceph Python copy‐paste.

I think it’s okay to investigate the other build issues in a follow‐up PR.

@jfly
jfly marked this pull request as ready for review December 31, 2024 20:07
@jfly

jfly commented Dec 31, 2024 •

Copy link
Copy Markdown
Contributor Author

I think it’s okay to investigate the other build issues in a follow‐up PR.

Thanks. I've marked this PR as ready for review, and I've created #369777 to track the C++ compilation issue.

@jfly jfly mentioned this pull request Dec 31, 2024
@jfly
jfly force-pushed the issue-359723-workaround branch from 63abe6d to 872a24a Compare December 31, 2024 20:51
`trustme` 1.2+ doesn't work with the old pinned version of
`cryptography` that `ceph` needs. This vendors the previous version of
`trustme`, which does work. How I got this:

```shell
git show fd30f27~:pkgs/development/python-modules/trustme/default.nix > pkgs/tools/filesystems/ceph/old-python-packages/trustme.nix
```

I then added a warning on the top of the file, and updated the maintiner
to myself.

This fixes NixOS#359723

Unfortunately, the build goes on to fail trying to compile ceph itself.
I see a bunch of errors that look like this. Hopefully someone more
familiar with C++ can help figure this out:

    /build/ceph-19.2.0/src/osd/osd_types.h: In lambda function:
    /build/ceph-19.2.0/src/common/dout.h:196:73: error: call to non-'constexpr' function 'virtual unsigned int DoutPrefixProvider::get_subsys() const'
      196 |     dout_impl(pdpp->get_cct(), ceph::dout::need_dynamic(pdpp->get_subsys()), v) \
          |                                                         ~~~~~~~~~~~~~~~~^~
    /build/ceph-19.2.0/src/common/dout.h:167:58: note: in definition of macro 'dout_impl'
      167 |       return (cctX->_conf->subsys.template should_gather<sub, v>());    \
          |                                                          ^~~
    /build/ceph-19.2.0/src/osd/osd_types.h:3704:3: note: in expansion of macro 'ldpp_dout'
     3704 |   ldpp_dout(dpp, 10) << "build_prior all_probe " << all_probe << dendl;
          |   ^~~~~~~~~
    /build/ceph-19.2.0/src/common/dout.h:63:20: note: 'virtual unsigned int DoutPrefixProvider::get_subsys() const' declared here
       63 |   virtual unsigned get_subsys() const = 0;
          |                    ^~~~~~~~~~

I've filed NixOS#369777 so we can fix
this in a follow up PR.
@jfly
jfly force-pushed the issue-359723-workaround branch from 872a24a to c314e80 Compare December 31, 2024 20:52

@emilazy emilazy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don’t think we’re going to get anything better than this in the short term and there’s no security risk here so let’s just do it.

@emilazy
emilazy merged commit 01fec88 into NixOS:master Jan 1, 2025
@jfly
jfly deleted the issue-359723-workaround branch January 1, 2025 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build failure: ceph (on staging)

2 participants