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 57AC86ADDD for ; Mon, 25 Jan 2021 11:49:37 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 44B8C8F30 for ; Mon, 25 Jan 2021 11:49:07 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (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 id 45A988EF7 for ; Mon, 25 Jan 2021 11:49:06 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 093F644E37 for ; Mon, 25 Jan 2021 11:49:06 +0100 (CET) To: pbs-devel@lists.proxmox.com References: <20210125092916.28100-1-d.csapak@proxmox.com> <1611570722.leevyf14px.astroid@nora.none> From: Dominik Csapak Message-ID: <2df46a44-252f-f1f7-6642-14acc7fad372@proxmox.com> Date: Mon, 25 Jan 2021 11:49:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <1611570722.leevyf14px.astroid@nora.none> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.135 Adjusted score from AWL reputation of From: address KAM_ASCII_DIVIDERS 0.8 Spam that uses ascii formatting tricks KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment NICE_REPLY_A -0.001 Looks like a legit reply (A) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pbs-devel] [PATCH proxmox-backup] server/worker_task: remove all trailing newlines when reading task status X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jan 2021 10:49:37 -0000 On 1/25/21 11:37 AM, Fabian Grünbichler wrote: > On January 25, 2021 10:29 am, Dominik Csapak wrote: >> sometimes we may write multiple newlines at the end of tasks, >> for example if an error message contains multiple newlines itself >> >> simply ignore all newlines at the end of task logs instead of only one >> >> Signed-off-by: Dominik Csapak >> --- >> it happened to me during tape cleaning testing, a permission denied >> error had two newlines at the end, and i did not find the source of >> them... anyway i think we should ignore all of them >> >> src/server/worker_task.rs | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/src/server/worker_task.rs b/src/server/worker_task.rs >> index 967814c9..a4b2a35f 100644 >> --- a/src/server/worker_task.rs >> +++ b/src/server/worker_task.rs >> @@ -191,7 +191,7 @@ pub fn upid_read_status(upid: &UPID) -> Result { >> file.read_to_end(&mut data)?; >> >> // task logs should end with newline, we do not want it here >> - if !data.is_empty() && data[data.len()-1] == b'\n' { >> + while !data.is_empty() && data[data.len()-1] == b'\n' { > > while data.last() == Some(&b'\n') { > > (same assembly, no potential to introduce off-by-one in the future?) > yeah sounds right, the change from if to while was too obvious did not think about how to do it better altogether ;) >> data.pop(); >> } >> >> -- >> 2.20.1 >> >> >> >> _______________________________________________ >> pbs-devel mailing list >> pbs-devel@lists.proxmox.com >> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel >> >> >> > > > _______________________________________________ > pbs-devel mailing list > pbs-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel > >