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 D56B68BCC4 for ; Thu, 27 Oct 2022 15:39:30 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id BF19437FE6 for ; Thu, 27 Oct 2022 15:39:30 +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 ; Thu, 27 Oct 2022 15:39:30 +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 F372044C2C for ; Thu, 27 Oct 2022 15:39:29 +0200 (CEST) Date: Thu, 27 Oct 2022 15:39:29 +0200 From: Wolfgang Bumiller To: Lukas Wagner Cc: pbs-devel@lists.proxmox.com Message-ID: <20221027133929.4chhr7kp6lpyujcj@casey.proxmox.com> References: <20221027122806.79851-1-l.wagner@proxmox.com> <20221027122806.79851-3-l.wagner@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221027122806.79851-3-l.wagner@proxmox.com> X-SPAM-LEVEL: Spam detection results: 0 AWL 0.243 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% 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 Subject: Re: [pbs-devel] [PATCH proxmox-backup 1/1] fix #3828: proxmox_backup_debug: Introduce `diff archive` subcommand. 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: Thu, 27 Oct 2022 13:39:30 -0000 On Thu, Oct 27, 2022 at 02:28:06PM +0200, Lukas Wagner wrote: > +async fn compare_file(file_a: &FileEntry, file_b: &FileEntry) -> bool { > + if file_a.metadata() != file_b.metadata() { > + // Check if mtime, permissions, ACLs, etc. have changed - if they have changed, we consider > + // the file as modified. > + return false; > + } > + > + match (file_a.kind(), file_b.kind()) { > + (EntryKind::Symlink(a), EntryKind::Symlink(b)) => { > + // Check whether the link target has changed. > + a.as_os_str() == b.as_os_str() > + } > + (EntryKind::Hardlink(a), EntryKind::Hardlink(b)) => { > + // Check whether the link target has changed. > + a.as_os_str() == b.as_os_str() > + } > + (EntryKind::Device(a), EntryKind::Device(b)) => a.major == b.major && a.minor == b.minor, > + (EntryKind::Socket, EntryKind::Socket) => true, > + (EntryKind::Fifo, EntryKind::Fifo) => true, > + (EntryKind::GoodbyeTable, EntryKind::GoodbyeTable) => { > + // For some reason, .kind() returns GoodbyeTable for FIFOs/Sockets - is this a bug? Interesting. Fixed & updated the tests for this. This only happens in the random accessor as it never reached the FILENAME/GOODBYE header which would normally take care of updating the kind to reflect the metadata. Lingering bugs like this are one of the things that make me want to replace most of the internals with language-supported generators soon... > + // This match arm can be removed if this is fixed. > + true > + } > + (EntryKind::File { size: size_a, .. }, EntryKind::File { size: size_b, .. }) => { > + // At this point we know that all metadata including mtime is > + // the same. To speed things up, we consider the files as equal if they also have > + // the same size. > + // If one were completely paranoid, one could compare the actual file contents, > + // but this decreases performance drastically. > + size_a == size_b > + } > + (EntryKind::Directory, EntryKind::Directory) => true, > + (_, _) => false, // Kind has changed, so we of course consider it modified. > + } > +}