-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Split up util.{hh,cc}
#8920
Split up util.{hh,cc}
#8920
Conversation
a23797e
to
937168e
Compare
Triaged in Nix maintainers meeting:
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-09-22-nix-team-meeting-minutes-88/33343/1 |
937168e
to
f1fc3e2
Compare
3875194
to
393d16f
Compare
393d16f
to
a960b53
Compare
a960b53
to
3130dbc
Compare
3130dbc
to
fd9b701
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I gave it an almost complete but still somewhat cursory look. I think the desired end result is very desirable.
I fully trust you on doing the right thing here, so that's approved.
Yet I'm quite concerned about this being a huge diff that could allow mistakes to slip through into foundational components, and I wouldn't want to share responsibility for that. I'd feel a lot more comfortable with doing that in multiple steps, even if that ends up being 30% more work. It will also ease dissection a lot.
Multiple commits may be fine, but reviews leading to rewriting history will just produce friction as those tend to confuse me, so I'd err towards multiple PRs. If anything, it will make a lot more likely for me to really go through each component and make sure I understand it and its role in the system, so I see it as a good opportunity for knowledge sharing. Being involved in way too many things, spending hours in a row staring at code is something I simply can't afford these days.
If anyone else on the @nixos/nix-team says "nah it'll be fine" we can of course just merge it as is.
src/libutil/ambient-authority.hh
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a weird name. What is it really about? Why is it not e.g. system-specific.hh
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went with current-process.hh
, with the new first commit nativeSystem
is no longer there, and everything else is squarely about the current process.
|
||
std::string drainFD(int fd, bool block, const size_t reserveSize) | ||
{ | ||
// the parser needs two extra bytes to append terminating characters, other users will |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which parser?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just moved that code :)
I don't think we need a CPP defininition and a header entry, and this way allows constant expression elimination.
All OS and IO operations should be moved out, leaving only some misc portable pure functions. This is useful to avoid copious CPP when doing things like Windows and Emscripten ports. Newly exposed functions to break cycles: - `restoreSignals` - `updateWindowSize`
fd9b701
to
ac89bb0
Compare
Thanks @fricklerhandwerk. So one that makes me feel a lot better about this is I do agree knowledge sharing is good, but I an easier way to do that is going through these files post split, e.g. during the Windows porting process. It's much easier to digest things when they are already cut into bite sized pieces :). As you saying trying to redo this into separate PRs for each header would take longer. While I don't really mind it for the headers themselves, it would worse code churn on the |
These moves were long overdue. Merging while the merge base is up to date. Not expecting much merge conflicts from this, as this is support code - not a place where features happen. Certainly we have better places than a "utils" file by now!
This is a life saver for review. |
The test split matches PR NixOS#8920, so the utility files and tests files are once again to 1-1. The string changes continues what was started in PR NixOS#11093.
Motivation
Fixes #8913
All OS and IO operations should be moved out, leaving only some misc portable pure functions.
This is useful to avoid copious CPP when doing things like Windows and Emscripten ports.
Context
This sort of thing is annoying to write and annoying to read, but I realized I have to do it before trying to finish #8901.
Checklist for maintainers
Maintainers: tick if completed or explain if not relevant
tests/**.sh
src/*/tests
tests/nixos/*
Priorities
Add 👍 to pull requests you find important.