From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 82DA0CA9E for ; Mon, 10 Jul 2023 11:09:17 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 623273CDD9 for ; Mon, 10 Jul 2023 11:08:47 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Mon, 10 Jul 2023 11:08:46 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 0E9F14250A for ; Mon, 10 Jul 2023 11:08:46 +0200 (CEST) Date: Mon, 10 Jul 2023 11:08:45 +0200 From: Christoph Heiss To: Proxmox VE development discussion , Noel Ullreich Message-ID: <2n2trh3hymowsnho7b6yqt7qkydyp6kehwikfzdm7aagulgiju@afncz7ynftae> References: <20230707115346.50279-1-n.ullreich@proxmox.com> <7457acytclvuaeemho4c2bd5g4zlohdihlawwyhtrs4rf6lyiv@z6umwzo45pca> <4ae70068-d2f9-f094-7475-26848564db69@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4ae70068-d2f9-f094-7475-26848564db69@proxmox.com> X-SPAM-LEVEL: Spam detection results: 0 AWL -0.066 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: Re: [pve-devel] [PATCH pve_installer v2] tui: don't abort install if min ram requirement is not met X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2023 09:09:17 -0000 On Mon, Jul 10, 2023 at 11:00:58AM +0200, Noel Ullreich wrote: > > On 10-07-2023 09:27, Christoph Heiss wrote: > > On Fri, Jul 07, 2023 at 01:53:46PM +0200, Noel Ullreich wrote: > > > [..] > > > @@ -256,6 +256,7 @@ fn installer_setup(in_test_mode: bool) -> Result<(LocaleInfo, RuntimeInfo), Stri > > > /// Anything that can be done late in the setup and will not result in fatal errors. > > > fn installer_setup_late(siv: &mut Cursive) { > > > let state = siv.user_data::().unwrap(); > > > + let mem = state.runtime_info.total_memory; > > Nit: Can be folded into the `if` condition directly. It isn't terribly > > long nor the condition complicated, and it results in a nice "isolated" > > block. > > This doesn't work: > > ``` > error[E0499]: cannot borrow `*siv` as mutable more than once at a time >    --> proxmox-tui-installer/src/main.rs:263:39 >     | > 256 |     let state = siv.user_data::().unwrap(); >     |                 --------------------------------- first mutable borrow > occurs here > ... > 263 |                 display_setup_warning(siv, &format!("Failed to apply > keyboard layout: {err}")); >     |                                       ^^^ second mutable borrow occurs > here > ... > 268 |     if state.runtime_info.total_memory < 1024 { >     |        ------------------------------- first borrow later used here > > For more information about this error, try `rustc --explain E0499`. > error: could not compile `proxmox-tui-installer` due to previous error > ``` > > That's why I created this extra variable. Right, did not think about that, even had the same problem occur to me last week while working on some other patches. Then it is fine as-is of course, maybe just rename it to `total_memory` as `mem` is quite generic (but that is really just bike-shedding it this point).