Menu

#500 Allow deterministic mode by default in ar(1) and add -U option to disable

2.0
new
nobody
None
2018-09-29
2015-07-08
Ed Maste
No

See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=196929 for background. In FreeBSD I would like to have ar(1) and ranlib(1) operate in deterministic mode by default, but if we do that we need an option to turn deterministic mode back off. Binutils has -U for that purpose -- from the Binutils manual:

-D
Operate in deterministic mode. The symbol map archive member's header will show zero for the UID, GID, and timestamp. When this option is used, multiple runs will produce identical output files.

If binutils was configured with --enable-deterministic-archives, then this mode is on by default. It can be disabled with the `-U' option, described below.

-U
Do not operate in deterministic mode. This is the inverse of the `-D' option, above: the archive index will get actual UID, GID, timestamp, and file mode values.

If binutils was configured without --enable-deterministic-archives, then this mode is on by default.

Discussion

  • Ed Maste

    Ed Maste - 2015-07-27

    -U added in [r3230]. Still need a mechanism to build ar with -D enabled by default

     

    Related

    Commit: [r3230]

  • Joseph Koshy

    Joseph Koshy - 2018-09-29

    Making deterministic mode the default might be surprising to users since then an 'ar r' (archive creation) followed by an 'ar x' (file extraction) would not be idempotent.

    People do use ar as a general-purpose archiver. In fact, POSIX says:

    "The ability to handle any type of file is not only historical practice for most implementations, but is also a reasonable expectation."

    (from: http://pubs.opengroup.org/onlinepubs/009695399/utilities/ar.html).

     

Log in to post a comment.