Re: [dwm] problem with dmenu3.1

From: Jukka Salmi <j+dwm_AT_2007.salmi.ch>
Date: Wed, 23 May 2007 13:14:12 +0200

Jukka Salmi --> dwm (2007-05-23 10:53:21 +0200):
> Frank Pirnay --> dwm (2007-05-23 09:16:45 +0200):
> > I thought about broken hardware too... I will try some memtesting today.
>
> That's probably a good idea.
>
>
> > Anyway, this is my output:
> >
> > + CACHE=/home/knarf/.dmenu_cache
> > + UPTODATE=1
> > + IFS=:
> > + test ! -f /home/knarf/.dmenu_cache
> > + test 1
> > + test /home/knarf/bin -nt /home/knarf/.dmenu_cache
> > + test /usr/local/sbin -nt /home/knarf/.dmenu_cache
> > + test /usr/local/bin -nt /home/knarf/.dmenu_cache
> > + unset UPTODATE
> > + test /usr/sbin -nt /home/knarf/.dmenu_cache
> > + test /usr/bin -nt /home/knarf/.dmenu_cache
> > + unset UPTODATE
> > + test /sbin -nt /home/knarf/.dmenu_cache
> > + test /bin -nt /home/knarf/.dmenu_cache
> > + unset UPTODATE
> > + test /usr/games -nt /home/knarf/.dmenu_cache
> > + test !
> > Segmentation fault
> >
> > The segfault always happens at this place. Any ideas?
>
> What is /bin/sh on that system? In case it a symlink to /bin/bash:
> what bash version is this? If it's another shell: what test(1) is it
> using, e.g. a shell builtin or an external command?
>
> Try replacing line 19 of dmenu_path with
>
> if test -n $UPTODATE
>
> In case the segfault still occurs, try quoting $UPTODATE on line 19,
> i.e.
>
> if test ! "$UPTODATE"
>
> or
>
> if test -n "$UPTODATE"
>
> Does any of this help?

I'm able to reproduce this problem with a bourne shell on some BSD
systems; it seems to be a bug in the test(1) code. Maybe you were
bitten by the same bug.

To make dmenu_path more robust against such problems I'd recommend the
attached patch. Furthermore it speeds up execution time a little bit
in case the cache has to be rebuilt because of a changed directory
(unless it the last directory in the $PATH).

Regards, Jukka

-- 
bashian roulette:
$ ((RANDOM%6)) || rm -rf ~

Received on Wed May 23 2007 - 13:14:13 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:42:21 UTC