Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Jul 2023 20:49:48 GMT
From:      Jessica Clarke <jrtc27@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: d1e44bc94494 - main - kmod.mk: Use portable printf '%s' over non-portable echo -n
Message-ID:  <202307112049.36BKnmQD071295@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jrtc27:

URL: https://cgit.FreeBSD.org/src/commit/?id=d1e44bc94494448de196948d698b637b6e1df4bf

commit d1e44bc94494448de196948d698b637b6e1df4bf
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2023-07-11 20:30:06 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2023-07-11 20:30:06 +0000

    kmod.mk: Use portable printf '%s' over non-portable echo -n
    
    Whilst /bin/echo on macOS and Linux implement -n, as do the builtin
    echos in bash and zsh, the builtin echo in dash does not, causing the
    first line of the output to be -n foo rather than just foo, and there to
    be an extra newline in the output and thus blank line, both of which
    result in "Symbol ... is not present in *.kld" warnings appearing in the
    build output (once for -n foo and once for the empty string for each
    module where EXPORT_SYMS is a list of symbols).
    
    MFC after:      1 week
---
 sys/conf/kmod.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk
index a3ff24f0571a..246af5ba1e81 100644
--- a/sys/conf/kmod.mk
+++ b/sys/conf/kmod.mk
@@ -266,7 +266,7 @@ ${FULLPROG}: ${OBJS} ${BLOB_OBJS}
 .if ${EXPORT_SYMS} == NO
 	:> export_syms
 .elif !exists(${.CURDIR}/${EXPORT_SYMS})
-	echo -n "${EXPORT_SYMS:@s@$s${.newline}@}" > export_syms
+	printf '%s' "${EXPORT_SYMS:@s@$s${.newline}@}" > export_syms
 .else
 	grep -v '^#' < ${EXPORT_SYMS} > export_syms
 .endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202307112049.36BKnmQD071295>