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 190B861052 for ; Fri, 11 Sep 2020 14:35:18 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0E00E24C0E for ; Fri, 11 Sep 2020 14:34:48 +0200 (CEST) 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 86CBD24C04 for ; Fri, 11 Sep 2020 14:34:47 +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 55D8744B6C for ; Fri, 11 Sep 2020 14:34:47 +0200 (CEST) From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= To: pbs-devel@lists.proxmox.com Date: Fri, 11 Sep 2020 14:34:34 +0200 Message-Id: <20200911123439.1876094-2-f.gruenbichler@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200911123439.1876094-1-f.gruenbichler@proxmox.com> References: <20200911123439.1876094-1-f.gruenbichler@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.027 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [catalog.rs] Subject: [pbs-devel] [PATCH proxmox-backup 1/6] catalog dump: preserve original mtime 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: Fri, 11 Sep 2020 12:35:18 -0000 even if it can't be handled by chrono. silently replacing it with epoch 0 is confusing.. Signed-off-by: Fabian Grünbichler --- src/backup/catalog.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/backup/catalog.rs b/src/backup/catalog.rs index bc2e471e..85a32623 100644 --- a/src/backup/catalog.rs +++ b/src/backup/catalog.rs @@ -5,7 +5,7 @@ use std::io::{Read, Write, Seek, SeekFrom}; use std::os::unix::ffi::OsStrExt; use anyhow::{bail, format_err, Error}; -use chrono::offset::{TimeZone, Local}; +use chrono::offset::{TimeZone, Local, LocalResult}; use pathpatterns::{MatchList, MatchType}; use proxmox::tools::io::ReadExt; @@ -533,17 +533,17 @@ impl CatalogReader { self.dump_dir(&path, pos)?; } CatalogEntryType::File => { - let dt = Local - .timestamp_opt(mtime as i64, 0) - .single() // chrono docs say timestamp_opt can only be None or Single! - .unwrap_or_else(|| Local.timestamp(0, 0)); + let mtime_string = match Local.timestamp_opt(mtime as i64, 0) { + LocalResult::Single(time) => time.to_rfc3339_opts(chrono::SecondsFormat::Secs, false), + _ => (mtime as i64).to_string(), + }; println!( "{} {:?} {} {}", etype, path, size, - dt.to_rfc3339_opts(chrono::SecondsFormat::Secs, false), + mtime_string, ); } _ => { -- 2.20.1