[Bug 210330] "ar -s" not deterministic by default

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Jun 16 17:42:01 UTC 2016


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=210330

            Bug ID: 210330
           Summary: "ar -s" not deterministic by default
           Product: Base System
           Version: 11.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: emaste at freebsd.org

ar(1) produces deterministic output by default for the -q/-r options
(append/replace), as described in the -D option:

     -D      When used in combination with the -r or -q option, insert 0's
             instead of the real mtime, uid and gid values and 0644 instead of
             file mode from the members named by arguments file ....  This
             ensures that checksums on the resulting archives are reproducible
             when member contents are identical.  This option is enabled by
             default.  If multiple -D and -U options are specified on the com‐
             mand line, the final one takes precedence.

It is not documented here, but this is also the case when ar is invoked as
ranlib(1).

However, 'ar -s <file>' is supposed to be equivalent to ranlib:

     -s      Add an archive symbol table (see ar(5)) to the archive specified
             by argument archive.  Invoking ar with the -s option alone is
             equivalent to invoking ranlib.

but ar -s does not produce deterministic output by default.

In addition to -q/-r, ar -s (AR_S in ar.c) will write an archive symbol table
if no mode is specified (-s with no other args), or in combination with
-p/-t/-x (which are really read-options).

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list