From 2ceded19c4852a64a704d87460ac1a2f5c77c1a8 Mon Sep 17 00:00:00 2001 From: ne20002 Date: Thu, 6 Feb 2025 17:53:09 +0000 Subject: [PATCH 1/2] Followup to #14790 - revert to /bin/bash for run_xgettext.sh --- bin/run_xgettext.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/run_xgettext.sh b/bin/run_xgettext.sh index b947b43a35..85f5004235 100755 --- a/bin/run_xgettext.sh +++ b/bin/run_xgettext.sh @@ -1,10 +1,10 @@ -#!/bin/sh +#!/bin/bash # SPDX-FileCopyrightText: 2010 - 2024 the Friendica project # # SPDX-License-Identifier: CC0-1.0 -set -eo pipefail +set -e -o pipefail resolve() { if [ "$(uname)" = "Darwin" ] From 6cd92da46c8b7eaa3a9c724fe3cda2e22fd227ca Mon Sep 17 00:00:00 2001 From: ne20002 Date: Thu, 6 Feb 2025 18:18:11 +0000 Subject: [PATCH 2/2] Fix for PR #14790 --- bin/run_xgettext.sh | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/bin/run_xgettext.sh b/bin/run_xgettext.sh index 85f5004235..ec5cb955d0 100755 --- a/bin/run_xgettext.sh +++ b/bin/run_xgettext.sh @@ -1,10 +1,17 @@ -#!/bin/bash +#!/bin/sh # SPDX-FileCopyrightText: 2010 - 2024 the Friendica project # # SPDX-License-Identifier: CC0-1.0 -set -e -o pipefail +set -e + +# Custom function to handle pipefail behavior +pipefail() { + local cmd="$1" + shift + { eval "$cmd"; } || exit 1 +} resolve() { if [ "$(uname)" = "Darwin" ] @@ -78,13 +85,13 @@ echo "Extract strings to $OUTFILE.." # shellcheck disable=SC2086 # $FINDOPTS is meant to be split find_result=$(find "$FINDSTARTDIR" $FINDOPTS -name "*.php" -type f | LC_ALL=C sort -s) -total_files=$(wc -l <<< "${find_result}") +total_files=$(echo "${find_result}" | wc -l) count=1 for file in $find_result do - echo -ne " \r" - echo -ne "Reading file $count/$total_files..." + printf " \r" + printf "Reading file %d/%d..." "$count" "$total_files" # On Windows, find still outputs the name of pruned folders if [ ! -d "$file" ] @@ -93,9 +100,8 @@ do xgettext $KEYWORDS --no-wrap -j -o "$OUTFILE" --from-code=UTF-8 "$file" || exit 1 sed -i.bkp "s/CHARSET/UTF-8/g" "$OUTFILE" fi - (( count++ )) + count=$((count + 1)) done -echo -ne "\n" echo "Interpolate metadata.."