[FIXED] Texmacs crashes when executing macro

Dear all,

Texmacs crashes when executing the “extract” macro which I define with

<assign|extract|<macro|lab|<range|<arg|lab>|1|2>>>

I sent the same message about two months ago to the mailing list without receiving an answer, so I try again (I have submitted a bug report on Savannah). Could someone tell me if it is a trivial mistake on my part? Or if they can reproduce the crash? I would like to play a bit with macros and I need simple ones to work :slight_smile:

1 Like

Can you provide step by step guide to reproduce it?

<assign|extract|<macro|lab|<range|<arg|lab>|1|2>>>

BTW, this is the Savannah link:
https://savannah.gnu.org/bugs/?55830

Here are the steps:

  1. Create a new document
  2. Load as a style file the file I uploaded in Savannah (contain the “extract” macro, or put the “extract” macro in the file and execute it.
  3. Type in the document \extract, then press return
    Now TeXmacs on my computer crashes. I have tested it with Linux too, there I get error messages in the terminal window, which I could post here/ add to the bug report.

I got it. This is the crash on my Debian Sid.

TeXmacs] With linked TrueType support
Throwing segmentation fault
-------------------------------------------------
Error message:
  segmentation fault

System information:
  TeXmacs version  : 1.99.9
  Built by         : sadhen
  Building date    : 2011-04-08T21:21:31
  Operating system : linux-gnu
  Vendor           : pc
  Processor        : x86_64
  Crash date       : 2019年 05月 20日 星期一 21:28:22 HKT

Editor status:
  Root path          : [ 0 ]
  Current path       : [ 0, 0, 0, 0 ]
  Shifted path       : [ 0, 0, 0, 0 ]
  Physical selection : [ 0, 0, 0, 0, 7 ] -- [ 0, 0, 0, 0, 7 ]

Backtrace of C++ stack:
  texmacs.bin : () + 0x24790f
  texmacs.bin : () + 0x11eb62
  texmacs.bin : () + 0xec40c
  /lib/x86_64-linux-gnu/libc.so.6 : () + 0x37840
  texmacs.bin : () + 0x215e44
  texmacs.bin : () + 0x2ad574
  texmacs.bin : () + 0x2aa3dc
  texmacs.bin : () + 0x2be2b7
  texmacs.bin : () + 0x2c2432
  texmacs.bin : () + 0x931722
  texmacs.bin : () + 0x931936
  texmacs.bin : () + 0x8f9aa2
  texmacs.bin : () + 0xa8f12f
  texmacs.bin : () + 0xa8fa1e
  texmacs.bin : () + 0xa99bf8
  texmacs.bin : () + 0xa8fa1e
  texmacs.bin : () + 0xa9dfaa
  texmacs.bin : () + 0xa8fa1e
  texmacs.bin : () + 0x8fb725
  texmacs.bin : () + 0x8fbae3
  texmacs.bin : () + 0x8fcf99
  texmacs.bin : () + 0x6a25f5
  texmacs.bin : () + 0x6a31a7
  texmacs.bin : () + 0x6d594d
  texmacs.bin : () + 0x249a37
  texmacs.bin : () + 0x248569
  texmacs.bin : () + 0x3eeaf4
  texmacs.bin : () + 0x9f2559
  texmacs.bin : () + 0x41edc5
  /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 : QMetaObject::activate(QObject*, int, int, void**) + 0x766
  /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 : QTimer::timeout(QTimer::QPrivateSignal) + 0x37
  /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 : QObject::event(QEvent*) + 0x9b
  /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 : QApplicationPrivate::notify_helper(QObject*, QEvent*) + 0x81
  /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 : QApplication::notify(QObject*, QEvent*) + 0x210
  texmacs.bin : () + 0x42275a
  /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 : QCoreApplication::notifyInternal2(QObject*, QEvent*) + 0x179
  /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 : QTimerInfoList::activateTimers() + 0x428
  /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 : () + 0x2bb4d4
  /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 : g_main_context_dispatch() + 0x2ae
  /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 : () + 0x4e1c8
  /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 : g_main_context_iteration() + 0x2c
  /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 : QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 0x63
  /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5 : () + 0xdd3e1
  /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 : QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 0x13b
  /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 : QCoreApplication::exec() + 0x92
  texmacs.bin : () + 0x3ed6ac
  texmacs.bin : () + 0x3ed6f8
  texmacs.bin : () + 0xef7fd
  texmacs.bin : () + 0x142724
  /usr/lib/libguile.so.17 : () + 0x62b5f
  /usr/lib/libguile.so.17 : () + 0x3b2ea
  /usr/lib/libguile.so.17 : scm_c_catch() + 0x127
  /usr/lib/libguile.so.17 : scm_i_with_continuation_barrier() + 0x98
  /usr/lib/libguile.so.17 : scm_c_with_continuation_barrier() + 0x30
  /usr/lib/libguile.so.17 : scm_i_with_guile_and_parent() + 0x28
  /usr/lib/libguile.so.17 : scm_boot_guile() + 0x25
  texmacs.bin : () + 0x142779
  texmacs.bin : () + 0xf1873
  /lib/x86_64-linux-gnu/libc.so.6 : __libc_start_main() + 0xeb
  texmacs.bin : () + 0xec33a

-------------------------------------------------
terminate called after throwing an instance of 'string'
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = texmacs.bin path = /usr/lib/texmacs/TeXmacs/bin pid = 19845
KCrash: Arguments: /usr/lib/texmacs/TeXmacs/bin/texmacs.bin 
KCrash: Attempting to start /usr/lib/x86_64-linux-gnu/libexec/drkonqi from kdeinit
sock_file=/run/user/1000/kdeinit5__0
[1]  + 19845 suspended (signal)  texmacs

It seems a problem with the range macro not checking the available range. When you activate the macro the initial value for arg is empty so range has problems with it. One solution I found is not to allow the interactive editing of the parameter (which in this case makes no sense since anyway you will only see part of the value) by using the declaration:

<drd-props|extract|accessible|none>

after this, when you type the macro you will allow to enter the parameter when it is still deactivated (and then press enter to activate), and this will solve the problem if you give a nontrivial argument. E.g.

<extract|pippo>

works for me. However I agree that the program should not crash.

1 Like

It works nicely, thanks a lot. I think now I will be able to build up the macro that I have in mind, that is a macro that formats references according to simple rules based on the label; so that it is similar to the prettyref macro of LaTeX.

Perhaps later I will add in the macro checks for the input too, at the moment I am at an elementary stage.

1 Like

Anyway I think a macro should not crash TeXmacs, better maybe file a bug report anyway, just to keep track of the problem.

Already filed (see link above, copied again here)

Maybe I can add the crash information that Darcy posted. More than maybe, I will do it.

I fixed this issue in https://github.com/texmacs/texmacs/pull/17

1 Like

Thanks for you Pull Request. @marduk

For your other pull requests, I need some time to verify the correctness. Please be patient.

I only code for TeXmacs on weekends.

What is the status of these PR? Shall I give a look?

I’ve apply it several months ago.

1 Like