Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 438558

Summary: app-misc/tmux-1.7 segfaults when entering copy mode
Product: Gentoo Linux Reporter: Ivan Iraci <ivanhoe>
Component: Current packagesAssignee: Alex Alexander (RETIRED) <wired>
Status: RESOLVED FIXED    
Severity: normal CC: shell-tools
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Ivan Iraci 2012-10-16 09:36:10 UTC
When I enter copy mode (C-b PageUp), tmux 1.7 segfaults and in dmesg I can read:
tmux[12843]: segfault at 69727f ip 000000000042a98c sp 00007fffa11ca8b0 error 4 in tmux[400000+4f000]

tmux-1.6 works fine. I re-emerged libevent and ncurses in the hope to fix the problem with tmux-1.7 but without any benefit.
'revdep-rebuild -ip' shows no problem

Reproducible: Always

Steps to Reproduce:
1. run tmux
2. press 'C-b PageUp'

Actual Results:  
segfault

Expected Results:  
Enter copy mode and scroll one page back.
Comment 1 Agostino Sarubbo gentoo-dev 2012-10-16 10:21:12 UTC
ok, we need a full backtrace. please do:

1)FEATURES="nostrip" CFLAGS="-g3" CXXFLAGS="${CFLAGS}" emerge tmux
2)gdb /usr/bin/tmux
3)run (to start it)
4)bt after segfaults.
Comment 2 Ivan Iraci 2012-10-16 10:43:09 UTC
$ gdb /usr/bin/tmux
GNU gdb (Gentoo 7.5 p1) 7.5
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...
Reading symbols from /usr/bin/tmux...done.
(gdb) run
Starting program: /usr/bin/tmux 
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
protocol version mismatch (client 7, server 6)
[Inferior 1 (process 23674) exited with code 01]
(gdb)
Comment 3 Ivan Iraci 2012-10-16 10:48:58 UTC
No, wait, there was a tmux-1.6 session running.

Running tmux-1.7 in gdb inhibits the segfault.

$ gdb /usr/bin/tmux
GNU gdb (Gentoo 7.5 p1) 7.5
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...
Reading symbols from /usr/bin/tmux...done.
(gdb) run
Starting program: /usr/bin/tmux 
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[exited]
[Inferior 1 (process 12240) exited normally]
(gdb)
Comment 4 Ivan Iraci 2012-10-16 10:53:15 UTC
No, it's not gdb.
tmux-1.7 works perfectly if built with:
FEATURES="nostrip" CFLAGS="-g3" CXXFLAGS="${CFLAGS}" emerge tmux

That's what I have in make.conf:

CFLAGS="-Os -mtune=core2 -march=core2 -pipe -D__STDC_CONSTANT_MACROS"
CXXFLAGS="${CFLAGS}"

Any other software, tmux-1.6 included, works fine with this CFLAGS.
Comment 5 Anthony Low 2012-12-09 21:05:57 UTC
The -Os flag is the problem it seems. Until this gets fixed upstream or in the official ebuild, two solutions are:

1. Modify the ebuild, adding
       inherit flag-o-matic
   to the top of the file and inserting
       replace-flags -Os -O2
   into src_prepare()

2. Create a file /etc/portage/env/app-misc/tmux-1.7 containing
       CFLAGS=`echo "${CFLAGS}" | sed 's/-Os/-O2/'`
Comment 6 Alex Alexander (RETIRED) gentoo-dev 2013-02-02 04:16:46 UTC
fixed in 1.7-r2, cheers :)