Ticket #2712 (closed defect: invalid)

Opened 13 years ago

Last modified 13 years ago

mcedit segfaults on user script

Reported by: Wolverine Owned by:
Priority: critical Milestone: 4.8.2
Component: mcedit Version: master
Keywords: Cc:
Blocked By: Blocking:
Branch state: no branch Votes for changeset:

Description

When trying to use User Menu script in mcedit, segfault occurs. Script is used for block comment/uncomment available here: https://wiki.frugalware.org/index.php/MCedit#Comment_.2F_uncomment_block
gdb throws error on
update_one_panel_widget (which=<value optimized out>, force_update=0, current_file=0xffffffffffffffff <Address 0xffffffffffffffff out of bounds> at screen.c:3534
I am unable to give you more significant details from gdb since ncurses is messing up terminal. mc version is 4.8.1.

Change History

comment:1 follow-up: ↓ 4 Changed 13 years ago by angel_il

please say (step by step) how to reproduce this..

comment:2 Changed 13 years ago by angel_il

i see only

/bin/sh /tmp/mc-holmes/mcusr7SccWD
/tmp/mc-holmes/mcusr7SccWD: 2: Syntax error: "(" unexpected

because script contain bashism

comment:3 in reply to: ↑ description ; follow-up: ↓ 5 Changed 13 years ago by andrew_b

Replying to Wolverine:

gdb throws error on
update_one_panel_widget (which=<value optimized out>, force_update=0, current_file=0xffffffffffffffff <Address 0xffffffffffffffff out of bounds> at screen.c:3534

mc version is 4.8.1.

Really? There is no screen.c in mc code base.

comment:4 in reply to: ↑ 1 Changed 13 years ago by Wolverine

Replying to angel_il:

please say (step by step) how to reproduce this..

What I have done is:

  1. Add the script to /etc/mc/cedit.menu:

[root@razorblade /]# tail -8 /etc/mc/cedit.menu
#-------------------------- End of common section -----------------------------

/ Comment / Uncomment

declare -A cl=( c?='' h?='' pas?='' sql?='--' lua?='--' )
c="${cl[%x]:-#}"
read s < '%b'

"${s:0:${#c}}" == "$c" ? && e="s,^$c"
e="s,^,$c,"

sed -i "$e" "%b"

  1. Run mcedit somefile.txt
  2. Select block with F3, finishing selection with F3 again.
  3. Press F11, choose /
  4. Segfaults

This is what I've got from gdb also:
Program received signal SIGSEGV, Segmentation fault.
update_one_panel_widget (which=<value optimized out>, force_update=0, current_file=0xfffffffffffffff <Address 0xffffffffffffff out of bounds>) at screen.c:3534
3534 my_current_file = g_strdup (panel->dir.list[panel->selected].fname);

My system is Mandriva 2010.2 64 bit.

[root@razorblade Pobrane]# gcc -v
Using built-in specs.
Target: x86_64-manbo-linux-gnu
Configured with: ../configure --prefix=/usr --libexecdir=/usr/lib --with-slibdir=/lib64 --with-bugurl=https://qa.mandriva.com/ --mandir=/usr/share/man --infodir=/usr/share/info --enable-checking=release --enable-languages=c,c++,ada,fortran,objc,obj-c++,java --build=x86_64-manbo-linux-gnu --host=x86_64-manbo-linux-gnu --with-cpu=generic --with-system-zlib --enable-threads=posix --enable-shared --enable-objc-gc --enable-long-long --enable-cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --enable-java-awt=gtk --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-gtk-cairo --disable-libjava-multilib --enable-ssp --disable-libssp --disable-werror --with-ppl --with-cloog --with-python-dir=/lib/python2.6/site-packages
Thread model: posix
gcc version 4.4.3 (GCC)

If you need more information I will try to provide it.

Version 1, edited 13 years ago by andrew_b (previous) (next) (diff)

comment:5 in reply to: ↑ 3 ; follow-up: ↓ 6 Changed 13 years ago by Wolverine

Replying to andrew_b:

Replying to Wolverine:

gdb throws error on
update_one_panel_widget (which=<value optimized out>, force_update=0, current_file=0xffffffffffffffff <Address 0xffffffffffffffff out of bounds> at screen.c:3534

mc version is 4.8.1.

Really? There is no screen.c in mc code base.

I have installed mc-debug package from Mandriva which installs /usr/src/debug/mc/ and there clearly is screen.c file.

EDIT: Nevermind. Mandriva debug packages are screwed and they install 4.7.2 version of mc. I have recompiled 4.8.1 from the source to check it, however my change to /etc/mc/cedit.menu is not visible. I don't know how to test it if the problem still occurs.

Last edited 13 years ago by Wolverine (previous) (diff)

comment:6 in reply to: ↑ 5 ; follow-up: ↓ 7 Changed 13 years ago by andrew_b

Replying to Wolverine:

my change to /etc/mc/cedit.menu is not visible

You should change ~/.config/mc/mcedit/menu or /etc/mc/mcedit.menu. Files in $HOME have higher priority over files in system directories.

Last edited 13 years ago by andrew_b (previous) (diff)

comment:7 in reply to: ↑ 6 ; follow-up: ↓ 9 Changed 13 years ago by Wolverine

Replying to andrew_b:

Replying to Wolverine:

my change to /etc/mc/cedit.menu is not visible

You should change ~/.config/mc/mcedit/menu or /etc/mc/mcedit.menu. Files in $HOME have higher priority over files in system directories.

Thanks a lot guys.

It seems that after recompiling mc and editing properly mcedit.menu it works like charm without any segfaults and the script also works. Had to be Mandriva thing. I suppose this ticket could be closed.

Last edited 13 years ago by andrew_b (previous) (diff)

comment:8 Changed 13 years ago by andrew_b

  • Status changed from new to closed
  • Resolution set to invalid

OK.

Thanks!

comment:9 in reply to: ↑ 7 ; follow-up: ↓ 10 Changed 13 years ago by andrew_b

Replying to Wolverine:

editing properly mcedit.menu

I recommend you do not edit files in /etc/mc. After upgrade, you will lose your changes. Modify files in home dir instead.

comment:10 in reply to: ↑ 9 Changed 13 years ago by Wolverine

Replying to andrew_b:

Replying to Wolverine:

editing properly mcedit.menu

I recommend you do not edit files in /etc/mc. After upgrade, you will lose your changes. Modify files in home dir instead.

Thanks for the tip and keep up good work. mc is really one piece of software I've been using for years now.

Note: See TracTickets for help on using tickets.