John Ericson
8be347afca
Factor out nix::maybeLstat
...
This function is nice for more than `PosixSourceAccessor`. We can make a
few things simpler with it.
Note that the error logic slightly changes in some of the call sites, in
that we also count `ENOTDIR` and not just `ENOENT` as not having the
file, but that should be fine.
2024-03-29 16:32:53 -04:00
John Ericson
555181c3fd
throwExceptionSelfCheck
throw Error
...
`SysError` is not appropriate because there is no (Unix) syscall involved.
The catch block in `initLibUtil` is already for `Error` and still works.
2024-03-29 16:05:05 -04:00
Yuxuan Shui
0be87c023f
Fix "include" directive in config files
2024-03-29 16:33:13 +00:00
Théophane Hufschmitt
b72e1c79da
Merge pull request #10299 from detroyejr/remove-repl-flake
...
flakes: remove experimental repl-flake
2024-03-29 15:06:23 +01:00
Théophane Hufschmitt
90f5189451
Merge pull request #10131 from intelfx/work/notty
...
`TERM=dumb` fixes
2024-03-29 13:38:37 +01:00
Théophane Hufschmitt
de101417eb
Merge pull request #10305 from hercules-ci/addErrorContext-is-great
...
Always print addErrorContext
2024-03-29 09:10:09 +01:00
Robert Hensing
ef26133df3
Merge pull request #10337 from Cyclic4179/patch-1
...
`nix shell` shebang: support O'Caml comments
2024-03-28 19:54:03 +01:00
José Luis Lafuente
c57de60522
C API: Keep the structure flat
...
See https://github.com/NixOS/nix/pull/10329
2024-03-28 19:00:04 +01:00
José Luis Lafuente
d96b52bd8b
C api: nix_export_std_string -> nix_observe_string
2024-03-28 10:52:02 +01:00
Yorick van Pelt
ab9250286a
C API: add a way to throw errors from primops
2024-03-28 10:47:56 +01:00
Yorick van Pelt
e1bb799da9
C API: reformat according to proposed clang-format file
2024-03-28 10:47:55 +01:00
Yorick van Pelt
5d82d6e733
nix_api: fix missing includes in headers
...
Forward declaration doesn't work here, since we define classes that
contain the objects
2024-03-28 10:47:55 +01:00
Yorick van Pelt
e642bbc2a7
C API: move to src/lib*/c/
2024-03-28 10:46:39 +01:00
Yorick van Pelt
f0afe7f9b9
nix_api_util: throw nix::error instead of new nix::Error for null ctx's
2024-03-28 10:39:06 +01:00
Yorick van Pelt
e74d6c1b3d
nix_api_expr: document nix_value_force
2024-03-28 10:39:06 +01:00
Yorick van Pelt
e58a9384c6
nix_api_expr, nix_api_util: slightly improve documentation
2024-03-28 10:39:06 +01:00
Yorick van Pelt
f41a7e326b
nix_err_code: do not fail
2024-03-28 10:39:06 +01:00
Yorick van Pelt
b0741f7128
external-api-doc: introduce and improve documentation
2024-03-28 10:39:06 +01:00
Yorick van Pelt
4702317506
libutil: add C bindings
2024-03-28 10:39:04 +01:00
John Ericson
77205b2042
Allow for ergnomically putting Unix-only files in subdirs by creating INLCUDE_$(pkg)
vars
...
Separate platform-specific files will allow avoiding a lot of CPP.
2024-03-27 12:01:59 -04:00
Robert Hensing
d4fa0a84a5
refact: TraceKind -> TracePrint
...
Co-authored-by: Rebecca Turner <rbt@sent.as>
2024-03-27 16:32:49 +01:00
Robert Hensing
bed541b04e
error.cc: Make printTrace static
2024-03-27 16:28:04 +01:00
Robert Hensing
bebacc475c
Always print addErrorContext traces
2024-03-27 16:28:04 +01:00
Cyclic4179
a2c3333b97
fix #10336
2024-03-27 07:47:36 +01:00
Théophane Hufschmitt
0bf01917ef
Merge pull request #10325 from K900/ooformatting
...
build-remote: fix format string shenanigans
2024-03-26 11:45:32 +01:00
Théophane Hufschmitt
1394d4e9c5
Merge pull request #10306 from hercules-ci/baseNameOf
...
Test and document `builtins.baseNameOf`, improve internal `baseNameOf()`
2024-03-26 09:59:27 +01:00
K900
2d4edb945b
build-remote: fix format string shenanigans
...
HintFmt(string) invokes the HintFmt("%s", literal) constructor,
which is not what we want here. Add a constructor with a proper name
and call that.
Next step: rename all the other ones to HintFmt::literal(string).
Fixes https://github.com/NixOS/nix/issues/10238
2024-03-26 11:01:03 +03:00
Robert Hensing
9884018dfa
baseNameOf(): Remove all trailing slashes
2024-03-24 01:38:22 +01:00
Robert Hensing
3b7f2bf997
git/dumpTree: Assert name not empty before back()
2024-03-24 00:58:08 +01:00
Robert Hensing
c3fb2aa1f9
fix: Treat empty TMPDIR as unset
...
Fixes an instance of
nix: src/libutil/util.cc:139: nix::Path nix::canonPath(PathView, bool): Assertion `path != ""' failed.
... which I've been getting in one of my shells for some reason.
I have yet to find out why TMPDIR was empty, but it's no reason for
Nix to break.
2024-03-24 00:42:31 +01:00
detroyejr
717391731c
flakes: remove experimental repl-flake
2024-03-22 19:30:03 -04:00
Robert Hensing
7d2ead50e5
Merge pull request #10083 from lf-/jade/refactor-repl-input
...
refactor: move the repl input code to its own file
2024-03-20 22:37:40 +01:00
John Ericson
18945e3f44
Merge branch 'master' into overlayfs-store
2024-03-18 16:43:33 -04:00
John Ericson
cd35e00103
Adding missing tracking URL for local overlay store
...
Co-authored-by: Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com>
2024-03-18 16:41:16 -04:00
Jade Lovelace
76aced6915
finally.hh: delete copy constructor which is a bad idea
2024-03-12 18:25:35 -07:00
tomberek
a200ee6bf7
Merge pull request #9874 from pennae/error-reports
...
improve error reports somewhat
2024-03-08 10:51:14 -05:00
Eelco Dolstra
da62528487
Merge pull request from GHSA-2ffj-w4mj-pg37
...
Copy built outputs
2024-03-07 11:56:24 +01:00
tomberek
0a11080c58
Merge pull request #10172 from lf-/jade/fix-9725
...
fix: bounds check result in getMaxCPU
2024-03-07 00:58:44 -05:00
Jade Lovelace
9c64a09c70
fix: bounds check result in getMaxCPU
...
Fixes https://github.com/NixOS/nix/issues/9725
2024-03-06 20:57:31 -08:00
pennae
2be6b14328
match line endings used by parser and error reports
...
the parser treats a plain \r as a newline, error reports do not. this
can lead to interesting divergences if anything makes use of this
feature, with error reports pointing to wrong locations in the input (or
even outside the input altogether).
2024-03-06 23:11:12 +01:00
Théophane Hufschmitt
0d26358bda
Merge pull request #10151 from edolstra/fix-lstat-cache
...
PosixSourceAccessor::cachedLstat(): Use absolute path
2024-03-05 08:59:30 +01:00
Eelco Dolstra
4967c5ff6b
Fix macOS build
2024-03-04 22:24:12 +01:00
Eelco Dolstra
9ee590e113
PosixSourceAccessor::cachedLstat(): Use absolute path
...
Using the relative path can cause collisions between cache entries for
PosixSourceAccessors with different roots.
2024-03-04 21:54:35 +01:00
Rebecca Turner
2e8f4faa10
Fix build
...
Not sure why that was giving a duplicate symbol error, or why marking it
inline fixes it. Here it is!
2024-03-04 09:32:06 -08:00
Rebecca Turner
14b0356dc5
Forbid nested debuggers
2024-03-04 09:24:57 -08:00
Eelco Dolstra
75c5e1a5cc
Merge pull request #10126 from lf-/jade/kill-ndebug
...
Ban building Nix with NDEBUG
2024-03-03 20:01:12 +01:00
Jade Lovelace
2625e9fb0a
Ban building Nix with NDEBUG
...
When reviewing old PRs, I found that #9997 adds some code to ensure one
particular assert is always present. But, removing asserts isn't
something we do in our own release builds either in the flake here or in
nixpkgs, and is plainly a bad idea that increases support burden,
especially if other distros make bad choices of build flags in their Nix
packaging.
For context, the assert macro in the C standard is defined to do nothing
if NDEBUG is set.
There is no way in our build system to set -DNDEBUG without manually
adding it to CFLAGS, so this is simply a configuration we do not use.
Let's ban it at compile time.
I put this preprocessor directive in src/libutil.cc because it is not
obvious where else to put it, and it seems like the most logical file
since you are not getting a usable nix without it.
2024-03-02 11:22:46 -08:00
Ivan Shapovalov
c6f0407103
libutil/terminal: cache isTTY()
2024-03-02 16:32:04 +01:00
Ivan Shapovalov
8c1eeb4681
treewide: shouldANSI() -> isTTY()
2024-03-02 16:32:04 +01:00
med8bra
1bc89b588b
doc(xp-feature): add issue url in experimental feature details
2024-03-02 03:51:12 +01:00