public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: Lukas Wagner <l.wagner@proxmox.com>
Cc: pbs-devel@lists.proxmox.com
Subject: Re: [pbs-devel] [PATCH proxmox-backup 1/1] fix #3828: proxmox_backup_debug: Introduce `diff archive` subcommand.
Date: Thu, 27 Oct 2022 15:39:29 +0200	[thread overview]
Message-ID: <20221027133929.4chhr7kp6lpyujcj@casey.proxmox.com> (raw)
In-Reply-To: <20221027122806.79851-3-l.wagner@proxmox.com>

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.
> +    }
> +}




      reply	other threads:[~2022-10-27 13:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-27 12:28 [pbs-devel] [PATCH-SERIES proxmox-backup/pxar] " Lukas Wagner
2022-10-27 12:28 ` [pbs-devel] [PATCH pxar 1/1] derive PartialEq trait for Metadata and related structs Lukas Wagner
2022-10-27 13:38   ` [pbs-devel] applied: " Wolfgang Bumiller
2022-10-27 12:28 ` [pbs-devel] [PATCH proxmox-backup 1/1] fix #3828: proxmox_backup_debug: Introduce `diff archive` subcommand Lukas Wagner
2022-10-27 13:39   ` Wolfgang Bumiller [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221027133929.4chhr7kp6lpyujcj@casey.proxmox.com \
    --to=w.bumiller@proxmox.com \
    --cc=l.wagner@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal