Reproducible: fixes unstable output in dictionaries-common

See #1090981: dictionaries-common: Randomness in emacsen-ispell-dicts.el
(now due to enchant)

This applies the same patch as proposed in the bug report and makes the
output of 'update-dictcommon-aspell' reproducible again.
This commit is contained in:
Roland Clobus 2024-12-22 15:45:40 +01:00
parent 246556b123
commit a99e8c3d97
No known key found for this signature in database
GPG Key ID: 62C57C6AA61495BD
1 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,25 @@
#!/bin/sh
set -e
# update-dictcommon-aspell creates a file with content depending on PERL_HASH_SEED
# A bug report with patch is available at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1090981
# This script duplicates that patch
# Don't run if the file is not present
if [ ! -e /usr/share/perl5/Debian/DictionariesCommon.pm ];
then
exit 0
fi
# If DictionariesCommon.pm already contains a sort statement at line 656, there is no need to patch the file
if sed -e '656p;d' /usr/share/perl5/Debian/DictionariesCommon.pm | grep -q "foreach my \$k (sort keys"
then
exit 0
fi
# Patch the Perl script (at line 656)
sed -i -e '656s/keys/sort keys/' /usr/share/perl5/Debian/DictionariesCommon.pm
update-dictcommon-aspell
echo "P: $(basename $0) Reproducible hook has been applied"