Bug 951707

Summary: zypper search hangs due to text formatting
Product: [openSUSE] openSUSE Tumbleweed Reporter: Ronan Chagas <ronisbr>
Component: libzyppAssignee: E-mail List <zypp-maintainers>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: bwiedemann, ronisbr
Version: Current   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Ronan Chagas 2015-10-23 01:01:59 UTC
Hi.

I am having a problem with zypper search function in some cases.
If I execute, for example:

    $ zypper search nautilus

in a terminal (like mate-terminal) in which 60px <= width <= 86px, then it loops printing empty characters:

$ zypper search nautilus
Carregando os dados do repositório...
Lendo os pacotes instalados...

S | Nome                                 | Resumo                   | Tipo      
--+--------------------------------------+--------------------------+-----------
  | Nautilus-Actions Configuration Tool  | Configure items to be -> | aplicativo
i | brasero-nautilus                     | Brasero CD/DVD burning-> | pacote    
  | folder-color-nautilus                | Change a directory col-> | pacote    
  | gnome-shell-search-provider-nautilus | File Manager for the G-> | pacote    
i | libnautilus-extension1               | File Manager for the G-> | pacote    
  | libnautilus-extension1-32bit         | File Manager for the G-> | pacote    
i | nautilus                             | File Manager for the G-> | pacote    
  | nautilus-actions                     | Nautilus extension to -> | pacote    
  | nautilus-actions-devel               | Nautilus extension to -> | pacote    
  | nautilus-actions-lang                | Languages for package -> | pacote    
i | nautilus-deja-dup                    | Déjà Dup Plugin for Na
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                .... (eternal loop)

I can see the same behavior using LANG=C:

$ LANG=C zypper search nautilus 
Loading repository data...
Reading installed packages...

S | Name                                 | Summary                 | Type       
--+--------------------------------------+-------------------------+------------
  | Nautilus-Actions Configuration Tool  | Configure items to be-> | application
i | brasero-nautilus                     | Brasero CD/DVD burnin-> | package    
  | folder-color-nautilus                | Change a directory co-> | package    
  | gnome-shell-search-provider-nautilus | File Manager for the -> | package    
i | libnautilus-extension1               | File Manager for the -> | package    
  | libnautilus-extension1-32bit         | File Manager for the -> | package    
i | nautilus                             | File Manager for the -> | package    
  | nautilus-actions                     | Nautilus extension to-> | package    
  | nautilus-actions-devel               | Nautilus extension to-> | package    
  | nautilus-actions-lang                | Languages for package-> | package    
i | nautilus-deja-dup                    | Déjà Dup Plugin for N
                                                                                                                                                                                                                                                .... (eternal loop)

However, for LANG=C the width interval in which the problem can be seen is different. Notice that if I resize the terminal such that the width is outside the aforementioned interval, then everything works. Thus, I think it is related with a text formatting function or something.

Below, I am appending additional information about my system.

➜  ~  cat /etc/os-release 
NAME=openSUSE
VERSION="Tumbleweed"
VERSION_ID="20151017"
PRETTY_NAME="openSUSE Tumbleweed (20151017) (x86_64)"
ID=opensuse
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:opensuse:20151017"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://opensuse.org/"
ID_LIKE="suse"

➜  ~  zypper --version
zypper 1.12.16
Comment 1 Ronan Chagas 2015-10-24 01:46:03 UTC
I think the problem is due to the non-ASCII characters in the Summary. In this case "Déjà Dup". As pointed by Alexei (XRevan86), when the search works, the line with the non-ASCII characters is not aligned:

| Nautilus extension to launch arbitr-> | package
| Languages for package nautilus-acti-> | package    
| Déjà Dup Plugin for Nautilus        | package    
| File Manager for the GNOME Desktop -> | package
| Nautilus ACL viewer and editor exte-> | package
Comment 2 Bernhard Wiedemann 2015-10-26 14:16:39 UTC
probably something wrong with the unicode string handling

I even get 
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
and a core-dump with this backtrace:
#4  0x00007f4a2f809bd1 in std::terminate ()
    at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:57
#5  0x00007f4a2f809de8 in __cxxabiv1::__cxa_throw (obj=0x7f4a20000940, 
    tinfo=0x7f4a2fae8790 <typeinfo for std::bad_alloc>, 
    dest=0x7f4a2f8080a0 <std::bad_alloc::~bad_alloc()>)
    at ../../../../libstdc++-v3/libsupc++/eh_throw.cc:87
#6  0x00007f4a2f80a2ec in operator new (sz=4294967295)
    at ../../../../libstdc++-v3/libsupc++/new_op.cc:54
#7  0x00007f4a2f89506c in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct (this=0x7fffe219bfa0, __n=4294967294, __c=<optimized out>)
    at /usr/src/debug/gcc-5.1.1-r225724/obj-x86_64-suse-linux/x86_64-suse-linux/libstdc++-v3/include/bits/basic_string.tcc:246
#8  0x00000000004c95fe in TableRow::dumpTo(std::ostream&, Table const&) const ()
#9  0x00000000004cbd4f in Table::dumpTo(std::ostream&) const ()
#10 0x00000000004644f0 in Zypper::doCommand() ()
#11 0x00000000004713bd in Zypper::safeDoCommand() ()
#12 0x000000000043aa1d in Zypper::main(int, char**) ()

(though that was from older zypper-1.12.12 )
Comment 3 Michael Andres 2015-10-26 14:42:25 UTC
Unfortunately tumleweed has an old zypper. Please retry with zypper-1.12.24.

This version works well for me (except for wrong clipping with LANG=C); no hang, no loops.
Comment 4 Michael Andres 2015-10-26 14:43:06 UTC
(@zypper-1.12.24: as soon as it's available in Tunbleweed/Factory)
Comment 5 Michael Andres 2015-10-29 15:31:03 UTC
zypper-1.12.25 fixes wrong clipping with LANG=C

Closing the bug. Please reopen, if you experience problems with zypper-1.12.24 (or later).
Comment 6 Swamp Workflow Management 2016-02-16 17:13:37 UTC
SUSE-RU-2016:0468-1: An update that has 21 recommended fixes can now be installed.

Category: recommended (moderate)
Bug References: 606220,637791,710541,793424,948566,949196,949945,951707,953214,953458,955053,955615,956443,956480,957606,957862,959564,959804,961719,961738,964150
CVE References: 
Sources used:
SUSE Linux Enterprise Software Development Kit 12-SP1 (src):    libsolv-0.6.18-2.18.1, libzypp-15.21.1-7.1
SUSE Linux Enterprise Server 12-SP1 (src):    libsolv-0.6.18-2.18.1, libzypp-15.21.1-7.1, zypper-1.12.31-7.1
SUSE Linux Enterprise Desktop 12-SP1 (src):    libsolv-0.6.18-2.18.1, libzypp-15.21.1-7.1, zypper-1.12.31-7.1
Comment 7 Swamp Workflow Management 2016-02-21 10:13:49 UTC
openSUSE-RU-2016:0535-1: An update that has 21 recommended fixes can now be installed.

Category: recommended (moderate)
Bug References: 606220,637791,710541,793424,948566,949196,949945,951707,953214,953458,955053,955615,956443,956480,957606,957862,959564,959804,961719,961738,964150
CVE References: 
Sources used:
openSUSE Leap 42.1 (src):    libsolv-0.6.18-3.1, libzypp-15.21.1-3.2, zypper-1.12.31-3.1