Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [bug] :P modifier and symlink loops



dana wrote on Thu, 15 May 2025 10:50 +00:00:
> On Wed 14 May 2025, at 09:54, Daniel Shahaf wrote:
>> Thanks, pushed.
>
> this test you added fails on macos (it has the old-style wc where the
> numbers are padded with spaces). no objections to this fix i assume?

No objections.  I do wonder whether «grep -c» is sufficiently
portable, though.  Can we assume the system's grep(1) to have
a -c option conformant to POSIX 2004 [1]?  If not, there's any number
of ways to rewrite the test case using grep, sed, or zsh constructs.

Cheers,

Daniel

[1] <https://pubs.opengroup.org/onlinepubs/7990949875/utilities/grep.html#tag_04_63_10>, first bullet point

>
>
> diff --git a/Test/B13whence.ztst b/Test/B13whence.ztst
> index 5132c2c04..384dcceeb 100644
> --- a/Test/B13whence.ztst
> +++ b/Test/B13whence.ztst
> @@ -33,6 +33,6 @@
>    )
>  1:whence deals with symlink loops gracefully
> 
> - whence -s =sh(:P) | grep '.->' | wc -l
> -0:(workers/53524) whence -s doesn't print arrows for symlink-free paths
> + whence -s =sh(:P) | grep -c '.->'
> +1:(workers/53524) whence -s doesn't print arrows for symlink-free paths
>  >0




Messages sorted by: Reverse Date, Date, Thread, Author