NetBSD Problem Report #51550

From www@NetBSD.org  Tue Oct 11 00:52:17 2016
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 1AE217A168
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 11 Oct 2016 00:52:17 +0000 (UTC)
Message-Id: <20161011005215.CFB207A16D@mollari.NetBSD.org>
Date: Tue, 11 Oct 2016 00:52:15 +0000 (UTC)
From: jdbaker@mylinuxisp.com
Reply-To: jdbaker@mylinuxisp.com
To: gnats-bugs@NetBSD.org
Subject: mplayer w/option "caca" segfaults if "-vo caca" used.
X-Send-Pr-Version: www-1.0

>Number:         51550
>Category:       pkg
>Synopsis:       mplayer w/option "caca" segfaults if "-vo caca" used.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 11 00:55:00 +0000 2016
>Last-Modified:  Wed Oct 12 14:35:01 +0000 2016
>Originator:     John D. Baker
>Release:        NetBSD/amd64-7.0_STABLE, pkgsrc-2016Q3
>Organization:
>Environment:
NetBSD skuld.technoskunk.fur 7.0_STABLE NetBSD 7.0_STABLE (SKULD) #44: Thu Oct  6 06:27:32 CDT 2016  sysop@yggdrasil.technoskunk.fur:/r0/build/netbsd-7/obj/amd64/sys/arch/amd64/compile/SKULD amd64

>Description:
If "multimedia/mplayer" or "multimedia/gmplayer" is built with the
"caca" option (IIUC this is color ASCII-art rendition of video) and
then using the option is attempted with

  $ mplayer -vo caca some_video_file.mp4

the terminal in which the command is invoked is cleared, the start
of mplayer's running status line is printed on the top line and then
the terminates with segfault.  The terminal is left in a state where
the cursor is invisble.

The resulting core file is not particularly revealing.  Even after
rebuilding with the "debug" option for "mplayer" and setting

  CFLAGS+=-ggdb
  CXXFLAGS+=-ggdb
  INSTALL_UNSTRIPPED=yes

for "graphics/libcaca" and "multimedia/mplayer", and leaving their
respective "${WRKSRC}" trees intact, the best I can get is (for
mplayer):

Core was generated by `mplayer'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f7ff7819403 in ?? ()
(gdb) bt
#0  0x00007f7ff7819403 in ?? ()
#1  0x00007f7ff77191c0 in ?? ()
#2  0x00007f7feb8174a4 in ?? ()
#3  0x00007f7ff7b36800 in ?? ()
#4  0x00000000f774d800 in ?? ()
#5  0x00007f7ff7b226c0 in ?? ()
#6  0x0000000000000800 in ?? ()
#7  0x000000000000a500 in ?? ()
#8  0x00007f7ff771f020 in ?? ()
#9  0x00000000a5010020 in ?? ()
#10 0x0000005000500001 in ?? ()
#11 0x0000001f00000050 in ?? ()
#12 0x00007f7ff7b226c0 in ?? ()
#13 0x00007f7ff7a28ac8 in ?? ()
#14 0x00007f7ff7750800 in ?? ()
#15 0x00007f7ff7a28ac0 in ?? ()
#16 0x000000000000003b in ?? ()
#17 0x00007f7ff77191c0 in ?? ()
#18 0x00007f7ff781bdb2 in ?? ()
#19 0x0000000000000020 in ?? ()
#20 0x0000003000000050 in ?? ()
#21 0x00007f7feb80cb01 in ?? ()
#22 0x0000000000000000 in ?? ()


Or for "gmplayer":

Core was generated by `gmplayer'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f7ff781969e in ?? ()
(gdb) bt
#0  0x00007f7ff781969e in ?? ()
#1  0x00007f7ff6ba71c0 in ?? ()
#2  0x0000004feb4174a4 in ?? ()
#3  0x00007f7ff73d4000 in ?? ()
#4  0x0000000000000050 in ?? ()
#5  0x00007f7ff7b22ee0 in ?? ()
#6  0x0000000000000000 in ?? ()

>How-To-Repeat:
See above.  Build "mplayer" and/or "gmplayer" with:

  PKG_OPTIONS.mplayer+=caca
  PKG_OPTIONS.gmplayer+=caca

And try to play a video file with "-vo caca"


(Possibly an interaction with other options?  I typically turn them all
on.)

One thing to note is that with "libaa" (monochrome ASCII-art rendition,
"-vo aa"), it opens a new window to display, while "-vo caca" seems to
try to use the current terminal (possible conflict with other output
operations?).
>Fix:
Workaround:  Don't use "-vo caca".  Monochrome ASCII-art is available
with "-vo aa".

>Audit-Trail:
From: Joerg Sonnenberger <joerg@bec.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/51550: mplayer w/option "caca" segfaults if "-vo caca" used.
Date: Tue, 11 Oct 2016 03:06:58 +0200

 On Tue, Oct 11, 2016 at 12:55:00AM +0000, jdbaker@mylinuxisp.com wrote:
 > The resulting core file is not particularly revealing.  Even after
 > rebuilding with the "debug" option for "mplayer" and setting
 > 
 >   CFLAGS+=-ggdb
 >   CXXFLAGS+=-ggdb
 >   INSTALL_UNSTRIPPED=yes

 Try _WRAP_EXTRA_ARGS.CC+=-ggdb and/or CWRAPPERS_APPEND.cc+=-ggdb.
 That said, the frames in question might be in one of the libraries
 linked.

 Joerg

From: "John D. Baker" <jdbaker@mylinuxisp.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/51550: mplayer w/option "caca" segfaults if "-vo caca" used.
Date: Tue, 11 Oct 2016 09:10:34 -0500 (CDT)

 On Tue, 11 Oct 2016, Joerg Sonnenberger wrote:

 >  >   CFLAGS+=-ggdb
 >  >   CXXFLAGS+=-ggdb
 >  >   INSTALL_UNSTRIPPED=yes
 >  
 >  Try _WRAP_EXTRA_ARGS.CC+=-ggdb and/or CWRAPPERS_APPEND.cc+=-ggdb.

 I've added _WRAP_EXTRA_ARGS.CC+=-ggdb to the previous extra settings
 and rebuilt libcaca, mplayer, and now ffmpeg3 with these.

 >  That said, the frames in question might be in one of the libraries
 >  linked.

 So far, the gdb backtraces still do not show any symbolic information,
 not even library names.

 I suspect I'll have to rebuild all of the depended libraries...

 -- 
 |/"\ John D. Baker, KN5UKS               NetBSD     Darwin/MacOS X
 |\ / jdbaker[snail]mylinuxisp[flyspeck]com    OpenBSD            FreeBSD
 | X  No HTML/proprietary data in email.   BSD just sits there and works!
 |/ \ GPGkeyID:  D703 4A7E 479F 63F8 D3F4  BD99 9572 8F23 E4AD 1645

From: Joerg Sonnenberger <joerg@bec.de>
To: gnats-bugs@NetBSD.org
Cc: pkg-manager@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org,
	jdbaker@mylinuxisp.com
Subject: Re: pkg/51550: mplayer w/option "caca" segfaults if "-vo caca" used.
Date: Tue, 11 Oct 2016 16:26:33 +0200

 On Tue, Oct 11, 2016 at 02:15:01PM +0000, John D. Baker wrote:
 > The following reply was made to PR pkg/51550; it has been noted by GNATS.
 > 
 > From: "John D. Baker" <jdbaker@mylinuxisp.com>
 > To: gnats-bugs@NetBSD.org
 > Cc: 
 > Subject: Re: pkg/51550: mplayer w/option "caca" segfaults if "-vo caca" used.
 > Date: Tue, 11 Oct 2016 09:10:34 -0500 (CDT)
 > 
 >  On Tue, 11 Oct 2016, Joerg Sonnenberger wrote:
 >  
 >  >  >   CFLAGS+=-ggdb
 >  >  >   CXXFLAGS+=-ggdb
 >  >  >   INSTALL_UNSTRIPPED=yes
 >  >  
 >  >  Try _WRAP_EXTRA_ARGS.CC+=-ggdb and/or CWRAPPERS_APPEND.cc+=-ggdb.
 >  
 >  I've added _WRAP_EXTRA_ARGS.CC+=-ggdb to the previous extra settings
 >  and rebuilt libcaca, mplayer, and now ffmpeg3 with these.
 >  
 >  >  That said, the frames in question might be in one of the libraries
 >  >  linked.
 >  
 >  So far, the gdb backtraces still do not show any symbolic information,
 >  not even library names.
 >  
 >  I suspect I'll have to rebuild all of the depended libraries...

 If you start the program in gdb, run pmap on the pid in another
 terminal. That shows you what library is mapped where.

 Joerg

From: "John D. Baker" <jdbaker@mylinuxisp.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/51550: mplayer w/option "caca" segfaults if "-vo caca" used.
Date: Tue, 11 Oct 2016 10:13:09 -0500 (CDT)

 On Tue, 11 Oct 2016, Joerg Sonnenberger wrote:

 > If you start the program in gdb, run pmap on the pid in another
 > terminal. That shows you what library is mapped where.

 Thanks for the tip!  The fault address seems to be in "libcurses".

 First address in backtrace:  0x00007f7ff7819403
 Longest matches in 'pmap' output:

   00007F7FF7800000    148K read/exec         /usr/lib/libcurses.so.7.0
   00007F7FF7825000   2048K                   /usr/lib/libcurses.so.7.0

 I installed the debug sets (now that I have space to do so), but no
 additional information was forthcoming.

 -- 
 |/"\ John D. Baker, KN5UKS               NetBSD     Darwin/MacOS X
 |\ / jdbaker[snail]mylinuxisp[flyspeck]com    OpenBSD            FreeBSD
 | X  No HTML/proprietary data in email.   BSD just sits there and works!
 |/ \ GPGkeyID:  D703 4A7E 479F 63F8 D3F4  BD99 9572 8F23 E4AD 1645

From: "John D. Baker" <jdbaker@mylinuxisp.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/51550: mplayer w/option "caca" segfaults if "-vo caca" used.
Date: Tue, 11 Oct 2016 10:44:20 -0500 (CDT)

 Using Joerg's suggestion, working back through the backtrace and showing
 the longest address match in the pmap output corresponding to a backtrace
 address:

 Frame: 0x00007f7ff7819403
 pmap:    00007F7FF7800000    148K read/exec         /usr/lib/libcurses.so.7.0
          00007F7FF7825000   2048K                   /usr/lib/libcurses.so.7.0

 Frame: 0x00007f7ff773a1c0
 pmap:    00007F7FF7700000     64K read/write          [ anon ]
          00007F7FF7710000    960K read/write          [ anon ]

 Frame: 0x00007f7feb8174a4
 pmap:    00007F7FEB800000    776K read/exec         /usr/pkg/lib/libcaca.so.0.99.18
          00007F7FEB8C2000   2048K                   /usr/pkg/lib/libcaca.so.0.99.18

 Frame: 0x00007f7ff7349000
 pmap:    00007F7FF7300000     64K read/write          [ anon ]
          00007F7FF7310000    960K read/write          [ anon ]

 Frame: 0x00000000f77519d4
 pmap:    0000000000200000   2184K read/exec         /usr/pkg/bin/mplayer
          0000000000621000    844K read/write        /usr/pkg/bin/mplayer
          00000000006F4000    204K read/write          [ anon ]

 Frame: 0x00007f7ff7b23020
 pmap:    00007F7FF7B00000     64K read/write          [ anon ]
          00007F7FF7B10000    960K read/write          [ anon ]

 Frame: 0x000000000000f9d4
 pmap:    0000000000200000   2184K read/exec         /usr/pkg/bin/mplayer
          0000000000621000    844K read/write        /usr/pkg/bin/mplayer
          00000000006F4000    204K read/write          [ anon ]

 Frame: 0x0000000000008700
 pmap:    0000000000200000   2184K read/exec         /usr/pkg/bin/mplayer
          0000000000621000    844K read/write        /usr/pkg/bin/mplayer
          00000000006F4000    204K read/write          [ anon ]

 Frame: 0x00007f7ff7740020
 pmap:    00007F7FF7700000     64K read/write          [ anon ]
          00007F7FF7710000    960K read/write          [ anon ]

 Frame: 0x0000000087010020
 pmap:    0000000000200000   2184K read/exec         /usr/pkg/bin/mplayer
          0000000000621000    844K read/write        /usr/pkg/bin/mplayer
          00000000006F4000    204K read/write          [ anon ]

 Frame: 0x0000005000500001
 pmap:    0000000000200000   2184K read/exec         /usr/pkg/bin/mplayer
          0000000000621000    844K read/write        /usr/pkg/bin/mplayer
          00000000006F4000    204K read/write          [ anon ]

 Frame: 0x0000001400000035
 pmap:    0000000000200000   2184K read/exec         /usr/pkg/bin/mplayer
          0000000000621000    844K read/write        /usr/pkg/bin/mplayer
          00000000006F4000    204K read/write          [ anon ]

 Frame: 0x00007f7ff7b23020
 pmap:    00007F7FF7B00000     64K read/write          [ anon ]
          00007F7FF7B10000    960K read/write          [ anon ]

 Frame: 0x00007f7ff7a28ac8
 pmap:  00007F7FF7A25000      8K read/write        /usr/lib/libcurses.so.7.0
        00007F7FF7A27000      8K read/write          [ anon ]

 Frame: 0x00007f7ff776faf4
 pmap:    00007F7FF7700000     64K read/write          [ anon ]
          00007F7FF7710000    960K read/write          [ anon ]

 Frame: 0x00007f7ff7a28ac0
 pmap:  00007F7FF7A25000      8K read/write        /usr/lib/libcurses.so.7.0
        00007F7FF7A27000      8K read/write          [ anon ]

 Frame: 0x0000000000000053
 pmap:    0000000000200000   2184K read/exec         /usr/pkg/bin/mplayer
          0000000000621000    844K read/write        /usr/pkg/bin/mplayer
          00000000006F4000    204K read/write          [ anon ]

 Frame: 0x00007f7ff773a1c0
 pmap:    00007F7FF7700000     64K read/write          [ anon ]
          00007F7FF7710000    960K read/write          [ anon ]

 Frame: 0x00007f7ff781bdb2
 pmap:    00007F7FF7800000    148K read/exec         /usr/lib/libcurses.so.7.0
          00007F7FF7825000   2048K                   /usr/lib/libcurses.so.7.0

 Frame: 0x0000000000000020
 pmap:    0000000000200000   2184K read/exec         /usr/pkg/bin/mplayer
          0000000000621000    844K read/write        /usr/pkg/bin/mplayer
          00000000006F4000    204K read/write          [ anon ]

 Frame: 0x0000003000000050
 pmap:    0000000000200000   2184K read/exec         /usr/pkg/bin/mplayer
          0000000000621000    844K read/write        /usr/pkg/bin/mplayer
          00000000006F4000    204K read/write          [ anon ]

 Frame: 0x00007f7feb80cb01
 pmap:    00007F7FEB800000    776K read/exec         /usr/pkg/lib/libcaca.so.0.99.18

 Frame: 0x0000000000000000
 pmap:    0000000000200000   2184K read/exec         /usr/pkg/bin/mplayer
          0000000000621000    844K read/write        /usr/pkg/bin/mplayer
          00000000006F4000    204K read/write          [ anon ]


 Based on the first three frames, I would hazard a guess that libcaca has
 given something to libcurses that it can't deal with.

 -- 
 |/"\ John D. Baker, KN5UKS               NetBSD     Darwin/MacOS X
 |\ / jdbaker[snail]mylinuxisp[flyspeck]com    OpenBSD            FreeBSD
 | X  No HTML/proprietary data in email.   BSD just sits there and works!
 |/ \ GPGkeyID:  D703 4A7E 479F 63F8 D3F4  BD99 9572 8F23 E4AD 1645

From: Joerg Sonnenberger <joerg@bec.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/51550: mplayer w/option "caca" segfaults if "-vo caca" used.
Date: Tue, 11 Oct 2016 18:31:52 +0200

 On Tue, Oct 11, 2016 at 03:15:01PM +0000, John D. Baker wrote:
 > The following reply was made to PR pkg/51550; it has been noted by GNATS.
 > 
 > From: "John D. Baker" <jdbaker@mylinuxisp.com>
 > To: gnats-bugs@NetBSD.org
 > Cc: 
 > Subject: Re: pkg/51550: mplayer w/option "caca" segfaults if "-vo caca" used.
 > Date: Tue, 11 Oct 2016 10:13:09 -0500 (CDT)
 > 
 >  On Tue, 11 Oct 2016, Joerg Sonnenberger wrote:
 >  
 >  > If you start the program in gdb, run pmap on the pid in another
 >  > terminal. That shows you what library is mapped where.
 >  
 >  Thanks for the tip!  The fault address seems to be in "libcurses".
 >  
 >  First address in backtrace:  0x00007f7ff7819403
 >  Longest matches in 'pmap' output:
 >  
 >    00007F7FF7800000    148K read/exec         /usr/lib/libcurses.so.7.0
 >    00007F7FF7825000   2048K                   /usr/lib/libcurses.so.7.0
 >  
 >  I installed the debug sets (now that I have space to do so), but no
 >  additional information was forthcoming.

 Can you manually build and install with DBG=-g in lib/libcurses? Debug
 sets still use -O2.

 Joerg

From: Benny Siegert <bsiegert@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: pkg-manager@netbsd.org,
 gnats-admin@netbsd.org,
 pkgsrc-bugs@netbsd.org,
 jdbaker@mylinuxisp.com
Subject: Re: pkg/51550: mplayer w/option "caca" segfaults if "-vo caca" used.
Date: Tue, 11 Oct 2016 19:44:49 +0200

 > Based on the first three frames, I would hazard a guess that libcaca has
 > given something to libcurses that it can't deal with.

 Does libcaca have a test suite that you could run (make test)?

From: "John D. Baker" <jdbaker@mylinuxisp.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/51550: mplayer w/option "caca" segfaults if "-vo caca" used.
Date: Tue, 11 Oct 2016 15:15:59 -0500 (CDT)

 On Tue, 11 Oct 2016, Benny Siegert wrote:

 >  Does libcaca have a test suite that you could run (make test)?

 There is a "test" subdirectory under ${WRKSRC}.  There is a "caca-test.cpp"
 but no executable.  Trying to build it manually from the directory, it
 can't locate required headers from "cppunit".

 A "simple" and a "bench" test were built.  When run, they claim everything
 passes.

 There is also an "examples" directory which contains executables (but
 they are not installed).  They seem to work.

 An interesting bit is that "libcaca.so" is linked with "ncurses":

 $ ldd /usr/pkg/lib/libcaca.so
 /usr/pkg/lib/libcaca.so:
 	-lncurses.6 => /usr/pkg/lib/libncurses.so.6
 	-lgcc_s.1 => /usr/lib/libgcc_s.so.1
 	-lc.12 => /usr/lib/libc.so.12
 	-lz.1 => /usr/lib/libz.so.1

 but when used within 'mplayer' it seems the display is attempted with
 system curses.  Conflict?

 -- 
 |/"\ John D. Baker, KN5UKS               NetBSD     Darwin/MacOS X
 |\ / jdbaker[snail]mylinuxisp[flyspeck]com    OpenBSD            FreeBSD
 | X  No HTML/proprietary data in email.   BSD just sits there and works!
 |/ \ GPGkeyID:  D703 4A7E 479F 63F8 D3F4  BD99 9572 8F23 E4AD 1645

From: Joerg Sonnenberger <joerg@bec.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/51550: mplayer w/option "caca" segfaults if "-vo caca" used.
Date: Tue, 11 Oct 2016 22:23:00 +0200

 On Tue, Oct 11, 2016 at 08:20:01PM +0000, John D. Baker wrote:
 >  An interesting bit is that "libcaca.so" is linked with "ncurses":
 >  
 >  $ ldd /usr/pkg/lib/libcaca.so
 >  /usr/pkg/lib/libcaca.so:
 >  	-lncurses.6 => /usr/pkg/lib/libncurses.so.6
 >  	-lgcc_s.1 => /usr/lib/libgcc_s.so.1
 >  	-lc.12 => /usr/lib/libc.so.12
 >  	-lz.1 => /usr/lib/libz.so.1
 >  
 >  but when used within 'mplayer' it seems the display is attempted with
 >  system curses.  Conflict?

 That would be asking for trouble, yes.

 Joerg

From: "John D. Baker" <jdbaker@mylinuxisp.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/51550: mplayer w/option "caca" segfaults if "-vo caca" used.
Date: Tue, 11 Oct 2016 17:40:42 -0500 (CDT)

 On Tue, 11 Oct 2016, Joerg Sonnenberger wrote:

 >  That would be asking for trouble, yes.

 Hmm.  Changing the output to "x11" via PKG_OPTIONS.libcaca sidesteps the
 issue.  Curiously, this is quite slow compared to mplayer's default "xv"
 output on the same hardware.

 -- 
 |/"\ John D. Baker, KN5UKS               NetBSD     Darwin/MacOS X
 |\ / jdbaker[snail]mylinuxisp[flyspeck]com    OpenBSD            FreeBSD
 | X  No HTML/proprietary data in email.   BSD just sits there and works!
 |/ \ GPGkeyID:  D703 4A7E 479F 63F8 D3F4  BD99 9572 8F23 E4AD 1645

From: "John D. Baker" <jdbaker@mylinuxisp.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/51550: mplayer w/option "caca" segfaults if "-vo caca" used.
Date: Wed, 12 Oct 2016 09:34:11 -0500 (CDT)

 On Tue, 11 Oct 2016, Joerg Sonnenberger wrote:

 >  Can you manually build and install with DBG=-g in lib/libcurses? Debug
 >  sets still use -O2.

 I believe I have done this properly and copied the resulting library
 and debug file to the test system.

 Repeating the test reveals no new information.  This time, there were
 only three frames in the backtrace.

 #0  0x00007f7ff7821f26 in ?? ()
 #1  0x0000a50000000000 in ?? ()
 #2  0x0000000000000000 in ?? ()

 The first backtrace address is in libcurses, but no debugging information
 is available.

 The second frame address seems to be garbage and doesn't appear in the
 pmap listing at all (i.e., the longest matching address is 0000 which
 matches everything).   The third frame is the 'mplayer' executable.

 -- 
 |/"\ John D. Baker, KN5UKS               NetBSD     Darwin/MacOS X
 |\ / jdbaker[snail]mylinuxisp[flyspeck]com    OpenBSD            FreeBSD
 | X  No HTML/proprietary data in email.   BSD just sits there and works!
 |/ \ GPGkeyID:  D703 4A7E 479F 63F8 D3F4  BD99 9572 8F23 E4AD 1645

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.