git: 2076973231d8 - stable/13 - ar: deprecate -T option

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Wed, 05 Jan 2022 01:54:09 UTC
The branch stable/13 has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=2076973231d8d2e1c46bc5825e676a44643b6bfa

commit 2076973231d8d2e1c46bc5825e676a44643b6bfa
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2021-12-29 19:59:06 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2022-01-05 01:53:27 +0000

    ar: deprecate -T option
    
    Other ar implementations (GNU, LLVM) use -T to mean thin archive
    rather than use only the first fifteen characters of the archive member
    name.  We support both -T and -f for this, with -f documented as an
    alias of -T.
    
    An exp-run showed that the ports invoking `ar -T` expect thin archives,
    not truncated names.  Switch -f to be the documented flag for this
    behaviour, and emit a warning when -T is used.
    
    The warning will be changed to an error in the future (in main), once
    ports no longer use -T.
    
    PR:             260523 [exp-run]
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit edadbb46065d9ee9559140b2522197fcdba57064)
---
 usr.bin/ar/ar.1 | 14 +++++++++-----
 usr.bin/ar/ar.c |  6 +++++-
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/usr.bin/ar/ar.1 b/usr.bin/ar/ar.1
index 9d9a860e6ca5..ce0dab1c5af7 100644
--- a/usr.bin/ar/ar.1
+++ b/usr.bin/ar/ar.1
@@ -23,7 +23,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 16, 2016
+.Dd December 29, 2021
 .Dt AR 1
 .Os
 .Sh NAME
@@ -222,8 +222,8 @@ and
 .Fl U
 options are specified on the command line, the final one takes precedence.
 .It Fl f
-Synonymous with option
-.Fl T .
+Use only the first fifteen characters of the archive member name or
+command line file name argument when naming archive members.
 .It Fl i Ar member-before
 Synonymous with option
 .Fl b .
@@ -314,8 +314,12 @@ List the files specified by arguments
 in the order in which they appear in the archive, one per line.
 If no files are specified, all files in the archive are listed.
 .It Fl T
-Use only the first fifteen characters of the archive member name or
-command line file name argument when naming archive members.
+Deprecated alias for
+.Fl f .
+In other implementations of
+.Nm ,
+.Fl T
+creates a "thin" archive.
 .It Fl u
 Conditionally update the archive or extract members.
 When used with the
diff --git a/usr.bin/ar/ar.c b/usr.bin/ar/ar.c
index b131163342a6..51d114f6b7fa 100644
--- a/usr.bin/ar/ar.c
+++ b/usr.bin/ar/ar.c
@@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/queue.h>
 #include <sys/types.h>
 #include <archive.h>
+#include <err.h>
 #include <errno.h>
 #include <getopt.h>
 #include <libgen.h>
@@ -194,7 +195,6 @@ main(int argc, char **argv)
 			Uflag = 0;
 			break;
 		case 'f':
-		case 'T':
 			bsdar->options |= AR_TR;
 			break;
 		case 'j':
@@ -227,6 +227,10 @@ main(int argc, char **argv)
 		case 's':
 			bsdar->options |= AR_S;
 			break;
+		case 'T':
+			warnx("-T is deprecated");
+			bsdar->options |= AR_TR;
+			break;
 		case 't':
 			set_mode(bsdar, opt);
 			break;