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) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 106D16ADD1 for ; Mon, 25 Jan 2021 11:37:31 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 043608D37 for ; Mon, 25 Jan 2021 11:37:31 +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) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 50EC58D2A for ; Mon, 25 Jan 2021 11:37:29 +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 1DA9746093 for ; Mon, 25 Jan 2021 11:37:29 +0100 (CET) Date: Mon, 25 Jan 2021 11:37:21 +0100 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox Backup Server development discussion References: <20210125092916.28100-1-d.csapak@proxmox.com> In-Reply-To: <20210125092916.28100-1-d.csapak@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.15.0 (https://github.com/astroidmail/astroid) Message-Id: <1611570722.leevyf14px.astroid@nora.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL 0.026 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment 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:37:31 -0000 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 >=20 > simply ignore all newlines at the end of task logs instead of only one >=20 > 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 >=20 > src/server/worker_task.rs | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > 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)?; > =20 > // task logs should end with newline, we do not want it here > - if !data.is_empty() && data[data.len()-1] =3D=3D b'\n' { > + while !data.is_empty() && data[data.len()-1] =3D=3D b'\n' { while data.last() =3D=3D Some(&b'\n') { (same assembly, no potential to introduce off-by-one in the future?) > data.pop(); > } > =20 > --=20 > 2.20.1 >=20 >=20 >=20 > _______________________________________________ > pbs-devel mailing list > pbs-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel >=20 >=20 >=20 =