Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 412867 - app-shells/bash-4.2_p24: pattern substitution fails with extglob option and UTF-8 locale (was: app-admin/eselect-1.3.1: bug in apply_text_highlights function)
Summary: app-shells/bash-4.2_p24: pattern substitution fails with extglob option and U...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal major (vote)
Assignee: Gentoo's Team for Core System packages
URL: http://lists.gnu.org/archive/html/bug...
Whiteboard:
Keywords: REGRESSION
Depends on:
Blocks:
 
Reported: 2012-04-21 07:26 UTC by Vadim A. Misbakh-Soloviov (mva)
Modified: 2012-04-23 04:24 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vadim A. Misbakh-Soloviov (mva) gentoo-dev 2012-04-21 07:26:55 UTC
I've tried to add localized news to my overlay and found a bug in news title highlighting in cases when it is UTF-8 in title.
Example of bug appearance:
% echo ${LC_ALL}
ru_RU.UTF-8
% echo ${LANG}
ru_RU.UTF-8
% head -n1 2012-04-21-remaking-of-zen-sources.ru.txt
Title: Обновление ебилда на ZEN
% eselect news read 8 | head -n2
2012-04-21-remaking-of-zen-sources
  Title                     %%%HI%%%Обновление ебилда на ZEN%%%RE%%%
% export LC_ALL=C
% head -n1 2012-04-21-remaking-of-zen-sources.en.txt
Title: Remaking of ZEN-sources ebuild
% eselect news read 8 | head -n2
2012-04-21-remaking-of-zen-sources
  Title                     Remaking of ZEN-sources ebuild

Also, I tried to find the bug and I think, that bug is in bash's replacing in apply_text_highlights funtion in /usr/share/eselect/lib/soutput.bash when it replace text in "text" variable.


Reproducible: Always
Comment 1 Vadim A. Misbakh-Soloviov (mva) gentoo-dev 2012-04-21 07:34:12 UTC
*libs/output.bash
;)
Comment 2 Ulrich Müller gentoo-dev 2012-04-21 09:15:09 UTC
This seems to be a regression in bash-4.2_p24. The problem occurs if the string contains UTF-8 characters and if the extglob shell option is set:

   $ LC_ALL=en_US.UTF-8
   $ shopt -s extglob

First try with ASCII only, works as expected:

   $ text="aaabbb"
   $ echo "${text} ${text//?aa} ${text//\aaa}"
   aaabbb bbb bbb

But it fails with UTF-8:

   $ text="aaaäöü"
   $ echo "${text} ${text//?aa} ${text//\aaa}"
   aaaäöü aaaäöü aaaäöü

Without extglob, it appears to work properly again:

   $ shopt -u extglob
   $ echo "${text} ${text//?aa} ${text//\aaa}"
   aaaäöü äöü äöü

I don't see the problem with bash-4.1_p11.

Reassigning to base-system.
Comment 3 SpanKY gentoo-dev 2012-04-21 17:17:08 UTC
moved upstream then as 4.1 works but 4.2 fails
Comment 4 Vadim A. Misbakh-Soloviov (mva) gentoo-dev 2012-04-22 08:56:16 UTC
Patch available (2nd answer), so what we prefer to do now? Waiting for release of new version in upstream or add a patch? ;)
Comment 5 SpanKY gentoo-dev 2012-04-22 15:20:02 UTC
i'm going to wait to see what Chet says
Comment 6 SpanKY gentoo-dev 2012-04-23 04:24:26 UTC
Chet OK-ed it, so i've added it to 4.2_p24-r1