From 3a62be7227e22df2be6b587aa23079f823958c04 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sun, 14 Dec 2025 11:49:13 -0500 Subject: [PATCH] Fix path locks move/assignment No copying allowed Co-authored-by: Sergei Zimmerman --- src/libstore/include/nix/store/pathlocks.hh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/libstore/include/nix/store/pathlocks.hh b/src/libstore/include/nix/store/pathlocks.hh index 7e27bec4c..e6bb898e7 100644 --- a/src/libstore/include/nix/store/pathlocks.hh +++ b/src/libstore/include/nix/store/pathlocks.hh @@ -33,6 +33,22 @@ private: public: PathLocks(); PathLocks(const std::set & paths, const std::string & waitMsg = ""); + + PathLocks(PathLocks && other) noexcept + : fds(std::exchange(other.fds, {})) + , deletePaths(other.deletePaths) + { + } + + PathLocks & operator=(PathLocks && other) noexcept + { + fds = std::exchange(other.fds, {}); + deletePaths = other.deletePaths; + return *this; + } + + PathLocks(const PathLocks &) = delete; + PathLocks & operator=(const PathLocks &) = delete; bool lockPaths(const std::set & _paths, const std::string & waitMsg = "", bool wait = true); ~PathLocks(); void unlock();