Your patch looks better than mine :)
Please consider post this patch to busybox as well.
Their ash has same code and same issue.
See http://lists.busybox.net/pipermail/busybox/2017-May/085459.html
On Fri, May 26, 2017 at 3:59 PM, Harald van Dijk wrote:
> Hi,
>
> On 26/05/17
Hi,
On 26/05/17 09:04, Youfu Zhang wrote:
$ PATH=/extra/path:/usr/sbin:/usr/bin:/sbin:/bin \
sh -xc 'command -V ls; command -V ls; command -Vp ls; command -vp ls'
+ command -V ls
ls is /bin/ls
+ command -V ls
ls is a tracked alias for /bin/ls
+ command -Vp ls
ls is a tracked alias for (null)
$ PATH=/extra/path:/usr/sbin:/usr/bin:/sbin:/bin \
> sh -xc 'command -V ls; command -V ls; command -Vp ls; command -vp ls'
+ command -V ls
ls is /bin/ls
+ command -V ls
ls is a tracked alias for /bin/ls
+ command -Vp ls
ls is a tracked alias for (null)
+ command -vp ls
Segmentation fault (core