From 5ff038473e3f3d6a84e69c712446ba3e200aa9b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 12 Jan 2026 09:15:03 +0100 Subject: [PATCH] daemon: Fix several format strings. This is a followup to 3af52f845fe2ceb448416ac7b9f48925673c594e and 6f1448ef89c8ad29e2a479099531fd3a87701e46. * nix/libstore/local-store.cc (LocalStore::queryValidPathId): Change %1% to {}. * nix/libstore/optimise-store.cc (LocalStore::optimisePath_): Likewise. * nix/nix-daemon/guix-daemon.cc (open_unix_domain_socket): Likewise. (main): Likewise. * nix/libutil/affinity.cc (restoreAffinity): Remove useless %1%. Change-Id: I3a7cd79cd69ab58f14118662f1dcf2fef067a6b7 --- nix/libstore/local-store.cc | 2 +- nix/libstore/optimise-store.cc | 4 ++-- nix/libutil/affinity.cc | 2 +- nix/nix-daemon/guix-daemon.cc | 21 +++++++++++---------- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/nix/libstore/local-store.cc b/nix/libstore/local-store.cc index 43f3c1770a8..b8308b1aae5 100644 --- a/nix/libstore/local-store.cc +++ b/nix/libstore/local-store.cc @@ -654,7 +654,7 @@ uint64_t LocalStore::queryValidPathId(const Path & path) { auto use(stmtQueryPathInfo.use()(path)); if (!use.next()) - throw Error(std::format("path `%1%' is not valid", path)); + throw Error(std::format("path `{}' is not valid", path)); return use.getInt(0); } diff --git a/nix/libstore/optimise-store.cc b/nix/libstore/optimise-store.cc index 54aa166c344..93ce1f55365 100644 --- a/nix/libstore/optimise-store.cc +++ b/nix/libstore/optimise-store.cc @@ -182,12 +182,12 @@ void LocalStore::optimisePath_(OptimiseStats & stats, const Path & path, InodeHa } if (st.st_size != stLink.st_size) { - printMsg(lvlError, std::format("removing corrupted link `%1%'", linkPath)); + printMsg(lvlError, std::format("removing corrupted link `{}'", linkPath)); unlink(linkPath.c_str()); goto retry; } - printMsg(lvlTalkative, std::format("linking `%1%' to `%2%'", path, linkPath)); + printMsg(lvlTalkative, std::format("linking `{}' to `{}'", path, linkPath)); /* Make the containing directory writable, but only if it's not the store itself (we don't want or need to mess with its diff --git a/nix/libutil/affinity.cc b/nix/libutil/affinity.cc index 53500c22ab9..38270c0eb4c 100644 --- a/nix/libutil/affinity.cc +++ b/nix/libutil/affinity.cc @@ -49,7 +49,7 @@ void restoreAffinity() #if HAVE_SCHED_SETAFFINITY if (!didSaveAffinity) return; if (sched_setaffinity(0, sizeof(cpu_set_t), &savedAffinity) == -1) - printMsg(lvlError, "failed to restore affinity %1%"); + printMsg(lvlError, "failed to restore affinity"); #endif } diff --git a/nix/nix-daemon/guix-daemon.cc b/nix/nix-daemon/guix-daemon.cc index 341e39c2907..58a6f3eba45 100644 --- a/nix/nix-daemon/guix-daemon.cc +++ b/nix/nix-daemon/guix-daemon.cc @@ -329,8 +329,8 @@ open_unix_domain_socket (const char *file) struct sockaddr_un addr; addr.sun_family = AF_UNIX; if (fileRel.size () >= sizeof (addr.sun_path)) - throw Error (std::vformat( (_("socket file name '%1%' is too long")), - std::make_format_args(fileRel))); + throw Error (std::vformat ((_("socket file name '{}' is too long")), + std::make_format_args (fileRel))); strcpy (addr.sun_path, fileRel.c_str ()); unlink (file); @@ -523,14 +523,15 @@ main (int argc, char *argv[]) /* We were not "socket-activated" so open the sockets specified by LISTEN_OPTIONS. */ sockets = listening_sockets (listen_options); - else { - auto size = sockets.size(); - printMsg (lvlInfo, - std::vformat((ngettext ("socket-activated with %1% socket", - "socket-activated with %1% sockets", - size)), - std::make_format_args(size))); - } + else + { + auto size = sockets.size(); + printMsg (lvlInfo, + std::vformat((ngettext ("socket-activated with {} socket", + "socket-activated with {} sockets", + size)), + std::make_format_args(size))); + } /* Effect all the changes made via 'settings.set'. */ settings.update ();