c-koi/gmic-qt

Translations, fails to build

JeanLucCoulon opened this issue · 4 comments

Hi,
When I try to build gmic-qt, I got the following error:
make -C translations
make[1]: Entering directory '/usr/local/src/gmic/gmic-3.2.0/gmic-qt/translations'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/usr/local/src/gmic/gmic-3.2.0/gmic-qt/translations'
make -C translations/filters
make[1]: Entering directory '/usr/local/src/gmic/gmic-3.2.0/gmic-qt/translations/filters'
lrelease error: Parse error at fr.ts:43:18: Expected '>' or '/', but got ';'.
make[1]: *** [Makefile:10: fr.qm] Error 1
make[1]: Leaving directory '/usr/local/src/gmic/gmic-3.2.0/gmic-qt/translations/filters'
make: *** [Makefile:1059: qm_filter_files] Error 2

The offending line in fr.ts in translations/filters is:

<lt;b>gt;Faves<lt;/b>gt; <------------------ this one
<lt;b>gt;Favoris<lt;/b>gt;

But any line with the same construction (in any language) leads to the same problem.

This applies to the git version (commit fc0de38).
I run debian sid GNU/LInux

Regards

Jean-Luc

c-koi commented

Did you modify the file translations/filters/gmic_qt_fr.csv? If so, could you post it somewhere...

Nono, I got it directly from the git repository, together with the whole package.

We're hitting a change in how Bash expands & as a back-reference to the search pattern.

https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html :

"If the patsub_replacement shell option is enabled using shopt, any unquoted instances of ‘&’ in string are replaced with the matching portion of pattern."

This was added in Bash 5.2 and apparently is enabled by default, breaking this type of scripts. The fix is to simply backslash-quote the ampersand:

diff -ur gmic-qt-v.3.1.6.orig/translations/filters/csv2ts.sh gmic-qt-v.3.1.6/translations/filters/csv2ts.sh
--- gmic-qt-v.3.1.6.orig/translations/filters/csv2ts.sh	2022-08-16 11:18:26.000000000 +0200
+++ gmic-qt-v.3.1.6/translations/filters/csv2ts.sh	2022-12-07 17:43:18.568998678 +0100
@@ -65,11 +65,11 @@
 {
   local name="$1"
   local text="$2"
-  text=${text//&/&amp;}
-  text=${text//\"/&quot;}
-  text=${text//\'/&apos;}
-  text=${text//</&lt;}
-  text=${text//>/&gt;}
+  text=${text//&/\&amp;}
+  text=${text//\"/\&quot;}
+  text=${text//\'/\&apos;}
+  text=${text//</\&lt;}
+  text=${text//>/\&gt;}
   text=${text# }
   echo "      <${name}>${text}</$name>"
 }
diff -ur gmic-qt-v.3.1.6.orig/translations/filters/ts2csv.sh gmic-qt-v.3.1.6/translations/filters/ts2csv.sh
--- gmic-qt-v.3.1.6.orig/translations/filters/ts2csv.sh	2022-08-16 11:18:26.000000000 +0200
+++ gmic-qt-v.3.1.6/translations/filters/ts2csv.sh	2022-12-07 17:43:46.858730280 +0100
@@ -44,7 +44,7 @@
 function html2ascii()
 {
   local text="$1"
-  text=${text//&amp;/&}
+  text=${text//&amp;/\&}
   text=${text//&lt;/<}
   text=${text//&gt;/>}
   text=${text//&quot;/\"}
c-koi commented

Thanks @stefantalpalaru !
Fix applied as ccb9f29