From 97f576d0a4af0bfb8802cfc6aecc065f6fb6ca82 Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Tue, 22 Jan 2008 07:23:44 +0000 Subject: [PATCH] Make -l always have the SUSv2 meaning of "check links." GNU tar changed -l to match SUSv2 a couple of years ago, so bsdtar no longer needs to pander to this particular GNUism. Thanks to: Debian maintainers MFC after: 7 days --- usr.bin/tar/bsdtar.1 | 25 ++++++++----------------- usr.bin/tar/bsdtar.c | 16 +++------------- 2 files changed, 11 insertions(+), 30 deletions(-) diff --git a/usr.bin/tar/bsdtar.1 b/usr.bin/tar/bsdtar.1 index 3ae5502afb07..92b61a2faa4a 100644 --- a/usr.bin/tar/bsdtar.1 +++ b/usr.bin/tar/bsdtar.1 @@ -232,16 +232,9 @@ All symbolic links will be followed. Normally, symbolic links are archived as such. With this option, the target of the link will be archived instead. .It Fl l -If -.Ev POSIXLY_CORRECT -is specified in the environment, this is a synonym for the +This is a synonym for the .Fl -check-links option. -Otherwise, an error will be displayed. -Users who desire behavior compatible with GNU tar should use -the -.Fl -one-file-system -option instead. .It Fl m (x mode only) Do not extract modification time. @@ -422,11 +415,6 @@ The locale to use. See .Xr environ 7 for more information. -.It Ev POSIXLY_CORRECT -If this environment variable is defined, the -.Fl l -option will be interpreted in accordance with -.St -p1003.1-96 . .It Ev TAPE The default tape device. The @@ -681,13 +669,16 @@ This is a complete re-implementation based on the .Xr libarchive 3 library. .Sh BUGS -POSIX and GNU violently disagree about the meaning of the +This program follows +.St -p1003.1-96 +for the definition of the .Fl l option. -Because of the potential for disaster if someone expects -one behavior and gets the other, the +Note that GNU tar prior to version 1.15 treated .Fl l -option is deliberately broken in this implementation. +as a synonym for the +.Fl -one-file-system +option. .Pp The .Fl C Pa dir diff --git a/usr.bin/tar/bsdtar.c b/usr.bin/tar/bsdtar.c index a8d3c680a6fc..6fb14c6d7c99 100644 --- a/usr.bin/tar/bsdtar.c +++ b/usr.bin/tar/bsdtar.c @@ -391,19 +391,9 @@ main(int argc, char **argv) case 'L': /* BSD convention */ bsdtar->symlink_mode = 'L'; break; - case 'l': /* SUSv2 and GNU conflict badly here */ - if (getenv("POSIXLY_CORRECT") != NULL) { - /* User has asked for POSIX/SUS behavior. */ - bsdtar->option_warn_links = 1; - } else { - fprintf(stderr, -"Error: -l has different behaviors in different tar programs.\n"); - fprintf(stderr, -" For the GNU behavior, use --one-file-system instead.\n"); - fprintf(stderr, -" For the POSIX behavior, use --check-links instead.\n"); - usage(bsdtar); - } + case 'l': /* SUSv2 and GNU tar beginning with 1.16 */ + /* GNU tar 1.13 used -l for --one-file-system */ + bsdtar->option_warn_links = 1; break; case 'm': /* SUSv2 */ bsdtar->extract_flags &= ~ARCHIVE_EXTRACT_TIME;