From 3fe8403ac73e2d67e3444d9c52b7fd91b173fcdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20L=C3=BCke?= Date: Wed, 10 Jun 2020 17:33:03 +0200 Subject: [PATCH] Filter out unicode characters in package content list For some unicode characters in ca-certificates file names "rev" complains about an "invalid or incomplete multibyte or wide character" and gives no output. Filter out any unexpected characters for "rev" and replace them with "?" so that "ls some?name" will still resolve the original name. --- build_library/build_image_util.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build_library/build_image_util.sh b/build_library/build_image_util.sh index 2c4ac38d45..45e82494a8 100755 --- a/build_library/build_image_util.sh +++ b/build_library/build_image_util.sh @@ -399,8 +399,10 @@ write_licenses() { local description="$(get_metadata "$1" "${pkg}" DESCRIPTION)" local src_uri="$(get_metadata "$1" "${pkg}" SRC_URI)" # Filter out directories, cut type marker, cut timestamp, quote "\", and convert line breaks to "\n" + # Filter any unicode characters "rev" doesn't handle (currently some ca-certificates files) and + # replace them with a "?" so that the files can still be opened thanks to shell file name expansion local files="$(get_metadata "$1" "${pkg}" CONTENTS | grep -v '^dir ' | \ - cut -d ' ' -f 2- | rev | cut -d ' ' -f 2- | rev | \ + cut -d ' ' -f 2- | tr -c '[[:print:][:cntrl:]]' '?' | rev | cut -d ' ' -f 2- | rev | \ sed 's#\\#\\\\#g' | tr '\n' '*' | sed 's/*/\\n/g')" echo -n " {\"project\": \"${pkg}\", \"licenses\": ["