bash: add locale alias for ja_JP shiftjis in run-ptest
PATCH 1/2 bash: add locale alias for ja_JP shiftjis in run-ptest
From: Xiangyu Chen <[email protected]>
Bash has a test case that needs ja_JP shift jis locale.
It will check current system has ja_JP.SJIS locale or not, but in yocto, this locale named ja_JP.shiftjis, they are the same.
So create a locale alias, making ja_JP.SJIS link to ja_JP.shiftjis.
Also add warning message if current system doesn't contain shift jis locale.
--- meta/recipes-extended/bash/bash/run-ptest | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
meta/recipes-extended/bash/bash/run-ptest +21 -0
@@ -3,6 +3,7 @@ en_US=`locale -a | grep en_US*` fr_FR=`locale -a | grep fr_FR*` de_DE=`locale -a | grep de_DE*` +ja_JP_SJIS=`locale -a | grep ja_JP.shiftjis` if [ -z "$en_US" ] then
@@ -19,8 +20,28 @@ then echo "Warning: The de_DE* locales is needed to run the intl.tests, please add it." fi +if [ -z "$ja_JP_SJIS" ] +then + echo "Warning: The ja_JP.shiftjis locales is needed to run the intl.tests, please add it." +else +# Yocto generated shiftjis locale named ja_JP.shiftjis, but bash's test script using ja_JP.SJIS +# They are the same one, so add an alias in locale.alias + if [ -f /usr/share/locale/locale.alias ] + then + cp /usr/share/locale/locale.alias /usr/share/locale/locale.alias.bak + fi + + echo "ja_JP.SJIS ja_JP.shiftjis" >> /usr/share/locale/locale.alias +fi + + useradd bashtest chown -R bashtest:bashtest tests setpriv --reuid bashtest --rgid bashtest --clear-groups --reset-env $(dirname "$0")/run-bash-ptests chown -R root:root tests userdel -r bashtest + +if [ -f /usr/share/locale/locale.alias.bak ] +then + mv /usr/share/locale/locale.alias.bak /usr/share/locale/locale.alias +fi
Signature · 1 line
2.34.1
PATCH 2/2 bash: fix test case array.tests failure
From: Xiangyu Chen <[email protected]>
GNU grep started to output error messages in v3.8 (see below) for egrep, those error messages also records in test log, that cause test case failure in diff stage.
error message from egrep:
egrep: warning: egrep is obsolescent; using grep -E
The bug and a patch has been sent to bash bug-report maillist[1], and got an ack from maintainer, but not merged/fixed on bash master repository yet.
Ref:
[1] https://lists.gnu.org/archive/html/bug-bash/2024-02/msg00154.html
--- ...ests-using-grep-v-e-instead-of-egrep.patch | 100 ++++++++++++++++++ meta/recipes-extended/bash/bash_5.2.21.bb | 1 + 2 files changed, 101 insertions(+) create mode 100644 meta/recipes-extended/bash/bash/0001-tests-array.tests-using-grep-v-e-instead-of-egrep.patch
meta/recipes-extended/bash/bash/0001-tests-array.tests-using-grep-v-e-instead-of-egrep.patch new file +100 -0
@@ -0,0 +1,100 @@ +From 423c45a41f044e06857a5a893187e65d46d8ad53 Mon Sep 17 00:00:00 2001 +From: Xiangyu Chen <[email protected]> +Date: Tue, 20 Feb 2024 02:54:55 +0000 +Subject: [PATCH] tests/array.tests: using grep -v -e instead of egrep + +The console ouput lots of egrep warning message, those message causes test case fail in diff stage. +According the message, using grep -v -e instead of egrep. + +Warning message: +--------------- +9d8 +< egrep: warning: egrep is obsolescent; using grep -E +31d29 +< egrep: warning: egrep is obsolescent; using grep -E +34d31 +< egrep: warning: egrep is obsolescent; using grep -E +37d33 +< egrep: warning: egrep is obsolescent; using grep -E +41d36 +< egrep: warning: egrep is obsolescent; using grep -E +65d59 +< egrep: warning: egrep is obsolescent; using grep -E +84d77 +< egrep: warning: egrep is obsolescent; using grep -E +--------------- + +Upstream-Status: Submitted [https://lists.gnu.org/archive/html/bug-bash/2024-02/msg00154.html] + +Signed-off-by: Xiangyu Chen <[email protected]> +--- + tests/array.tests | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/tests/array.tests b/tests/array.tests +index d0bb08b..07452ec 100644 +--- a/tests/array.tests ++++ b/tests/array.tests +@@ -16,7 +16,7 @@ + set +o posix + + set +a +-# The calls to egrep -v are to filter out builtin array variables that are ++# The calls to grep -v -e are to filter out builtin array variables that are + # automatically set and possibly contain values that vary. + + # first make sure we handle the basics +@@ -61,7 +61,7 @@ echo ${a[@]} + echo ${a[*]} + + # this should print out values, too +-declare -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)' ++declare -a | grep -v -e BASH_VERSINFO -e PIPESTATUS -e GROUPS + + unset a[7] + echo ${a[*]} +@@ -92,11 +92,11 @@ echo ${a[@]} + readonly a[5] + readonly a + # these two lines should output `declare' commands +-readonly -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)' +-declare -ar | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)' ++readonly -a | grep -v -e BASH_VERSINFO -e PIPESTATUS -e GROUPS ++declare -ar | grep -v -e BASH_VERSINFO -e PIPESTATUS -e GROUPS + # this line should output `readonly' commands, even for arrays + set -o posix +-readonly -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)' ++readonly -a | grep -v -e BASH_VERSINFO -e PIPESTATUS -e GROUPS + set +o posix + + declare -a d='([1]="" [2]="bdef" [5]="hello world" "test")' +@@ -111,7 +111,7 @@ b=([0]=this [1]=is [2]=a [3]=test [4]="$PS1" [5]=$pass) + + echo ${b[@]:2:3} + +-declare -pa | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)' ++declare -pa | grep -v -e BASH_VERSINFO -e PIPESTATUS -e GROUPS + + a[3]="this is a test" + +@@ -129,7 +129,7 @@ d=([]=abcde [1]="test test" [*]=last [-65]=negative ) + unset d[12] + unset e[*] + +-declare -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)' ++declare -a | grep -v -e BASH_VERSINFO -e PIPESTATUS -e GROUPS + + ps1='hello' + unset ps1[2] +@@ -155,7 +155,7 @@ echo ${vv[0]} ${vv[3]} + echo ${vv[@]} + unset vv + +-declare -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)' ++declare -a | grep -v -e BASH_VERSINFO -e PIPESTATUS -e GROUPS + + export rv + #set +-- +2.35.5 +
meta/recipes-extended/bash/bash_5.2.21.bb +1 -0
@@ -13,6 +13,7 @@ SRC_URI = "${GNU_MIRROR}/bash/${BP}.tar.gz;name=tarball \ file://fix-run-builtins.patch \ file://use_aclocal.patch \ file://0001-changes-to-SIGINT-handler-while-waiting-for-a-child-.patch \ + file://0001-tests-array.tests-using-grep-v-e-instead-of-egrep.patch \ " SRC_URI[tarball.sha256sum] = "c8e31bdc59b69aaffc5b36509905ba3e5cbb12747091d27b4b977f078560d5b8"
Signature · 1 line
2.34.1
Wait. Why is the correct locale not generated? How do other systems do it? There's an issue elsewhere, possibly in glibc-locale, and this works around that, instead of fixing the original problem.
Alex
Quoted 69 lines · Xiangyu Chen
From: Xiangyu Chen <[email protected]>
Bash has a test case that needs
ja_JPshift jis locale.It will check current system has ja_JP.SJIS locale or not, but in yocto, this locale named ja_JP.shiftjis, they are the same.
So create a locale alias, making ja_JP.SJIS link to ja_JP.shiftjis.Also add warning message if current system doesn't contain shift jis locale.
Signed-off-by Xiangyu Chen <[email protected]>--- meta/recipes-extended/bash/bash/run-ptest | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)meta/recipes-extended/bash/bash/run-ptest +21
-1@@ -3,6 +3,7 @@ en_US=`locale -a | grep en_US*` fr_FR=`locale -a | grep fr_FR*` de_DE=`locale -a | grep de_DE*` +ja_JP_SJIS=`locale -a | grep ja_JP.shiftjis` if [ -z "$en_US" ] then@@ -19,8 +20,28 @@ then echo "Warning: The de_DE* locales is needed to run the intl.tests, please add it." fi +if [ -z "$ja_JP_SJIS" ] +then + echo "Warning: The ja_JP.shiftjis locales is needed to run the intl.tests, please add it." +else +# Yocto generated shiftjis locale named ja_JP.shiftjis, but bash's test script using ja_JP.SJIS +# They are the same one, so add an alias in locale.alias + if [ -f /usr/share/locale/locale.alias ] + then + cp /usr/share/locale/locale.alias /usr/share/locale/locale.alias.bak + fi + + echo "ja_JP.SJIS ja_JP.shiftjis" >> /usr/share/locale/locale.alias +fi + + useradd bashtest chown -R bashtest:bashtest tests setpriv --reuid bashtest --rgid bashtest --clear-groups --reset-env $(dirname "$0")/run-bash-ptests chown -R root:root tests userdel -r bashtest + +if [ -f /usr/share/locale/locale.alias.bak ] +then + mv /usr/share/locale/locale.alias.bak /usr/share/locale/locale.alias +fi --2.34.1
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#196244): https://lists.openembedded.org/g/openembedded-core/message/196244
Mute This Topic: https://lists.openembedded.org/mt/104599698/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 6 lines · Alexander Kanavin
CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.Wait. Why is the correct locale not generated? How do other systems do it? There's an issue elsewhere, possibly in glibc-locale, and this works around that, instead of fixing the original problem.
Hi Alex,
Since SHIFTJIS is not a ISO2022/posix compliant and not in the list of glibc locale data support, it was generated by manual with localedef and don't have a unified name.
The following name has been already found on different linux:
ja_JP.SJIS ja_JP.SHIFT_JIS ja_JP.shiftjis japanese.sjis
Br,
Xiangyu
Quoted 73 lines
Alex
Quoted 68 lines · Xiangyu Chen
From: Xiangyu Chen <[email protected]>
Bash has a test case that needs
ja_JPshift jis locale.It will check current system has ja_JP.SJIS locale or not, but in yocto, this locale named ja_JP.shiftjis, they are the same.
So create a locale alias, making ja_JP.SJIS link to ja_JP.shiftjis.Also add warning message if current system doesn't contain shift jis locale.
Signed-off-by Xiangyu Chen <[email protected]>--- meta/recipes-extended/bash/bash/run-ptest | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)meta/recipes-extended/bash/bash/run-ptest +21
-1@@ -3,6 +3,7 @@ en_US=`locale -a | grep en_US*` fr_FR=`locale -a | grep fr_FR*` de_DE=`locale -a | grep de_DE*` +ja_JP_SJIS=`locale -a | grep ja_JP.shiftjis` if [ -z "$en_US" ] then@@ -19,8 +20,28 @@ then echo "Warning: The de_DE* locales is needed to run the intl.tests, please add it." fi +if [ -z "$ja_JP_SJIS" ] +then + echo "Warning: The ja_JP.shiftjis locales is needed to run the intl.tests, please add it." +else +# Yocto generated shiftjis locale named ja_JP.shiftjis, but bash's test script using ja_JP.SJIS +# They are the same one, so add an alias in locale.alias + if [ -f /usr/share/locale/locale.alias ] + then + cp /usr/share/locale/locale.alias /usr/share/locale/locale.alias.bak + fi + + echo "ja_JP.SJIS ja_JP.shiftjis" >> /usr/share/locale/locale.alias +fi + + useradd bashtest chown -R bashtest:bashtest tests setpriv --reuid bashtest --rgid bashtest --clear-groups --reset-env $(dirname "$0")/run-bash-ptests chown -R root:root tests userdel -r bashtest + +if [ -f /usr/share/locale/locale.alias.bak ] +then + mv /usr/share/locale/locale.alias.bak /usr/share/locale/locale.alias +fi --2.34.1
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#196244): https://lists.openembedded.org/g/openembedded-core/message/196244
Mute This Topic: https://lists.openembedded.org/mt/104599698/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 8 lines · Xiangyu Chen
Since SHIFTJIS is not a ISO2022/posix compliant and not in the list of glibc locale data support, it was generated by manual with localedef and don't have a unified name.
The following name has been already found on different linux:
ja_JP.SJIS ja_JP.SHIFT_JIS ja_JP.shiftjis japanese.sjis
Hello Chen,
I need to note that we specifically exclude bash from ptests, and this is the reason:
https://git.yoctoproject.org/poky/commit/?id=2758f6d0337ec84c9143546bc65a80559e8d7808
As a result, bash ptest would keep regressing in various ways, simply because it's not executed, and I would suggest that you either first fix these failures, so we can restore bash in meta/conf/distro/include/ptests-packagelists.inc, or drop bash from your own testing. Is there a particular reason you need to run those tests?
Alex
Quoted 10 lines · Alexander Kanavin
CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.Quoted 5 lines · Xiangyu Chen
Since SHIFTJIS is not a ISO2022/posix compliant and not in the list of glibc locale data support, it was generated by manual with localedef and don't have a unified name.
Quoted 8 lines
Quoted 3 lines
The following name has been already found on different linux:
ja_JP.SJIS ja_JP.SHIFT_JIS ja_JP.shiftjis japanese.sjis
Hello Chen,
I need to note that we specifically exclude bash from ptests, and this is the reason:
https://git.yoctoproject.org/poky/commit/?id=2758f6d0337ec84c9143546bc65a80559e8d7808
Hi Alex,
Quoted 7 lines
As a result, bash ptest would keep regressing in various ways, simply because it's not executed, and I would suggest that you either first fix these failures, so we can restore bash in meta/conf/distro/include/ptests-packagelists.inc, or drop bash from your own testing. Is there a particular reason you need to run those tests?
Thanks for your information, recently I am trying to fix the bash ptest failures.
Currently, in my local setup with master oe, the test failure is 5(total 83). The failed cases are run-intl run-type run-array run-execscript run-read.
After checking the failure log, the following is a simple of failure cases analysis:
1) run-array: egrep output warning messages cause the final log is different from pre-log. A patch has been sent to bash bug-report list to use
grep -v -e instead of egrep[1].
2) run-type: there is a patch need to rebase, fix has been merged to oe-core master[2]
3) run-execscript: it reports the failure but not really failed, it just differing only in line numbers is produced.
4) run-intl: due to no shiftjis locale in system, some of unicode tests were skipped. That cause actually run 1251 cases mismatch with total 1378 cases.
5) run-read failure cannot 100% reproduce, when it failed, a character was missing in test log, still in debugging..
And also i met a problem, most of cases are comparing test log with pre-test log from maintainer as the test result that line number/space/path/new line is produced causes diff failed,
but in fact they are not a real test failure, the result still need to verify by manual, seems cannot do the automation test, any suggestion on that?
Thanks,
Ref:
[1] https://lists.gnu.org/archive/html/bug-bash/2024-02/msg00154.html
[2] https://git.openembedded.org/openembedded-core/commit/?id=ecb698ca5b4f76937dd3bee927465b17866d50be
Br,
Xiangyu
Quoted 2 lines
Alex
Quoted 7 lines · Xiangyu Chen
And also i met a problem, most of cases are comparing test log with pre-test log from maintainer as the test result that line number/space/path/new line is produced causes diff failed,
but in fact they are not a real test failure, the result still need to verify by manual, seems cannot do the automation test, any suggestion on that?
All of this seems to indicate that the bash test suite is not meant for independent execution, and is only intended for bash maintainers. Perhaps you should clarify this with them first, and then also point out specific problems you are facing. Basically, engage with bash upstream, and see if they're interested in helping you to improve tests to the point where we can re-enable them. If there's no such interest, we shouldn't have to continuously add fixes and workarounds.
Whether the whole effort is worth your time is a question I leave for you to answer :)
Alex
Quoted 21 lines · Alexander Kanavin
CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.Quoted 7 lines · Xiangyu Chen
And also i met a problem, most of cases are comparing test log with pre-test log from maintainer as the test result that line number/space/path/new line is produced causes diff failed,
but in fact they are not a real test failure, the result still need to verify by manual, seems cannot do the automation test, any suggestion on that?
All of this seems to indicate that the bash test suite is not meant for independent execution, and is only intended for bash maintainers. Perhaps you should clarify this with them first, and then also point out specific problems you are facing. Basically, engage with bash upstream, and see if they're interested in helping you to improve tests to the point where we can re-enable them. If there's no such interest, we shouldn't have to continuously add fixes and workarounds.
Quoted 2 lines
Whether the whole effort is worth your time is a question I leave for you to answer :)
Aha, thanks for your information :)
Yes, from the result, it seems only intended for bash maintainers and not fit for other automation yet.
I think firstly i need to check the history of bash maillist to see whether others sent this topic and the result of discussion on that.
Thanks :D
Br,
Xiangyu
Quoted 2 lines
Alex
Hi Chen,
It does not seem to be the main issue, but here is an other strange thing I noticed in the locale.alias file. Indeed, the file (provided by the glibc-locale-alias package) in my environment already contains this line:
japanese.sjis ja_JP.SJIS
I understand that ja_JP.SJIS is expected to be the "real" locale name. However, your patch sets it as an alias for ja_JP.shiftjis.
Regards,
Jonathan
Quoted 58 lines · Xiangyu Chen
Quoted 2 lines · Alexander Kanavin
CAUTION: This email comes from a non Wind River email account! Do not click links or open attachments unless you recognize the sender
and know the content is safe.
Quoted 19 lines
Quoted 7 lines · Xiangyu Chen
And also i met a problem, most of cases are comparing test log with pre-test log from maintainer as the test result that line number/space/path/new line is produced causes diff failed,
but in fact they are not a real test failure, the result still need to verify by manual, seems cannot do the automation test, any suggestion on that?
All of this seems to indicate that the bash test suite is not meant for independent execution, and is only intended for bash maintainers. Perhaps you should clarify this with them first, and then also point out specific problems you are facing. Basically, engage with bash upstream, and see if they're interested in helping you to improve tests to the point where we can re-enable them. If there's no such interest, we shouldn't have to continuously add fixes and workarounds.
Quoted 2 lines
Whether the whole effort is worth your time is a question I leave for you to answer :)
Aha, thanks for your information :)
Yes, from the result, it seems only intended for bash maintainers and not fit for other automation yet.
I think firstly i need to check the history of bash maillist to see whether others sent this topic and the result of discussion on that.
Thanks :D
Br,
Xiangyu
Quoted 2 lines
Alex
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#196427):
https://lists.openembedded.org/g/openembedded-core/message/196427
Mute This Topic: https://lists.openembedded.org/mt/104599698/8060005
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-