Re: [PATCH v2] bltin/test: align -nt and -ot with POSIX.1-2024

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jul 28, 2024 at 04:42:52AM +0200, наб wrote:
> 117027  pathname1 −nt pathname2
> 117028    True if pathname1 resolves to an existing file and pathname2 cannot be resolved, or if
> 117029    both resolve to existing files and pathname1 is newer than pathname2 according to
> 117030    their last data modification timestamps; otherwise, false.
> 117031  pathname1 −ot pathname2
> 117032    True if pathname2 resolves to an existing file and pathname1 cannot be resolved, or if
> 117033    both resolve to existing files and pathname1 is older than pathname2 according to
> 117034    their last data modification timestamps; otherwise, false.
> 
> The correct output is
>   $ [ 2024 -nt 2023 ] && echo yes
>   yes
>   $ [ 2023 -nt 2024 ] && echo yes
>   $ [ 2023 -nt ENOENT ] && echo yes
>   yes
>   $ [ ENOENT -nt 2024 ] && echo yes
> and
>   $ [ 2024 -ot 2023 ] && echo yes
>   $ [ 2023 -ot 2024 ] && echo yes
>   yes
>   $ [ 2023 -ot ENOENT ] && echo yes
>   $ [ ENOENT -ot 2024 ] && echo yes
>   yes
> but dash currently returned only the first yes out of both blocks.
> ---
>  src/bltin/test.c | 31 +++++++++++++++++--------------
>  src/dash.1       | 14 ++++++++++++--
>  2 files changed, 29 insertions(+), 16 deletions(-)

Patch applied with newerf/olderf changed to return bool, header
sorting and some reformatting of the time comparisons.

Thanks,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux