View previous topic :: View next topic |
Author |
Message |
BlackBart Apprentice


Joined: 07 Oct 2002 Posts: 252
|
Posted: Sat Feb 22, 2003 5:33 am Post subject: less gives segmentation fault |
|
|
whenever I try to use less to look at a file I get a "segmentation fault" I tried recompiling with -O2 and it didn't help. |
|
Back to top |
|
 |
Gio n00b


Joined: 01 Jul 2002 Posts: 19 Location: Wheaton, IL USA
|
Posted: Sat Feb 22, 2003 11:21 am Post subject: |
|
|
Hmmm... last time I saw that (and it was a while ago) it had to do with having the language stuff (locale) set up correctly. Check that LANG and LC_ALL and all that are set correctly. You can alse run an strace, as in Code: | strace -f -o lesstrc less /etc/fstab | It'll output a text file called "lesstrc" that you can browse (or edit, since less is broken) and that'll let you see if less is having trouble loading a dll, for example. Also, you can compile less with debug (-g), issue aand run less - now when it segfaults it'll write a non-text file called "core". You can load that with Code: | gdb --core core /usr/bin/less | and then use the "bt" (backtrace) command to find out what routines it was in when it broke - sometimes the name of the routines will help point you to the problem. (Please forgive if this is all either "obvious" or at too low a level - it's pretty much what I do when a simple package gives me grief.)  |
|
Back to top |
|
 |
BlackBart Apprentice


Joined: 07 Oct 2002 Posts: 252
|
Posted: Sun Feb 23, 2003 2:18 am Post subject: |
|
|
I don't have gdb or strace, what package do they come in? Also where do I set LANG and LC_ALL? |
|
Back to top |
|
 |
Gio n00b


Joined: 01 Jul 2002 Posts: 19 Location: Wheaton, IL USA
|
Posted: Sun Feb 23, 2003 3:27 pm Post subject: |
|
|
That'd be sys-devel/gdb-5.3 and dev-util/strace-4.4.93 in their latest incarnations...
BTW, you can do "qpkg -v gdb" and find all the versions of gdb (or any other package).
LANG and LC_ALL are shell environment variables. In the default shell, which I believe is bash, there'll be a file called .bashrc in your home directory - edit that with your favorite editor to contain:
Code: | export LANGUAGE=en_US
export LANG=en_US
export LC_ALL=en_US
|
(use your language of choice, of course - the languages are in /usr/share/locale)
If you're set up with a different shell you'll need to do it a little differently - the chsh command will let you display (and/or change) your current shell. |
|
Back to top |
|
 |
BlackBart Apprentice


Joined: 07 Oct 2002 Posts: 252
|
Posted: Sun Feb 23, 2003 7:45 pm Post subject: |
|
|
ok, it spontaneously started working again, but this time only after I source /etc/profile. furthermore it works if I invoke less 'less -r'. Also it is now working if I run it from a terminal (not a shell like xterm or konsole). |
|
Back to top |
|
 |
BlackBart Apprentice


Joined: 07 Oct 2002 Posts: 252
|
Posted: Mon Feb 24, 2003 1:12 am Post subject: |
|
|
ok, I restarted it stopped working from the terminal but it works just as long as I pass any parameter to it. I can post the strace if you want. |
|
Back to top |
|
 |
Gio n00b


Joined: 01 Jul 2002 Posts: 19 Location: Wheaton, IL USA
|
Posted: Mon Feb 24, 2003 12:18 pm Post subject: |
|
|
Hmmm - one thing /etc/profile does is source /etc/profile.env - there's a pair of settings in there from /etc/env.d/00basic and /etc/env.d/70less - on my system they're set to
Code: |
export LESS='-R'
export LESSOPEN='|lesspipe.sh %s'
|
Less also uses ncurses - and that's using the terminfo database (though I wouldn't expect a segfault if that was setup wrong).
If you like, email me the strace and I'll take a look (rather than posting it - it's usually a lot of text). |
|
Back to top |
|
 |
|