!VRULIdgoKmKPzJZzjj:nixos.org

Nix Hackers

908 Members
For people hacking on the Nix package manager itself190 Servers

Load older messages


SenderMessageTime
8 Dec 2025
@xokdvium:matrix.orgSergei Zimmerman (xokdvium) Darwin linker doesn’t like plus in soname 11:57:45
@dramforever:matrix.orgdramforeveris it like, macos version dependent11:58:18
@dramforever:matrix.orgdramforeverdo you have a link or remember any keywords in the plus sign fix or something12:02:13
@dramforever:matrix.orgdramforeveri can't find it12:02:26
@vcunat:matrix.orgVladimír Čunát I'd think it's best to just avoid + in SONAMEs... 12:02:57
@vcunat:matrix.orgVladimír Čunát(seems like pointless risks/trouble)12:03:26
@dramforever:matrix.orgdramforeverfound it https://github.com/NixOS/nix/pull/1443212:07:18
@dramforever:matrix.orgdramforeverwait, 2.31 doesn't even have the new soname thing12:08:45
@dramforever:matrix.orgdramforeverso it isn't that12:08:50
@dramforever:matrix.orgdramforeveri'm in works on my machine hell12:15:41
@dramforever:matrix.orgdramforeveri'm going to try to cause a full rebuild of nix and see if that triggers it12:16:16
@dramforever:matrix.orgdramforeverwell not my machine but you get it12:18:20
@xokdvium:matrix.orgSergei 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:matrix.orgdramforever i'm running a build of 2.3.2+01 to see if i can reproduce it 12:19:56
@dramforever:matrix.orgdramforever * i'm running a build of 2.31.2+01 to see if i can reproduce it 12:20:08
@dramforever:matrix.orgdramforever but it's real tempting to just make it like 2.31.2-1 or even just 2.31.2 12:20:24
@dramforever:matrix.orgdramforever2.31.2+01 successfully built i'm so done12:28:31
@xokdvium:matrix.orgSergei Zimmerman (xokdvium)Mhm, I see. Probably 196c21c5a0e2f9b3149689ea36789cf0478d893a is the culprit12:36:40
@xokdvium:matrix.orgSergei 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
@xokdvium:matrix.orgSergei 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
@xokdvium:matrix.orgSergei 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:matrix.orgdramforeveroooh this is why it only fails if no sandbox12:43:24
@xokdvium:matrix.orgSergei Zimmerman (xokdvium)Yup...12:43:39
@dramforever:matrix.orgdramforeveroh12:46:04
@dramforever:matrix.orgdramforeverduh12:46:07
@dramforever:matrix.orgdramforever i was trying to --no-sandbox and i don't think that does anything... 12:46:20
@dramforever:matrix.orgdramforeverprobably for the better12:46:34
@dramforever:matrix.orgdramforeverthis is fixed but it's so un-cherry-pick-able13:02:48
@dramforever:matrix.orgdramforeverthere's like a whole new url parsing infrastructure thing added on13:03:08
@xokdvium:matrix.orgSergei Zimmerman (xokdvium) Yeah, I know. Probably just doing a percentDecode on the localPath would be enough 13:03:42

Show newer messages


Back to Room ListRoom Version: 6