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 7E0FE6ADB7 for ; Mon, 25 Jan 2021 10:29:49 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6F4AA2FF50 for ; Mon, 25 Jan 2021 10:29:19 +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 6F6152FF48 for ; Mon, 25 Jan 2021 10:29:18 +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 1F165440D2 for ; Mon, 25 Jan 2021 10:29:17 +0100 (CET) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Mon, 25 Jan 2021 10:29:16 +0100 Message-Id: <20210125092916.28100-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.265 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: [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 09:29:49 -0000 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' { data.pop(); } -- 2.20.1