libstore: don't crash when talking to old ssh:// remotes
protocol version 0x204 dates back to nix 2.0 in 2017. that's old enough to not worry and drop the gratuitous assertion crash we see it instead. Change-Id: I8cf23373d4daabccab61f1cbb670947479f0d2bc
This commit is contained in:
@@ -151,6 +151,13 @@ struct LegacySSHStore final : public Store
|
||||
if (GET_PROTOCOL_MAJOR(conn->remoteVersion) != 0x200)
|
||||
throw Error("unsupported 'nix-store --serve' protocol version on '%s'", host);
|
||||
|
||||
/* No longer support protocols this old*/
|
||||
if (GET_PROTOCOL_MINOR(conn->remoteVersion) < 4) {
|
||||
throw Error(
|
||||
"remote '%s' is too old (protocol version %x)", host, conn->remoteVersion
|
||||
);
|
||||
}
|
||||
|
||||
} catch (EndOfFile & e) {
|
||||
throw Error("cannot connect to '%1%'", host);
|
||||
}
|
||||
@@ -170,9 +177,6 @@ struct LegacySSHStore final : public Store
|
||||
try {
|
||||
auto conn(TRY_AWAIT(connections->get()));
|
||||
|
||||
/* No longer support missing NAR hash */
|
||||
assert(GET_PROTOCOL_MINOR(conn->remoteVersion) >= 4);
|
||||
|
||||
debug("querying remote host '%s' for info on '%s'", host, printStorePath(path));
|
||||
|
||||
*conn->to << ServeProto::Command::QueryPathInfos << PathSet{printStorePath(path)};
|
||||
@@ -292,12 +296,9 @@ private:
|
||||
void putBuildSettings(Connection & conn)
|
||||
{
|
||||
*conn.to << settings.maxSilentTime << settings.buildTimeout;
|
||||
if (GET_PROTOCOL_MINOR(conn.remoteVersion) >= 2) {
|
||||
*conn.to << settings.maxLogSize;
|
||||
}
|
||||
if (GET_PROTOCOL_MINOR(conn.remoteVersion) >= 3)
|
||||
*conn.to << 0 // buildRepeat hasn't worked for ages anyway
|
||||
<< 0;
|
||||
*conn.to << settings.maxLogSize;
|
||||
*conn.to << 0 // buildRepeat hasn't worked for ages anyway
|
||||
<< 0;
|
||||
|
||||
if (GET_PROTOCOL_MINOR(conn.remoteVersion) >= 7) {
|
||||
*conn.to << ((int) settings.keepFailed);
|
||||
|
||||
Reference in New Issue
Block a user