From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id CJCaMQEQk2BYUQEAgWs5BA (envelope-from ) for ; Wed, 05 May 2021 23:37:05 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 6LxfLQEQk2CVYQAA1q6Kng (envelope-from ) for ; Wed, 05 May 2021 21:37:05 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5151111D82 for ; Wed, 5 May 2021 23:37:05 +0200 (CEST) Received: from localhost ([::1]:36190 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lePCa-0007Wh-E8 for larch@yhetil.org; Wed, 05 May 2021 17:37:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44212) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leP8h-0002Gx-4W for bug-guix@gnu.org; Wed, 05 May 2021 17:33:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:51313) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1leP8g-0008MK-RV for bug-guix@gnu.org; Wed, 05 May 2021 17:33:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1leP8g-0004r5-P1 for bug-guix@gnu.org; Wed, 05 May 2021 17:33:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#48240: [PATCH 1/4] store: 'open-connection' never returns #f. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Wed, 05 May 2021 21:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48240 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 48240@debbugs.gnu.org Received: via spool by 48240-submit@debbugs.gnu.org id=B48240.162025034518629 (code B ref 48240); Wed, 05 May 2021 21:33:02 +0000 Received: (at 48240) by debbugs.gnu.org; 5 May 2021 21:32:25 +0000 Received: from localhost ([127.0.0.1]:34618 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1leP85-0004qP-8u for submit@debbugs.gnu.org; Wed, 05 May 2021 17:32:25 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35670) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1leP81-0004pu-HJ for 48240@debbugs.gnu.org; Wed, 05 May 2021 17:32:23 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:33910) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leP7w-0007pw-9K; Wed, 05 May 2021 17:32:16 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=56410 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1leP7w-0005m1-25; Wed, 05 May 2021 17:32:16 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Wed, 5 May 2021 23:32:02 +0200 Message-Id: <20210505213205.28519-1-ludo@gnu.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <87a6p9rwu7.fsf@elephly.net> References: <87a6p9rwu7.fsf@elephly.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1620250625; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=329eJPxc4Pizs8FBZXRtm1IQIAjdrMSNodh/HL9GOkI=; b=MxJ1JnbvMAFORS40Vws7Zz7zRY3zjoVjgacvreruOOBrKT1j37o02fYQyznbSGbMkHIeMm lxe+youc7gsGydBGyrzw85wkZZ03zHXlIuaopuz9ZZwKgsziPZGlK/2SQn6KpyTxdRU6yW hl2PB+hqC0KgJKkNkpkMrTqNL9oESKJzhnpKX1aQz/KB0io2TRViMhAdlczDTTA9q+RSnM BhlAcfPqQjuqb4FLNMLIUxbIQgd5NXGTFIk8OZwNEtdKh0M4PZbF1Pq2RapBeubt6abv26 F2QqyNscfhKEICssfh+KmgGbnWP2A6qh6ae2E73He9FF6O3gFoLj7DJ75R+NmA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1620250625; a=rsa-sha256; cv=none; b=px3cezCAKKmHmSpE20KSr0onBPs4kS1OCfOF0ZtRDw/HD7l8DyZGfUHZE+b80kNJ7iJ/BH Bl1JLIQE1rUbZ4uWUeb5JgphMxf93NQ3z+kMtGdgl1I6aaqrepTtYrSx3pZLLwqgJbuNNf qkp0Sh3PP3HsHgv2V8bIFVBnvoYKrbnhw1dWDe0grHo4FLSjeHP/gVnv3jcqAyud/ZtLYX Gt3SAZQqmA38jqkaznXAlnO6famIDfNR4q6ElG5+Q8tI1UMHNav19AKH5giiDGZN+s7dbd 728gejcBoRDPfx4Dc82Pawk6UC4bV0XJbKXFqZZAq39ehdyaZTE9OhwBychgsA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Spam-Score: 2.03 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Queue-Id: 5151111D82 X-Spam-Score: 2.03 X-Migadu-Scanner: scn0.migadu.com X-TUID: I18lG5kyh1wi * guix/store.scm (open-connection)[handshake-error]: New procedure. Call it in code paths that would previously return #f. --- guix/store.scm | 66 +++++++++++++++++++++++++++----------------------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/guix/store.scm b/guix/store.scm index 37ae6cfedd..315ae4cdce 100644 --- a/guix/store.scm +++ b/guix/store.scm @@ -548,13 +548,16 @@ space on the file system so that the garbage collector can still operate, should the disk become full. When CPU-AFFINITY is true, it must be an integer corresponding to an OS-level CPU number to which the daemon's worker process for this connection will be pinned. Return a server object." + (define (handshake-error) + (raise (condition + (&store-connection-error (file (or port uri)) + (errno EPROTO)) + (&message (message "build daemon handshake failed"))))) + (guard (c ((nar-error? c) ;; One of the 'write-' or 'read-' calls below failed, but this is ;; really a connection error. - (raise (condition - (&store-connection-error (file (or port uri)) - (errno EPROTO)) - (&message (message "build daemon handshake failed")))))) + (handshake-error))) (let*-values (((port) (or port (connect-to-daemon uri))) ((output flush) @@ -562,32 +565,35 @@ for this connection will be pinned. Return a server object." (make-bytevector 8192)))) (write-int %worker-magic-1 port) (let ((r (read-int port))) - (and (= r %worker-magic-2) - (let ((v (read-int port))) - (and (= (protocol-major %protocol-version) - (protocol-major v)) - (begin - (write-int %protocol-version port) - (when (>= (protocol-minor v) 14) - (write-int (if cpu-affinity 1 0) port) - (when cpu-affinity - (write-int cpu-affinity port))) - (when (>= (protocol-minor v) 11) - (write-int (if reserve-space? 1 0) port)) - (letrec* ((built-in-builders - (delay (%built-in-builders conn))) - (conn - (%make-store-connection port - (protocol-major v) - (protocol-minor v) - output flush - (make-hash-table 100) - (make-hash-table 100) - vlist-null - built-in-builders))) - (let loop ((done? (process-stderr conn))) - (or done? (process-stderr conn))) - conn))))))))) + (unless (= r %worker-magic-2) + (handshake-error)) + + (let ((v (read-int port))) + (unless (= (protocol-major %protocol-version) + (protocol-major v)) + (handshake-error)) + + (write-int %protocol-version port) + (when (>= (protocol-minor v) 14) + (write-int (if cpu-affinity 1 0) port) + (when cpu-affinity + (write-int cpu-affinity port))) + (when (>= (protocol-minor v) 11) + (write-int (if reserve-space? 1 0) port)) + (letrec* ((built-in-builders + (delay (%built-in-builders conn))) + (conn + (%make-store-connection port + (protocol-major v) + (protocol-minor v) + output flush + (make-hash-table 100) + (make-hash-table 100) + vlist-null + built-in-builders))) + (let loop ((done? (process-stderr conn))) + (or done? (process-stderr conn))) + conn)))))) (define* (port->connection port #:key (version %protocol-version)) -- 2.31.1