Bug 28759

Summary: ar: Add --thin to avoid 'T' conflict with X/Open System Interface
Product: binutils Reporter: Fangrui Song <i>
Component: binutilsAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal CC: nickc
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:

Description Fangrui Song 2022-01-10 21:05:50 UTC
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ar.html

-T
[XSI] [Option Start] Allow filename truncation of extracted files whose archive names are longer than the file system can support. By default, extracting a file with a name that is too long shall be an error; a diagnostic message shall be written and the file shall not be extracted. [Option End]

FreeBSD ar/macOS ar/elfutils (eu-ar) appear to take this interpretation. For portability, the 'T' thin archive semantics should be discouraged in favor of --thin.
Comment 2 Sourceware Commits 2022-01-11 17:00:15 UTC
The master branch has been updated by Fangrui Song <maskray@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d1b69c506f7855e5b90039abdadaf1d05b085c4c

commit d1b69c506f7855e5b90039abdadaf1d05b085c4c
Author: Fangrui Song <maskray@google.com>
Date:   Tue Jan 11 08:59:40 2022 -0800

    ar: Add --thin for creating thin archives
    
    In many ar implementations (FreeBSD, elfutils, etc), -T has the X/Open
    System Interface specified semantics. Therefore -T for thin archives is
    not recommended for portability. -T is deprecated without diagnostics.
    
        PR binutils/28759
        * ar.c (long_options): Add --thin.
        (usage) Add --thin. Deprecate -T without diagnostics.
        * doc/binutils.texi: Add doc.
        * NEWS: Mention --thin.
        * binutils/testsuite/binutils-all/ar.exp: Add tests.
Comment 3 Fangrui Song 2022-01-11 17:01:56 UTC
Fixed for the upcoming 2.38