Re: [PATCH] Avoid bug in Solaris xpg4/sed as used in submodule

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

 



Ben Walton <bwalton@xxxxxxxxxxxxxxxxxx> writes:

> The sed provided by Solaris in /usr/xpg4/bin has a bug whereby an
> unanchored regex using * for zero or more repetitions sees two
> separate matches fed to the substitution engine in some cases.
>
> This is evidenced by:
>
> $ for sed in /usr/xpg4/bin/sed /usr/bin/sed /opt/csw/gnu/sed; do \
> echo 'ab' | $sed -e 's|[a]*|X|g'; \
> done
> XXbX
> XbX
> XbX
>
> This bug was triggered during a git submodule clone operation as
> exercised in the setup stage of t5526-fetch-submodules when using the
> default SANE_TOOL_PATH for Solaris.  It led to paths such as
> ..../.. being used in the submodule .git gitdir reference.
>
> Using the expression 's|\([^/]*\(/*\)\)|..\2|g' provides the desired

How about using 's|[^/][^/]*|..|g' instead, which should avoid the bug
as well.

Andreas.

-- 
Andreas Schwab, schwab@xxxxxxxxxxxxxx
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]