I am finding myself in agreement.

Have we decided who will die on the hill?

Ingo Schwarze <schwa...@usta.de> wrote:

> Not a bug.
> But which one is preferable, test -L or test -h?
> 
> TLDR:
> If you follow David Korn, -L is the way to go.
> If you feel nostalgic about old SunOS, -h looks nicer.
> Both were standardized in POSIX Issue 6 (2001), with no preference given 
> there.
> Both always worked on OpenBSD, no matter which base system shell was used.
> In the OpenBSD ancestry, there was no difference in portability
> except between June 1993 and June 1995 (at most).
> 
> I admit that usually, when there are two equivalent syntaxes, deprecating
> one of them makes sense.  But in this case, with POSIX setting both in
> stone over 20 years ago, attempting to die on that particular molehill
> seems pointless to me.
> 
> Hence i suggest the patch below; OK?
> 
> More complete history follows after the patch (just for the curious :-).
> This does not contradict what jmc@ wrote, but contains more information.
> 
> Yours,
>   Ingo
> 
> 
> Index: test.1
> ===================================================================
> RCS file: /cvs/src/bin/test/test.1,v
> diff -u -p -r1.34 test.1
> --- test.1    10 Jun 2023 07:19:39 -0000      1.34
> +++ test.1    17 Jun 2024 21:22:30 -0000
> @@ -110,6 +110,8 @@ is set.
>  True if
>  .Ar file
>  exists and is a symbolic link.
> +Identical to
> +.Fl L .
>  .It Fl k Ar file
>  True if
>  .Ar file
> @@ -118,11 +120,8 @@ exists and its sticky bit is set.
>  True if
>  .Ar file
>  exists and is a symbolic link.
> -This operator is for compatibility purposes.
> -Do not rely on its existence;
> -use
> -.Fl h
> -instead.
> +Identical to
> +.Fl h .
>  .It Fl n Ar string
>  True if the length of
>  .Ar string
> Index: test.c
> ===================================================================
> RCS file: /cvs/src/bin/test/test.c,v
> diff -u -p -r1.20 test.c
> --- test.c    11 Oct 2022 13:40:38 -0000      1.20
> +++ test.c    17 Jun 2024 21:22:31 -0000
> @@ -110,7 +110,7 @@ struct t_op {
>       {"-t",  FILTT,  UNOP},
>       {"-z",  STREZ,  UNOP},
>       {"-n",  STRNZ,  UNOP},
> -     {"-h",  FILSYM, UNOP},          /* for backwards compat */
> +     {"-h",  FILSYM, UNOP},
>       {"-O",  FILUID, UNOP},
>       {"-G",  FILGID, UNOP},
>       {"-L",  FILSYM, UNOP},
> 
> 
>  ----- 8< ----- schnipp ----- >8 ----- 8< ----- schnapp ----- >8 -----
> 
> History in OpenBSD ancestry:
> 
> OpenBSD:
> ksh(1) had both since the beginning, Aug 14, 1996 (pdksh 5.2.7).
> Before that, /bin/sh, which was ash, did not have a "test" builtin
> at all but used /bin/test instead, which also had both.
> csh(1) never had a "test" builtin.
> 
> NetBSD:
> /bin/test has -h since Feb 19, 1994 ("a la SunOS")
>               -L since Jun 30, 1994 ("from pdksh")
> 
> 4.4 BSD (June 1993) and 4.4BSD-Lite2 (June 1995):
> /bin/sh (ash) did not have a "test" builtin but used /bin/test instead.
> /bin/test had -h but not -L.
> 
> Version 7 AT&T UNIX (1979) and 4.3BSD-Reno (June 1990):
> /bin/sh (Bourne) did not have a "test" builtin but used /bin/test instead.
> /bin/test had neither -h nor -L.
> 

Reply via email to