From fda0ec862a34094cf23fc25d0e0a95858c3a3ab5 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Mon, 27 May 2024 17:41:37 +0300 Subject: [PATCH] license-check.sh: Use xargs -0 instead of -d Neither are in POSIX but -0 is much more portable in practice. Despite the old comment, the grep usage should be portable already. --- build-aux/license-check.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/build-aux/license-check.sh b/build-aux/license-check.sh index f352e1c8..ce1f60c5 100644 --- a/build-aux/license-check.sh +++ b/build-aux/license-check.sh @@ -11,7 +11,7 @@ # when .git isn't available, from files extracted from a release tarball # (in case of a release tarball, the tree must be clean of any extra files). # -# NOTE: This uses grep and xargs with options that aren't in POSIX. +# NOTE: This relies on non-POSIX xargs -0. It's supported on GNU and *BSDs. # ############################################################################### # @@ -99,11 +99,12 @@ FILES=$(printf '%s\n' "$FILES" | sort) # Find the tagged files. -TAGGED=$(printf '%s\n' "$FILES" | xargs -r -d '\n' grep -l "$SPDX_LI") +TAGGED=$(printf '%s\n' "$FILES" \ + | tr '\n' '\000' | xargs -0r grep -l "$SPDX_LI") # Find the tagged 0BSD files. TAGGED_0BSD=$(printf '%s\n' "$TAGGED" \ - | xargs -r -d '\n' grep -l "$SPDX_LI 0BSD") + | tr '\n' '\000' | xargs -0r grep -l "$SPDX_LI 0BSD") # Find the tagged non-0BSD files, that is, remove the 0BSD-tagged files # from the list of tagged files. @@ -125,8 +126,8 @@ FILES=$(printf '%s\n' "$FILES" | grep -Ev \ # FIXME: Allow untagged translations if they have a public domain notice. # These are old translations that haven't been updated after 2024-02-14. # Eventually these should go away. -PD_PO=$(printf '%s\n' "$FILES" | grep '\.po$' | \ - xargs -r -d '\n' grep -Fl '# This file is put in the public domain.') +PD_PO=$(printf '%s\n' "$FILES" | grep '\.po$' | tr '\n' '\000' \ + | xargs -0r grep -Fl '# This file is put in the public domain.') if test -n "$PD_PO"; then # Remove the public domain .po files from the list.