Re: [dev] [dwm] Crash when setting window title to a single emoji

2016-09-05 Thread Markus Unterwaditzer
On Mon, Sep 05, 2016 at 11:10:53AM +0200, Paul Menzel wrote:
> Dear Markus,
> 
> 
> On 08/31/16 21:22, Markus Unterwaditzer wrote:
> > On Wed, Aug 31, 2016 at 09:07:21PM +0200, Markus Unterwaditzer wrote:
> > > On Wed, Aug 31, 2016 at 03:52:36PM +0200, Paul Menzel wrote:
> 
> > > > On 08/30/16 19:32, Markus Unterwaditzer wrote:
> > > > 
> > > > > On Tue, Aug 30, 2016 at 01:30:20PM +0200, Paul Menzel wrote:
> > > > > > > None.
> > > > > > 
> > > > > > How do you start dwm?
> > > > > 
> > > > > A simple `dwm` in `.xinitrc`. You can view the entire setup here:
> > > > > https://github.com/untitaker/dotfiles
> > > > 
> > > > Did you already try running dwm under GDB? You could add it to the
> > > > `.xinitrc` file and attach to GDB remotely I guess.
> 
> > > Well, I have tried now! Attached is the entire session.
> > > 
> > > I'm not sure what to look for. In another session I noticed that shortly 
> > > before
> > > `drw_text` gets called `text` being a nullpointer. It appears that the 
> > > code is
> > > designed to deal with this though.
> > > 
> > > By the way, this time I reproduced this issue using:
> > > 
> > > echo -e "\xe2\x9b\x93b" | xargs xsetroot -name
> > > 
> > > Thanks for your help,
> > > Markus
> > 
> > Sorry, forgot the actual attachment. Here it is.
> 
> No problem. Thank you very much for that. Unfortunately, I won’t have time
> until the end of the week to look more into it.
> 
> If you have time until then, could you please also run the process under
> Valgrind, or build the stack with some sanitizers (address, undefined
> behavior)?
> 
> ```
> $ G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind \
> -v \
> --tool=memcheck \
> --leak-check=full \
> --num-callers=40 \
> --log-file=valgrind.log \
> $(which ) 
> ```
> 
> 
> Best regards,
> 
> Paul
> 
> 
> PS: By the way, you should be able to attach to running processes too.
> 
> 
> [1] https://wiki.ubuntu.com/Valgrind
> 

Hello Paul,

Attached is the valgrind.log.

Thanks for your help,
Markus
==26599== Memcheck, a memory error detector
==26599== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==26599== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==26599== Command: /home/untitaker/.local/bin/dwm
==26599== Parent PID: 20697
==26599== 
--26599-- 
--26599-- Valgrind options:
--26599---v
--26599----tool=memcheck
--26599----leak-check=full
--26599----num-callers=40
--26599----log-file=valgrind.log
--26599-- Contents of /proc/version:
--26599--   Linux version 4.7.2-1-ARCH (builduser@tobias) (gcc version 6.1.1 
20160802 (GCC) ) #1 SMP PREEMPT Sat Aug 20 23:02:56 CEST 2016
--26599-- 
--26599-- Arch and hwcaps: AMD64, LittleEndian, 
amd64-cx16-lzcnt-rdtscp-sse3-avx-avx2-bmi
--26599-- Page sizes: currently 4096, max supported 4096
--26599-- Valgrind library directory: /usr/lib/valgrind
--26599-- Reading syms from /home/untitaker/.local/bin/dwm
--26599-- Reading syms from /usr/lib/ld-2.24.so
--26599-- Reading syms from /usr/lib/valgrind/memcheck-amd64-linux
--26599--object doesn't have a symbol table
--26599--object doesn't have a dynamic symbol table
--26599-- Scheduler: using generic scheduler lock implementation.
--26599-- Reading suppressions file: /usr/lib/valgrind/default.supp
==26599== embedded gdbserver: reading from 
/tmp/vgdb-pipe-from-vgdb-to-26599-by-untitaker-on-???
==26599== embedded gdbserver: writing to   
/tmp/vgdb-pipe-to-vgdb-from-26599-by-untitaker-on-???
==26599== embedded gdbserver: shared mem   
/tmp/vgdb-pipe-shared-mem-vgdb-26599-by-untitaker-on-???
==26599== 
==26599== TO CONTROL THIS PROCESS USING vgdb (which you probably
==26599== don't want to do, unless you know exactly what you're doing,
==26599== or are doing some strange experiment):
==26599==   /usr/lib/valgrind/../../bin/vgdb --pid=26599 ...command...
==26599== 
==26599== TO DEBUG THIS PROCESS USING GDB: start GDB like this
==26599==   /path/to/gdb /home/untitaker/.local/bin/dwm
==26599== and then give GDB the following command
==26599==   target remote | /usr/lib/valgrind/../../bin/vgdb --pid=26599
==26599== --pid is optional if only one valgrind process is running
==26599== 
--26599-- REDIR: 0x401aad0 (ld-linux-x86-64.so.2:strlen) redirected to 
0x3809d191 (???)
--26599-- Reading syms from /usr/lib/valgrind/vgpreload_core-amd64-linux.so
--26599--object doesn't have a symbol table
--26599-- Reading syms from /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so
--26599--object doesn't have a symbol table
==26599== WARNING: new redirection conflicts with existing -- ignoring it
--26599-- old: 0x0401aad0 (strlen  ) R-> (.0) 0x3809d191 ???
--26599-- new: 0x0401aad0 (strlen  ) R-> (2007.0) 0x04c2ce50 
strlen
--26599-- REDIR: 0x4019640 (ld-linux-x86-64.so.2:strcmp) redirected to 
0x4c2df50 (strcmp)
--26599-- REDIR: 0x4019420 (ld-linux-x86-64.so.2:index) redirected to 0x4c2ca00 
(index)
--26599-- REDIR: 0x401b5e0 (ld-linux-x86-64.so.2:mempcpy) redirected to 

Re: [dev] [dwm] Crash when setting window title to a single emoji

2016-09-05 Thread Paul Menzel

Dear Markus,


On 08/31/16 21:22, Markus Unterwaditzer wrote:

On Wed, Aug 31, 2016 at 09:07:21PM +0200, Markus Unterwaditzer wrote:

On Wed, Aug 31, 2016 at 03:52:36PM +0200, Paul Menzel wrote:



On 08/30/16 19:32, Markus Unterwaditzer wrote:


On Tue, Aug 30, 2016 at 01:30:20PM +0200, Paul Menzel wrote:

None.


How do you start dwm?


A simple `dwm` in `.xinitrc`. You can view the entire setup here:
https://github.com/untitaker/dotfiles


Did you already try running dwm under GDB? You could add it to the
`.xinitrc` file and attach to GDB remotely I guess.



Well, I have tried now! Attached is the entire session.

I'm not sure what to look for. In another session I noticed that shortly before
`drw_text` gets called `text` being a nullpointer. It appears that the code is
designed to deal with this though.

By the way, this time I reproduced this issue using:

echo -e "\xe2\x9b\x93b" | xargs xsetroot -name

Thanks for your help,
Markus


Sorry, forgot the actual attachment. Here it is.


No problem. Thank you very much for that. Unfortunately, I won’t have 
time until the end of the week to look more into it.


If you have time until then, could you please also run the process under 
Valgrind, or build the stack with some sanitizers (address, undefined 
behavior)?


```
$ G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind \
-v \
--tool=memcheck \
--leak-check=full \
--num-callers=40 \
--log-file=valgrind.log \
$(which ) 
```


Best regards,

Paul


PS: By the way, you should be able to attach to running processes too.


[1] https://wiki.ubuntu.com/Valgrind



Re: [dev] [dwm] Crash when setting window title to a single emoji

2016-08-31 Thread Markus Unterwaditzer
On Wed, Aug 31, 2016 at 09:07:21PM +0200, Markus Unterwaditzer wrote:
> On Wed, Aug 31, 2016 at 03:52:36PM +0200, Paul Menzel wrote:
> > Dear Markus,
> > 
> > 
> > On 08/30/16 19:32, Markus Unterwaditzer wrote:
> > 
> > > On Tue, Aug 30, 2016 at 01:30:20PM +0200, Paul Menzel wrote:
> > > > > None.
> > > > 
> > > > How do you start dwm?
> > > 
> > > A simple `dwm` in `.xinitrc`. You can view the entire setup here:
> > > https://github.com/untitaker/dotfiles
> > 
> > Did you already try running dwm under GDB? You could add it to the
> > `.xinitrc` file and attach to GDB remotely I guess.
> > 
> > 
> > Liebe Grüße
> > 
> > Paul
> > 
> 
> Hello Paul,
> 
> Well, I have tried now! Attached is the entire session.
> 
> I'm not sure what to look for. In another session I noticed that shortly 
> before
> `drw_text` gets called `text` being a nullpointer. It appears that the code is
> designed to deal with this though.
> 
> By the way, this time I reproduced this issue using:
> 
> echo -e "\xe2\x9b\x93b" | xargs xsetroot -name
> 
> Thanks for your help,
> Markus

Sorry, forgot the actual attachment. Here it is.
GNU gdb (GDB) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
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".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./dwm...done.
(gdb) break xerror
Breakpoint 1 at 0xc4a1: file dwm.c, line 2014.
(gdb) r
Starting program: /home/untitaker/.homesick/repos/dotfiles/dwm/dwm 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".

Breakpoint 1, xerror (dpy=0x55779dd0, ee=0x7fffe1b0) at dwm.c:2014
2014if(ee->error_code == BadWindow
(gdb) where
#0  xerror (dpy=0x55779dd0, ee=0x7fffe1b0) at dwm.c:2014
#1  0x77adb87d in _XError () from /usr/lib/libX11.so.6
#2  0x77ad87c7 in ?? () from /usr/lib/libX11.so.6
#3  0x77ad8885 in ?? () from /usr/lib/libX11.so.6
#4  0x77ad9830 in _XReply () from /usr/lib/libX11.so.6
#5  0x77ad511d in XSync () from /usr/lib/libX11.so.6
#6  0x8a45 in drw_map (drw=0x55785640, win=12582925, x=0, y=0, 
w=1366, h=18) at drw.c:370
#7  0xad3d in drawbar (m=0x5578dd80) at dwm.c:740
#8  0x555600ea in updatestatus () at dwm.c:1937
#9  0xe749 in setup () at dwm.c:1542
#10 0x555607c2 in main (argc=1, argv=0x7fffe5c8) at dwm.c:2066
(gdb) frame 6
#6  0x8a45 in drw_map (drw=0x55785640, win=12582925, x=0, y=0, 
w=1366, h=18) at drw.c:370
370 XSync(drw->dpy, False);
(gdb) p *drw
$1 = {w = 1366, h = 768, dpy = 0x55779dd0, screen = 0, root = 211, drawable 
= 12582913, gc = 0x55785790, scheme = 0x557640a0 , fontcount = 
4, 
  fonts = {0x55785330, 0x557896f0, 0x5579a000, 0x55791d80, 0x0 
}}
(gdb) quit
A debugging session is active.

Inferior 1 [process 14378] will be killed.

Quit anyway? (y or n) y


Re: [dev] [dwm] Crash when setting window title to a single emoji

2016-08-31 Thread Markus Unterwaditzer
On Wed, Aug 31, 2016 at 03:52:36PM +0200, Paul Menzel wrote:
> Dear Markus,
> 
> 
> On 08/30/16 19:32, Markus Unterwaditzer wrote:
> 
> > On Tue, Aug 30, 2016 at 01:30:20PM +0200, Paul Menzel wrote:
> > > > None.
> > > 
> > > How do you start dwm?
> > 
> > A simple `dwm` in `.xinitrc`. You can view the entire setup here:
> > https://github.com/untitaker/dotfiles
> 
> Did you already try running dwm under GDB? You could add it to the
> `.xinitrc` file and attach to GDB remotely I guess.
> 
> 
> Liebe Grüße
> 
> Paul
> 

Hello Paul,

Well, I have tried now! Attached is the entire session.

I'm not sure what to look for. In another session I noticed that shortly before
`drw_text` gets called `text` being a nullpointer. It appears that the code is
designed to deal with this though.

By the way, this time I reproduced this issue using:

echo -e "\xe2\x9b\x93b" | xargs xsetroot -name

Thanks for your help,
Markus



Re: [dev] [dwm] Crash when setting window title to a single emoji

2016-08-31 Thread Paul Menzel

Dear Markus,


On 08/30/16 19:32, Markus Unterwaditzer wrote:


On Tue, Aug 30, 2016 at 01:30:20PM +0200, Paul Menzel wrote:

None.


How do you start dwm?


A simple `dwm` in `.xinitrc`. You can view the entire setup here:
https://github.com/untitaker/dotfiles


Did you already try running dwm under GDB? You could add it to the 
`.xinitrc` file and attach to GDB remotely I guess.



Liebe Grüße

Paul



Re: [dev] [dwm] Crash when setting window title to a single emoji

2016-08-30 Thread Markus Unterwaditzer
Hello Anselm,

On Tue, Aug 30, 2016 at 01:35:12PM +0200, Anselm R Garbe wrote:
> To me a crash is an illegal control flow of a program that is detected
> and aborted by the governing system (libc, etc.).
> 
> In contrast an exit() caused by the Xlib error handler is kind of a
> legal control flow to me, though from a user perspective similar.

I see. To me a crash is any failing program invocation that is not caused by
invalid user input. IMO a malformed environment doesn't count as user input
(with some exceptions).

> 
> BR,
> Anselm
> 


signature.asc
Description: PGP signature


Re: [dev] [dwm] Crash when setting window title to a single emoji

2016-08-30 Thread Markus Unterwaditzer
Hello Paul,

On Tue, Aug 30, 2016 at 01:30:20PM +0200, Paul Menzel wrote:
> > None.
> 
> How do you start dwm?

A simple `dwm` in `.xinitrc`. You can view the entire setup here:
https://github.com/untitaker/dotfiles

-- Markus

> 
> 
> Best regards,
> 
> Paul
> 



Re: [dev] [dwm] Crash when setting window title to a single emoji

2016-08-30 Thread Anselm R Garbe
On 30 August 2016 at 13:18, Markus Unterwaditzer
 wrote:
> On Tue, Aug 30, 2016 at 08:28:21AM +0200, Anselm R Garbe wrote:
>> [...]
>> I wonder if this is a crash at all. It rather looks like a fatal Xlib
>> error to me.
>
> I'm not sure how that doesn't qualify as crash. What is your definition of
> crash?

To me a crash is an illegal control flow of a program that is detected
and aborted by the governing system (libc, etc.).

In contrast an exit() caused by the Xlib error handler is kind of a
legal control flow to me, though from a user perspective similar.

BR,
Anselm



Re: [dev] [dwm] Crash when setting window title to a single emoji

2016-08-30 Thread Paul Menzel

Dear Markus,


On 08/30/16 13:18, Markus Unterwaditzer wrote:


On Tue, Aug 30, 2016 at 08:28:21AM +0200, Anselm R Garbe wrote:


[…]


Do you get coredumps of dwm? If yes, please provide a stack trace.


None.


How do you start dwm?


Best regards,

Paul



Re: [dev] [dwm] Crash when setting window title to a single emoji

2016-08-30 Thread Markus Unterwaditzer
Hello Anselm,

On Tue, Aug 30, 2016 at 08:28:21AM +0200, Anselm R Garbe wrote:
> [...]
> I wonder if this is a crash at all. It rather looks like a fatal Xlib
> error to me.

I'm not sure how that doesn't qualify as crash. What is your definition of
crash?

> Do you get coredumps of dwm? If yes, please provide a stack trace.

None.

-- Markus

> 
> BR,
> Anselm
> 


signature.asc
Description: PGP signature


Re: [dev] [dwm] Crash when setting window title to a single emoji

2016-08-30 Thread Anselm R Garbe
On 29 August 2016 at 19:56, Markus Unterwaditzer
 wrote:
> I'm getting crashes with a particular emoji in the window title. Enter the
> following in st/termite/xterm/urxvt (without tmux inbetween):
>
> PROMPT_COMMAND='echo -ne "\x1b]0;\xe2\x9b\x93b\x07"'
>
> dwm's output:
>
> dwm: fatal error: request code=140, error code=16
> X Error of failed request:  BadLength (poly request too large or internal 
> Xlib length error)
>   Major opcode of failed request:  140 (RENDER)
>   Minor opcode of failed request:  20 (RenderAddGlyphs)
>   Serial number of failed request:  4319
>   Current serial number in output stream:  4331

I wonder if this is a crash at all. It rather looks like a fatal Xlib
error to me.

Do you get coredumps of dwm? If yes, please provide a stack trace.

BR,
Anselm



Re: [dev] [dwm] Crash when setting window title to a single emoji

2016-08-29 Thread Greg Reagle
I cannot reproduce it on my computer.  Using 
Debian 8.5, 
dwm commit 7af4d439bdb5a2e40aca69446a3367bd71431c45 (which is behind the
latest),
xserver-xorg  1:7.7+7



Re: [dev] [dwm] Crash when setting window title to a single emoji

2016-08-29 Thread FRIGN
On Mon, 29 Aug 2016 19:56:56 +0200
Markus Unterwaditzer  wrote:

Hey Markus,

> I'm getting crashes with a particular emoji in the window title.
> Enter the following in st/termite/xterm/urxvt (without tmux
> inbetween):
> [...]
> This is my first attempt at debugging anything Xorg-related, not sure
> what else could be important.

I can not reproduce it here.

Cheers

FRIGN

-- 
FRIGN 



Re: [dev] [dwm] Crash when setting window title to a single emoji

2016-08-29 Thread Martin Kühne
On Mon, Aug 29, 2016 at 7:56 PM, Markus Unterwaditzer
 wrote:
> Originally I've experienced this issue when opening the following URL in
> Firefox or Chromium: https://github.com/RustFestEU/conf-2016/issues/2 That 
> page
> has a  tag with that emoji, which then lands in the window title as
> well.

Urm, this page works very well for me on arch+dwm.

· Do you have an explicit UTF-8 locale and generated it as per wiki
instructions?
· Do you have patches applied?
· What font is your config.h set to?

cheers!
mar77i



[dev] [dwm] Crash when setting window title to a single emoji

2016-08-29 Thread Markus Unterwaditzer
Hello,


I'm getting crashes with a particular emoji in the window title. Enter the
following in st/termite/xterm/urxvt (without tmux inbetween):

PROMPT_COMMAND='echo -ne "\x1b]0;\xe2\x9b\x93b\x07"'

dwm's output:

dwm: fatal error: request code=140, error code=16
X Error of failed request:  BadLength (poly request too large or internal 
Xlib length error)
  Major opcode of failed request:  140 (RENDER)
  Minor opcode of failed request:  20 (RenderAddGlyphs)
  Serial number of failed request:  4319
  Current serial number in output stream:  4331

System info:

- I'm using dwm from commit 14343e6, but can reproduce with latest master as
  well. The configuration doesn't seem to matter at all. I can reproduce this
  with any font for the titlebar (I've tried Droid Sans, Terminus, Source Code
  Pro).

- My operating system is ArchLinux, the xorg-server package is at 1.15.2-1. But
  again, this has been happening for quite a while now, there have been a few
  Xorg upgrades inbetween.

Originally I've experienced this issue when opening the following URL in
Firefox or Chromium: https://github.com/RustFestEU/conf-2016/issues/2 That page
has a  tag with that emoji, which then lands in the window title as
well.

This is my first attempt at debugging anything Xorg-related, not sure what else
could be important.

Thanks,
Markus


signature.asc
Description: PGP signature