aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-08-09libutil: rename and optimize closeMostFDseldritch horrors
this is only used to close non-stdio files in derivation sandboxes. we may as well encode that in its name, drop the unnecessary integer set, and use close_range to deal with the actual closing of files. not only is this clearer, it also makes sandbox setup on linux fast by 1ms each Change-Id: Id90e259a49c7bc896189e76bfbbf6ef2c0bcd3b2
2024-08-09libstore: deprecate the build-hook settingeldritch horrors
implementing a build hook is pretty much impossible without either being a nix, or blindly forwarding the important bits of all build requests to some kind of nix. we've found no uses of build-hook in the wild, and the build-hook protocol (apart from being entirely undocumented) is not able to convey any kind of versioning information between hook and daemon. if we want to upgrade this infrastructure (which we do), this must not stay Change-Id: I1ec4976a35adf8105b8ca9240b7984f8b91e147e
2024-08-09Merge changes Ib7c80826,I636f8a71,I67669b98 into mainjade
* changes: perl: un-autos your conf build: declare all the deps as -isystem darwin: workaround PROC_PIDLISTFDS on processes with no fds
2024-08-09Merge "libexpr: move Value implementations out of eval.cc" into mainQyriad
2024-08-09libutil: allow marking settings as deprecatedeldritch horrors
this is a bit of a hack, but it's apparently the cleanest way of doing this in the absence of any kind of priority/provenance information for values of some given setting. we'll need this to deprecate build-hook. Change-Id: I03644a9c3f17681c052ecdc610b4f1301266ab9e
2024-08-09main: require argv[0]eldritch horrors
sure, linux has been providing argv[0] by default for a while now. other OSes may not be as forthcoming though, and relying on the OS to create a world in which we can just make assumptions we could test for instead is unnecessarily lazy. we *could* default argv0, but that's a little silly. notably we abort instead of returning normally to avoid confusions where a caller interprets our exit status like a Worker build results bitmask. Change-Id: Id73f8cd0a630293b789c59a8c4b0c4a2b936b505
2024-08-09resolve-system-dependencies: remove entirelyeldritch horrors
this hasn't been used since 2020, and hasn't been compiled since may. Change-Id: I865550966630eee6ba18d742ba36f0a90901279d
2024-08-08libexpr: move Value implementations out of eval.ccQyriad
Change-Id: I2ce8a9713533888b3d109a56947156eb3a5ab492
2024-08-08Merge changes I0373ac01,I7b543967,I537103eb into mainjade
* changes: releng: fix the git push releng: clarify/update docs, add instructions after tag Fix is_maintenance_branch heuristic
2024-08-08Merge changes I6358a393,I2d9f276b,Idd096dc9 into mainjade
* changes: clang-tidy: write a lint for charptr_cast tree-wide: automated migration to charptr_cast clang-tidy: enforce the new rules
2024-08-08Merge changes I526cceed,Ia4e2f1fa,I22e66972,I9fbd55a9,Ifca22e44 into mainjade
* changes: sqlite: add a Use::fromStrNullable util: implement charptr_cast tree-wide: fix a pile of lints refactor: make HashType and Base enum classes for type safety build: integrate clang-tidy into CI
2024-08-08clang-tidy: write a lint for charptr_castJade Lovelace
This lets us ensure that nobody is putting in new reinterpret_cast instances where they could safely use charptr_cast instead. Change-Id: I6358a3934c8133c7150042635843bdbb6b9218d4
2024-08-08sqlite: add a Use::fromStrNullableJade Lovelace
There were several usages of the raw sqlite primitives along with C style casts, seemingly because nobody thought to use an optional for getting a string or NULL. Let's fix this API given we already *have* a wrapper. Change-Id: I526cceedc2e356209d8fb62e11b3572282c314e8
2024-08-08tree-wide: automated migration to charptr_castJade Lovelace
The lint did it :3 Change-Id: I2d9f276b01ebbf14101de4257ea13e44ff6fe0a0
2024-08-08util: implement charptr_castJade Lovelace
I don't like having so many reinterpret_cast statements that have to actually be looked at to determine if they are UB. A huge number of the reinterpret_cast instances in Lix are actually casting to some pointer of some character type, which is always valid no matter the source type. However, it is also worth looking at if it is not casting both *from* a character type and also *to* a character type, since IMO splatting a struct into a character array should be a very deliberate action instead of just being about dealing with bad APIs. So let's write a template that encapsulates this invariant so we can not worry about the trivially safe reinterpret_cast invocations. Change-Id: Ia4e2f1fa0c567123a96604ddadb3bdd7449660a4
2024-08-08clang-tidy: enforce the new rulesJade Lovelace
Fixes: https://git.lix.systems/lix-project/lix/issues/241 Change-Id: Idd096dc9ca92ffd4be8c22d293ba5bf2ec48a85f
2024-08-08tree-wide: fix a pile of lintsJade Lovelace
This: - Converts a bunch of C style casts into C++ casts. - Removes some very silly pointer subtraction code (which is no more or less busted on i686 than it began) - Fixes some "technically UB" that never had to be UB in the first place. - Makes finally follow the noexcept status of the inner function. Maybe in the future we should ban the function from not being noexcept, but that is not today. - Makes various locally-used exceptions inherit from std::exception. Change-Id: I22e66972602604989b5e494fd940b93e0e6e9297
2024-08-08refactor: make HashType and Base enum classes for type safetyJade Lovelace
Change-Id: I9fbd55a9d50464a56fe11cb42a06a206914150d8
2024-08-08build: integrate clang-tidy into CIJade Lovelace
This still has utterly unacceptably bad output format design that I would not inflict on anyone I like, but it *does* now exist, and you *can* find the errors in the log. Future work would obviously be to fix that and integrate the actual errors into Gerrit using codechecker or so. Followup issue: https://git.lix.systems/lix-project/lix/issues/457 Fixes: https://git.lix.systems/lix-project/lix/issues/147 Change-Id: Ifca22e443d357762125f4ad6bc4f568af3a26c62
2024-08-08Merge "libexpr: Add experimental pipe operator" into mainpiegames
2024-08-08libstore: make Worker::waitForInput privateeldritch horrors
Change-Id: I71a42acd5a4a9a18b55cf754cdf9896614134398
2024-08-08libstore: make Worker status flags privateeldritch horrors
Change-Id: I16ec8994c6448d70b686a2e4c10f19d4e240750d
2024-08-08libstore: remove Goal::addWaiteeeldritch horrors
Change-Id: I1b00d1a537d84790878cb0e81aaa1cbaa143d62d
2024-08-08libstore: make Worker::wakeUp privateeldritch horrors
Change-Id: Iffa55272fe6ef4adaf3e9d4d25e5339792c2e460
2024-08-08libstore: make Worker::waitForAWhile privateeldritch horrors
Change-Id: I0cdcd436ee71124ca992b4f4fe307624a25f11e9
2024-08-08libstore: make Worker::waitForBuildSlot privateeldritch horrors
Change-Id: I02a54846cd65622edbd7a1d6c24a623b4a59e5b3
2024-08-08libexpr: Add experimental pipe operatorpiegames
The |> operator is a reverse function operator with low binding strength to replace lib.pipe. Implements RFC 148, see the RFC text for more details. Closes #438. Change-Id: I21df66e8014e0d4dd9753dd038560a2b0b7fd805
2024-08-07releng: fix the git pushJade Lovelace
This was broken because gerrit requires that the revision actually is known before it is pushed as a tag. Also, arguably this fixes the original problem mentioned in https://git.lix.systems/lix-project/lix/issues/439 Change-Id: I0373ac01584440f18d32b8da5699bb359cc2c89a
2024-08-07releng: clarify/update docs, add instructions after tagJade Lovelace
This is not a proper fix for the confusion that can happen about how the tags are supposed to be used. For a proper fix, we need to do https://git.lix.systems/lix-project/lix/issues/439 and implement worktrees such that the user never sees the git state anymore. Change-Id: I7b543967f522cede486e42684b48cad47da95429
2024-08-07Fix is_maintenance_branch heuristicJade Lovelace
This was broken because Nix language's version comparison does not know how to deal with versions like -rc1 and considers them newer, which is in this case not desirable. That in turn led to not tagging 2.90.0 docker images as "latest" since the heuristic was wrong. This commit also adds some more cross-checking and failsafes in case the person running releng does not have a local main branch that is up to date. Fixes: https://git.lix.systems/lix-project/lix/issues/443 Change-Id: I537103ebab58ae978c00e06972abe14432dd9c80
2024-08-07Merge "src/libcmd/repl.cc: allow :log /path/to/store.drv" into mainMax Siling
2024-08-07Merge "oops: fix warning about catching polymorphic exception" into mainjade
2024-08-07libexpr/parser: Test experimental featurespiegames
Currently, the parser relies on the global experimental feature flags. In order to properly test conditional language features, we instead need to pass it around in the parser::State. This means that the parser cannot cache the result of isEnabled anymore, which wouldn't necessarily hurt performance if the function didn't perform a linear search on the list of enabled features on every single call. While we could simply evaluate once at the start of parsing and cache the result in the parser state, the more sustainable solution would be to fix `isEnabled` such that all callers may profit from the performance improvement. Change-Id: Ic9b9c5d882b6270e1114988b63e6064d36c25cf2
2024-08-07src/libcmd/repl.cc: allow :log /path/to/store.drvGoldstein
This adds a second form to the `:log` command: it now can accept a derivation path in addition to a derivation expression. As derivation store paths start with `/nix/store`, this is not ambiguous. Resolves: https://git.lix.systems/lix-project/lix/issues/51 Change-Id: Iebc7b011537e7012fae8faed4024ea1b8fdc81c3
2024-08-07Merge "fix: warn and document when advanced attributes will have no impact ↵Maximilian Bosch
due to __structuredAttrs" into main
2024-08-07perl: un-autos your confJade Lovelace
I definitely don't think we were using this, and it is probably an omission in the original autoconf deletion more than anything. Change-Id: Ib7c8082685e550575bca5af06f0e93adf982bd7c
2024-08-07build: declare all the deps as -isystemJade Lovelace
I don't know why but I was getting a spurious -Werror=switch-enum inside toml11. It does not make sense why it did not occur before, but it should be stopped. This was not done at an earlier stage to better match the legacy make build system, but we don't use it anyway. Change-Id: I636f8a71e8a0ba5e0feb80b435ae24c3af995c5d
2024-08-07darwin: workaround PROC_PIDLISTFDS on processes with no fdsJade Lovelace
This has been causing various seemingly spurious CI failures as well as some failures on people running tests on beta builds. lix> ++(nix-collect-garbage-dry-run.sh:20) nix-store --gc --print-dead lix> ++(nix-collect-garbage-dry-run.sh:20) wc -l lix> finding garbage collector roots... lix> error: Listing pid 87261 file descriptors: Undefined error: 0 There is no real way to write a proper test for this, other than to start a process like the following: int main(void) { for (int i = 0; i < 1000; ++i) { close(i); } sleep(10000); } and then let Lix's gc look at it. I have a relatively high confidence this *will* fix the problem since I have manually confirmed the behaviour of the libproc call is as-unexpected, and it would perfectly explain the observed symptom. Fixes: https://git.lix.systems/lix-project/lix/issues/446 Change-Id: I67669b98377af17895644b3bafdf42fc33abd076
2024-08-07Merge "package: improve support for building without BDW-GC" into mainalois31
2024-08-06oops: fix warning about catching polymorphic exceptionJade Lovelace
This was introduced in I0fc80718eb7e02d84cc4b5d5deec4c0f41116134 and unnoticed since it only appears in gcc builds. Change-Id: I1de80ce2a8fab63efdca7ca0de2a302ceb118267
2024-08-07Merge changes I0fc80718,Ia182b86f,I355f82cb,I8a9b58fa,Id89f8a1f, ... into mainjade
* changes: tree-wide: fix various lint warnings flake & doxygen: update tagline nix flake metadata: print modified dates for input flakes cli: eat terminal codes from stdout also Implement forcing CLI colour on, and document it better manual: fix a syntax error in redirects.js that made it not do anything misc docs/meson tidying build: implement clang-tidy using our plugin
2024-08-06libstore/linux: precompile and cache the seccomp BPFAlois Wohlschlager
The growth of the seccomp filter in 127ee1a101e3f5ebab39ad98cbe58fefcd52eca5 made its compilation time significant (roughly 10 milliseconds have been measured on one machine). For this reason, it is now precompiled and cached in the parent process so that this overhead is not hit for every single build. It is still not optimal when going through the daemon, because compilation still happens once per client, but it's better than before and doing it only once for the entire daemon requires excessive crimes with the current architecture. Fixes: https://git.lix.systems/lix-project/lix/issues/461 Change-Id: I2277eaaf6bab9bd74bbbfd9861e52392a54b61a3
2024-08-06libstore/linux: compile the seccomp BPF explicitlyAlois Wohlschlager
This is a preparation for precompiling the filter, which is done separately. The behaviour should be unchanged for now. Change-Id: I899aa7242962615949208597aca88913feba1cb8
2024-08-06libstore: add LocalDerivationGoal setupSyscallFilter hookAlois Wohlschlager
The seccomp setup code was a huge chunk of conditionally compiled platform-specific code. For this reason, it is appropriate to move it to the platform-specific implementation file. Ideally its setup could be moved a bit to make it happen at the same place as the Darwin restrictions, but that change is going to be less mechanical. Change-Id: I496aa3c4fabf34656aba1e32b0089044ab5b99f8
2024-08-06package: don't hide system-wide manual pagesAlois Wohlschlager
When MANPATH is unset or contains an empty component, a reasonable default is used. Previously (after 3dced96741816db01f9990e0884224d38ee58390), when MANPATH was unset, the shell hook would only place a location containing the Lix manual pages there, and system-wide manual pages would become unavailable in the development shell, which is undesired. Fix the issue by including an empty component in this case. Change-Id: Ib3c67a831d709fe2a87520e15917eebb59397bd1
2024-08-04tree-wide: fix various lint warningsJade Lovelace
Change-Id: I0fc80718eb7e02d84cc4b5d5deec4c0f41116134
2024-08-04flake & doxygen: update taglineJade Lovelace
This tagline was left over from CppNix and we should make it tastier. Change-Id: Ia182b86f6e751591be71a50521992ad73c7b38b5
2024-08-04nix flake metadata: print modified dates for input flakesJade Lovelace
This was always in the lock file and we can simply actually print it. The test for this is a little bit silly but it should correctly control for my daring to exercise timezone code *and* locale code in a test, which I strongly suspect nobody dared do before. Sample (abridged): ``` Path: /nix/store/gaxb42z68bcr8lch467shvmnhjjzgd8b-source Last modified: 1970-01-01 00:16:40 Inputs: ├───flake-compat: github:edolstra/flake-compat/0f9255e01c2351cc7d116c072cb317785dd33b33 │ Last modified: 2023-10-04 13:37:54 ├───flake-utils: github:numtide/flake-utils/b1d9ab70662946ef0850d488da1c9019f3a9752a │ Last modified: 2024-03-11 08:33:50 │ └───systems: github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e │ Last modified: 2023-04-09 08:27:08 ``` Change-Id: I355f82cb4b633974295375ebad646fb6e2107f9b
2024-08-04cli: eat terminal codes from stdout alsoJade Lovelace
This *should* be sound, plus or minus the amount that the terminal code eating code is messed up already. This is useful for testing CLI output because it will strip the escapes enough to just shove the expected output in a file. Change-Id: I8a9b58fafb918466ac76e9ab585fc32fb9294819
2024-08-04Implement forcing CLI colour on, and document it betterJade Lovelace
This is necessary to make some old tests work when testing colour against non-interactive outputs. Change-Id: Id89f8a1f45c587fede35a69db85f7a52f2c0a981