| 8 Dec 2025 |
Sergei Zimmerman (xokdvium) | Darwin linker doesn’t like plus in soname | 11:57:45 |
dramforever | is it like, macos version dependent | 11:58:18 |
dramforever | do you have a link or remember any keywords in the plus sign fix or something | 12:02:13 |
dramforever | i can't find it | 12:02:26 |
Vladimír Čunát | I'd think it's best to just avoid + in SONAMEs... | 12:02:57 |
Vladimír Čunát | (seems like pointless risks/trouble) | 12:03:26 |
dramforever | found it https://github.com/NixOS/nix/pull/14432 | 12:07:18 |
dramforever | wait, 2.31 doesn't even have the new soname thing | 12:08:45 |
dramforever | so it isn't that | 12:08:50 |
dramforever | i'm in works on my machine hell | 12:15:41 |
dramforever | i'm going to try to cause a full rebuild of nix and see if that triggers it | 12:16:16 |
dramforever | well not my machine but you get it | 12:18:20 |
Sergei Zimmerman (xokdvium) | In reply to @dramforever:matrix.org wait, 2.31 doesn't even have the new soname thing Argh, somehow the plus sign being pct encoded (%2B) somehow matters. Wtf | 12:18:48 |
dramforever | i'm running a build of 2.3.2+01 to see if i can reproduce it | 12:19:56 |
dramforever | * i'm running a build of 2.31.2+01 to see if i can reproduce it | 12:20:08 |
dramforever | but it's real tempting to just make it like 2.31.2-1 or even just 2.31.2 | 12:20:24 |
dramforever | 2.31.2+01 successfully built i'm so done | 12:28:31 |
Sergei Zimmerman (xokdvium) | Mhm, I see. Probably 196c21c5a0e2f9b3149689ea36789cf0478d893a is the culprit | 12:36:40 |
Sergei Zimmerman (xokdvium) | FML. That is fixed on 2.32. Basically it doesn't do pct-decoding as it should:
commit 196c21c5a0e2f9b3149689ea36789cf0478d893a
Author: Farid Zakaria <farid.m.zakaria@gmail.com>
Date: Wed Jul 16 21:09:59 2025 -0700
Add helpful messages when file:// used as tarball
When `file://` is used accidentally in a flake as the source it is
expected to be a tarball by default.
Add some friendlier error messages to either inform the user this is not
in fact a tarball or if it's a git directory, let them know they can use
`git+file`.
fixes #12935
diff --git a/src/libfetchers/tarball.cc b/src/libfetchers/tarball.cc
index b0822cc33..59316eabd 100644
--- a/src/libfetchers/tarball.cc
+++ b/src/libfetchers/tarball.cc
@@ -111,6 +111,25 @@ static DownloadTarballResult downloadTarball_(
const Headers & headers,
const std::string & displayPrefix)
{
+
+ // Some friendly error messages for common mistakes.
+ // Namely lets catch when the url is a local file path, but
+ // it is not in fact a tarball.
+ if (url.rfind("file://", 0) == 0) {
+ // Remove "file://" prefix to get the local file path
+ std::string localPath = url.substr(7);
+ if (!std::filesystem::exists(localPath)) {
+ throw Error("tarball '%s' does not exist.", localPath);
+ }
+ if (std::filesystem::is_directory(localPath)) {
+ if (std::filesystem::exists(localPath + "/.git")) {
+ throw Error(
+ "tarball '%s' is a git repository, not a tarball. Please use `git+file` as the scheme.", localPath);
+ }
+ throw Error("tarball '%s' is a directory, not a file.", localPath);
+ }
+ }
+
Cache::Key cacheKey{"tarball", {{"url", url}}};
auto cached = settings.getCache()->lookupExpired(cacheKey);
| 12:38:19 |
Sergei Zimmerman (xokdvium) | Specifically this:
std::string localPath = url.substr(7);
+ if (!std::filesystem::exists(localPath)) {
+ throw Error("tarball '%s' does not exist.", localPath);
+ }
| 12:38:59 |
Sergei Zimmerman (xokdvium) | Basically it will fail shamefully when encountering a symbol that gets pct-encoded in the file:// URL and barf early even though the later fetching code does the decoding correctly and since NIX_BUILD_TOP is in a dir that has + in it... | 12:41:56 |
dramforever | oooh this is why it only fails if no sandbox | 12:43:24 |
Sergei Zimmerman (xokdvium) | Yup... | 12:43:39 |
dramforever | oh | 12:46:04 |
dramforever | duh | 12:46:07 |
dramforever | i was trying to --no-sandbox and i don't think that does anything... | 12:46:20 |
dramforever | probably for the better | 12:46:34 |
dramforever | this is fixed but it's so un-cherry-pick-able | 13:02:48 |
dramforever | there's like a whole new url parsing infrastructure thing added on | 13:03:08 |
Sergei Zimmerman (xokdvium) | Yeah, I know. Probably just doing a percentDecode on the localPath would be enough | 13:03:42 |