mirror of
https://github.com/NixOS/nix.git
synced 2025-11-28 13:11:00 +01:00
Merge pull request #14650 from xokdvium/double-quotes-lockfiles
libstore: Fix double quotes in debug logs for pathlocks
This commit is contained in:
commit
15b222b6d6
2 changed files with 13 additions and 13 deletions
|
|
@ -19,7 +19,7 @@ AutoCloseFD openLockFile(const std::filesystem::path & path, bool create)
|
||||||
|
|
||||||
fd = open(path.c_str(), O_CLOEXEC | O_RDWR | (create ? O_CREAT : 0), 0600);
|
fd = open(path.c_str(), O_CLOEXEC | O_RDWR | (create ? O_CREAT : 0), 0600);
|
||||||
if (!fd && (create || errno != ENOENT))
|
if (!fd && (create || errno != ENOENT))
|
||||||
throw SysError("opening lock file '%1%'", path);
|
throw SysError("opening lock file %1%", path);
|
||||||
|
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
@ -83,7 +83,7 @@ bool PathLocks::lockPaths(const std::set<std::filesystem::path> & paths, const s
|
||||||
checkInterrupt();
|
checkInterrupt();
|
||||||
std::filesystem::path lockPath = path + ".lock";
|
std::filesystem::path lockPath = path + ".lock";
|
||||||
|
|
||||||
debug("locking path '%1%'", path);
|
debug("locking path %1%", path);
|
||||||
|
|
||||||
AutoCloseFD fd;
|
AutoCloseFD fd;
|
||||||
|
|
||||||
|
|
@ -106,19 +106,19 @@ bool PathLocks::lockPaths(const std::set<std::filesystem::path> & paths, const s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
debug("lock acquired on '%1%'", lockPath);
|
debug("lock acquired on %1%", lockPath);
|
||||||
|
|
||||||
/* Check that the lock file hasn't become stale (i.e.,
|
/* Check that the lock file hasn't become stale (i.e.,
|
||||||
hasn't been unlinked). */
|
hasn't been unlinked). */
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (fstat(fd.get(), &st) == -1)
|
if (fstat(fd.get(), &st) == -1)
|
||||||
throw SysError("statting lock file '%1%'", lockPath);
|
throw SysError("statting lock file %1%", lockPath);
|
||||||
if (st.st_size != 0)
|
if (st.st_size != 0)
|
||||||
/* This lock file has been unlinked, so we're holding
|
/* This lock file has been unlinked, so we're holding
|
||||||
a lock on a deleted file. This means that other
|
a lock on a deleted file. This means that other
|
||||||
processes may create and acquire a lock on
|
processes may create and acquire a lock on
|
||||||
`lockPath', and proceed. So we must retry. */
|
`lockPath', and proceed. So we must retry. */
|
||||||
debug("open lock file '%1%' has become stale", lockPath);
|
debug("open lock file %1% has become stale", lockPath);
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -137,9 +137,9 @@ void PathLocks::unlock()
|
||||||
deleteLockFile(i.second, i.first);
|
deleteLockFile(i.second, i.first);
|
||||||
|
|
||||||
if (close(i.first) == -1)
|
if (close(i.first) == -1)
|
||||||
printError("error (ignored): cannot close lock file on '%1%'", i.second);
|
printError("error (ignored): cannot close lock file on %1%", i.second);
|
||||||
|
|
||||||
debug("lock released on '%1%'", i.second);
|
debug("lock released on %1%", i.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
fds.clear();
|
fds.clear();
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,9 @@ void PathLocks::unlock()
|
||||||
deleteLockFile(i.second, i.first);
|
deleteLockFile(i.second, i.first);
|
||||||
|
|
||||||
if (CloseHandle(i.first) == -1)
|
if (CloseHandle(i.first) == -1)
|
||||||
printError("error (ignored): cannot close lock file on '%1%'", i.second);
|
printError("error (ignored): cannot close lock file on %1%", i.second);
|
||||||
|
|
||||||
debug("lock released on '%1%'", i.second);
|
debug("lock released on %1%", i.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
fds.clear();
|
fds.clear();
|
||||||
|
|
@ -111,7 +111,7 @@ bool PathLocks::lockPaths(const std::set<std::filesystem::path> & paths, const s
|
||||||
checkInterrupt();
|
checkInterrupt();
|
||||||
std::filesystem::path lockPath = path;
|
std::filesystem::path lockPath = path;
|
||||||
lockPath += L".lock";
|
lockPath += L".lock";
|
||||||
debug("locking path '%1%'", path);
|
debug("locking path %1%", path);
|
||||||
|
|
||||||
AutoCloseFD fd;
|
AutoCloseFD fd;
|
||||||
|
|
||||||
|
|
@ -128,13 +128,13 @@ bool PathLocks::lockPaths(const std::set<std::filesystem::path> & paths, const s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
debug("lock acquired on '%1%'", lockPath);
|
debug("lock acquired on %1%", lockPath);
|
||||||
|
|
||||||
struct _stat st;
|
struct _stat st;
|
||||||
if (_fstat(fromDescriptorReadOnly(fd.get()), &st) == -1)
|
if (_fstat(fromDescriptorReadOnly(fd.get()), &st) == -1)
|
||||||
throw SysError("statting lock file '%1%'", lockPath);
|
throw SysError("statting lock file %1%", lockPath);
|
||||||
if (st.st_size != 0)
|
if (st.st_size != 0)
|
||||||
debug("open lock file '%1%' has become stale", lockPath);
|
debug("open lock file %1% has become stale", lockPath);
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue