From 23ddb0bfc718e4641419bc0e199f1e6dd69b10a0 Mon Sep 17 00:00:00 2001 From: Ilja <2098356+iljah@users.noreply.github.com> Date: Wed, 7 Jan 2026 18:52:47 +0200 Subject: [PATCH] Throw on unsupported type in nix::listNarImpl() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prevent ``` ../src/libutil/nar-accessor.cc: In function ”nix::ListNarResult nix::listNarImpl(SourceAccessor&, const CanonPath&) [with bool deep = true]”: ../src/libutil/nar-accessor.cc:335:1: varoitus: ei-void-tyyppisen funktion loppu saavutettu [-Wreturn-type] 335 | } | ^ ../src/libutil/nar-accessor.cc: In function ”nix::ListNarResult nix::listNarImpl(SourceAccessor&, const CanonPath&) [with bool deep = false]”: ../src/libutil/nar-accessor.cc:335:1: varoitus: ei-void-tyyppisen funktion loppu saavutettu [-Wreturn-type] ``` --- src/libstore/path-references.cc | 2 +- src/libutil/nar-listing.cc | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libstore/path-references.cc b/src/libstore/path-references.cc index 3d783bbe4be..9571da65cd9 100644 --- a/src/libstore/path-references.cc +++ b/src/libstore/path-references.cc @@ -124,7 +124,7 @@ void scanForReferencesDeep( case SourceAccessor::tFifo: case SourceAccessor::tUnknown: default: - throw Error("file '%s' has an unsupported type", path.abs()); + throw Error("file '%s' has an unsupported type", accessor.showPath(path)); } }; diff --git a/src/libutil/nar-listing.cc b/src/libutil/nar-listing.cc index 1483c7a0c8e..358256bf0c9 100644 --- a/src/libutil/nar-listing.cc +++ b/src/libutil/nar-listing.cc @@ -157,7 +157,8 @@ static ListNarResult listNarImpl(SourceAccessor & accessor, const CanonPat case SourceAccessor::Type::tSocket: case SourceAccessor::Type::tFifo: case SourceAccessor::Type::tUnknown: - assert(false); // cannot happen for NARs + default: + throw Error("file '%s' has an unsupported type", accessor.showPath(path)); } }