[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnu-arch-users] arch_pfs_checksum_governs_strictly useless complicated?

From: Matthew Dempsky
Subject: [Gnu-arch-users] arch_pfs_checksum_governs_strictly useless complicated?
Date: Sat, 21 Aug 2004 03:06:57 -0500
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

In archive-pfs.c we have:

    arch_pfs_checksum_governs_strictly (struct arch_pfs_archive * arch)
      t_uchar * check_rule = 0;
      int answer = 0;
      if (arch->arch.signed_archive)
        return 1;
          check_rule = archive_signature_checking_rule_file (arch->, 
          if (check_rule)
            answer = 1;
      lim_free (0, check_rule);
      return answer;

which is basically long hand for "signed_archive || check_rule".
However, this routine is only called by pfs_revision_type and only
after arch_pfs_ensure_checksum_data successfully returns.  Further,
one of it's failure conditions is:

    if (check_rule && !arch->arch.signed_archive)

So by time we get to arch_pfs_checksum_governs_strictly we know this
condition must be false.  Therefor (someone double check my logic):

    1. cr || sa                    -- given (success condition for 
    2. ~(cr && ~sa)                -- given (negation of earlier failure 
    3. ~cr || sa                   -- De Morgan's (2)
    4. (cr || sa) && (~cr || sa)   -- conjunction (1, 3)
    5. sa || sa                    -- resolution (4)
    6. sa                          -- idempotent (5)

So, does anyone see a reason not to change this code to

    arch_pfs_checksum_governs_strictly (struct arch_pfs_archive * arch)
      return arch->arch.signed_archive;

?  Perhaps the original code is from a time when having a checking
rule for an unsigned archive was still okay, but unless we plan on
undoing that it seems unnecessarily complex.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]