git: f6ed05f12330 - main - vendor/bc: update to upstream commit ca53adf83b7a

From: Stefan Eßer <se_at_FreeBSD.org>
Date: Wed, 22 Jun 2022 13:59:36 UTC
The branch main has been updated by se:

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

commit f6ed05f1233043eb30a7e5a1efcb7247ad2add90
Author:     Stefan Eßer <se@FreeBSD.org>
AuthorDate: 2022-06-22 13:41:40 +0000
Commit:     Stefan Eßer <se@FreeBSD.org>
CommitDate: 2022-06-22 13:56:01 +0000

    vendor/bc: update to upstream commit ca53adf83b7a
    
    The filter_text function in scripts/functions.sh in version 5.3.3 had
    commented out a "rm" command, probably for debugging purposes. This
    caused temporary files to persist in /tmp when the bc program had been
    built.
    
    This commit fixes the build process with no change of the resulting
    artefacts.
    
    (cherry picked from commit 1576f66712876ee8b0fcc8b35fb062e1813b4fc0)
    
    MFC after:      3 days
---
 contrib/bc/scripts/functions.sh | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/contrib/bc/scripts/functions.sh b/contrib/bc/scripts/functions.sh
index 53778ad4d16b..f2c5b0b50eae 100755
--- a/contrib/bc/scripts/functions.sh
+++ b/contrib/bc/scripts/functions.sh
@@ -348,13 +348,13 @@ filter_text() {
 
 	# Set up some local variables.
 	_filter_text_status="$ALL"
-	_filter_text_temp="$_filter_text_out.tmp"
+	_filter_text_last_line=""
 
 	# We need to set IFS, so we store it here for restoration later.
 	_filter_text_ifs="$IFS"
 
 	# Remove the file- that will be generated.
-	rm -rf "$_filter_text_out" "$_filter_text_temp"
+	rm -rf "$_filter_text_out"
 
 	# Here is the magic. This loop reads the template line-by-line, and based on
 	# _filter_text_status, either prints it to the markdown manual or not.
@@ -371,10 +371,10 @@ filter_text() {
 	#
 	# Obviously, the tag itself and its end are not printed to the markdown
 	# manual.
-	while IFS= read -r line; do
+	while IFS= read -r _filter_text_line; do
 
 		# If we have found an end, reset the status.
-		if [ "$line" = "{{ end }}" ]; then
+		if [ "$_filter_text_line" = "{{ end }}" ]; then
 
 			# Some error checking. This helps when editing the templates.
 			if [ "$_filter_text_status" -eq "$ALL" ]; then
@@ -384,7 +384,7 @@ filter_text() {
 			_filter_text_status="$ALL"
 
 		# We have found a tag that allows our build type to use it.
-		elif [ "${line#\{\{* $_filter_text_buildtype *\}\}}" != "$line" ]; then
+		elif [ "${_filter_text_line#\{\{* $_filter_text_buildtype *\}\}}" != "$_filter_text_line" ]; then
 
 			# More error checking. We don't want tags nested.
 			if [ "$_filter_text_status" -ne "$ALL" ]; then
@@ -394,7 +394,7 @@ filter_text() {
 			_filter_text_status="$NOSKIP"
 
 		# We have found a tag that is *not* allowed for our build type.
-		elif [ "${line#\{\{*\}\}}" != "$line" ]; then
+		elif [ "${_filter_text_line#\{\{*\}\}}" != "$_filter_text_line" ]; then
 
 			if [ "$_filter_text_status" -ne "$ALL" ]; then
 				err_exit "start tag nested in start tag" 3
@@ -405,18 +405,15 @@ filter_text() {
 		# This is for normal lines. If we are not skipping, print.
 		else
 			if [ "$_filter_text_status" -ne "$SKIP" ]; then
-				printf '%s\n' "$line" >> "$_filter_text_temp"
+				if [ "$_filter_text_line" != "$_filter_text_last_line" ]; then
+					printf '%s\n' "$_filter_text_line" >> "$_filter_text_out"
+				fi
+				_filter_text_last_line="$_filter_text_line"
 			fi
 		fi
 
 	done < "$_filter_text_in"
 
-	# Remove multiple blank lines.
-	uniq "$_filter_text_temp" "$_filter_text_out"
-
-	# Remove the temp file.
-	#rm -rf "$_filter_text_temp"
-
 	# Reset IFS.
 	IFS="$_filter_text_ifs"
 }