~ruther/guix-local

5ff038473e3f3d6a84e69c712446ba3e200aa9b2 — Ludovic Courtès 3 months ago 94579ed
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
M nix/libstore/local-store.cc => nix/libstore/local-store.cc +1 -1
@@ 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);
}


M nix/libstore/optimise-store.cc => nix/libstore/optimise-store.cc +2 -2
@@ 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

M nix/libutil/affinity.cc => nix/libutil/affinity.cc +1 -1
@@ 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
}


M nix/nix-daemon/guix-daemon.cc => nix/nix-daemon/guix-daemon.cc +11 -10
@@ 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 ();