Re: git: 3d939d967ad4 - main - build: Use ls -i | cut rather than stat -f %i to extract inode

From: Warner Losh <imp_at_bsdimp.com>
Date: Mon, 15 Jan 2024 02:28:39 UTC
On Sun, Jan 14, 2024 at 7:24 PM Warner Losh <imp@freebsd.org> wrote:

> The branch main has been updated by imp:
>
> URL:
> https://cgit.FreeBSD.org/src/commit/?id=3d939d967ad49f747b8b9db4fdec8086a7067582
>
> commit 3d939d967ad49f747b8b9db4fdec8086a7067582
> Author:     Warner Losh <imp@FreeBSD.org>
> AuthorDate: 2023-05-02 20:51:09 +0000
> Commit:     Warner Losh <imp@FreeBSD.org>
> CommitDate: 2024-01-15 02:23:45 +0000
>
>     build: Use ls -i | cut rather than stat -f %i to extract inode
>
>     ls -i dates back to 5th edition Unix and is more portable than the stat
>     command, though %% is a newer shellism, it works on any shell that
>     FreeBSD builds with.
>
>     Sponsored by:           Netflix
>

Reviewed by: arichardson
Differential Revision: https://reviews.freebsd.org/D43443

Warner

---
>  Makefile.inc1 | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Makefile.inc1 b/Makefile.inc1
> index 34b49ee319ec..8a0073547ed0 100644
> --- a/Makefile.inc1
> +++ b/Makefile.inc1
> @@ -1059,8 +1059,8 @@ _cleanworldtmp: .PHONY
>  .if ${USING_SYSTEM_COMPILER} == "yes"
>  .for cc in cc c++
>         if [ -x ${WORLDTMP}/usr/bin/${cc} ]; then \
> -               inum=$$(stat -f %i ${WORLDTMP}/usr/bin/${cc}); \
> -               find ${WORLDTMP}/usr/bin -inum $${inum} -delete; \
> +               inum=$$(ls -i ${WORLDTMP}/usr/bin/${cc}); \
> +               find ${WORLDTMP}/usr/bin -inum $${inum%% *} -delete; \
>         fi
>  .endfor
>  .endif # ${USING_SYSTEM_COMPILER} == "yes"
>