Hello Bernhard,
thank you for your research and work,
is there any progress on this?
likely i have to test this patch on a VM too like, i dont want to mess
on my workstation at home with these patches.
best regards
kinky nekoboi
Am 23.11.18 um 22:15 schrieb Bernhard Übelacker:
> Dear Maintainer, hello Kinky Nekoboi,
> just tried to reproduce this issue and there is really a crash.
>
> In a minimal buster amd64 qemu VM,
> with installed cantor and cantor-backend-sage packages.
>
> Then follow these steps:
> - start cantor
> - select Sage backend
> - enter in the field below the "Session 1" tab marked with ">>>":
> plot(cos, (-5,5))
> - press "Evaluate Worksheet"
>
>
> ----
>
> The actual crash happens in cantor_sagebackend.so.
> There the version of sagemath is tried to be retrieved by
> executing "/usr/bin/sage -v".
>
> Unfortunately this outputs just an error message, therefore
> is nothing read from stdinput. In the console the output
> "found version: ()" from line 472 is visible.
> This empty line is processed then by a regular expression
> and that is expected to return results on index 1 and 2.
>
>
> benutzer@debian:~$ /usr/bin/sage -v
> /usr/bin/sage: line 16: /src/bin/sage-version.sh: No such file or
> directory
>
>
> (gdb) list sagesession.cpp:462,500
> 462 bool SageSession::updateSageVersion()
> 463 {
> 464 QProcess get_sage_version;
> 465
> get_sage_version.setProgram(SageSettings::self()->path().toLocalFile());
> 466
> get_sage_version.setArguments(QStringList()<<QLatin1String("-v"));
> 467 get_sage_version.start();
> 468 get_sage_version.waitForFinished(-1);
> 469 QString versionString =
> QString::fromLocal8Bit(get_sage_version.readLine());
> 470 QRegularExpression
> versionExp(QLatin1String("(\\d+)\\.(\\d+)"));
> 471 QRegularExpressionMatch version =
> versionExp.match(versionString);
> 472 qDebug()<<"found version: " << version.capturedTexts();
> 473 if(version.isValid())
> 474 {
> 475 int major=version.capturedTexts()[1].toInt();
> 476 int minor=version.capturedTexts()[2].toInt();
>
> ----
>
> The file /usr/bin/sage is a bash script and retrieves the actual version
> by sourcing a file sage-version.sh.
> Unfortunately seems neither SAGE_SCRIPTS_DIR nor SAGE_ROOT set.
>
> ...
> sage_version() {
> if [ -f "$SAGE_SCRIPTS_DIR/sage-version.sh" ]; then
> . "$SAGE_SCRIPTS_DIR/sage-version.sh"
> else
> . "$SAGE_ROOT/src/bin/sage-version.sh"
> fi
> ...
>
>
> Later in that file a file sage-env would be sourced, but with the parameter
> "-v"
> this lines are never reached:
>
> ...
> if [ "$1" = '-v' -o "$1" = '-version' -o "$1" = '--version' ]; then
> sage_version -v
> exit 0
> fi
> ...
> if [ "\"$0\"" = "\"/usr/bin/sage\"" ]; then
> . "/usr/share/sagemath/bin/sage-env" >&2
> else
> . "$0-env" >&2
> fi
> ...
>
> ----
>
> Attached patch moves the sourcing of sage-env above the call to sage_version.
> With that applied cantor successfully can draw and show that plot command.
> But I really cannot estimate what else that could break elsewhere.
>
> ----
>
> I think both issues deserve to be tracked separately:
> - cantor_sagebackend.so should be more robust against the output of
> /usr/bin/sage
> - /usr/bin/sage should report its version
>
>
> Kind regards,
> Bernhard
>
>
> (gdb) bt
> #0 0x00007f97c94617ac in QString::toIntegral_helper<int> (base=10, ok=0x0,
> len=<error reading variable: Cannot access memory at address 0x35>,
> data=<error reading variable: Cannot access memory at address 0x41>) at
> ../../include/QtCore/../../src/corelib/tools/qstring.h:895
> #1 QString::toInt (this=<optimized out>, ok=ok@entry=0x0,
> base=base@entry=10) at tools/qstring.cpp:7078
> #2 0x00007f97c005007d in SageSession::updateSageVersion() () at
> /usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h:115
> #3 0x00007f97c00503f1 in SageSession::login() () at
> ./src/backends/sage/sagesession.cpp:119
> #4 0x00007f97b0042621 in Worksheet::loginToSession
> (this=this@entry=0x55b0052087f0) at ./src/worksheet.cpp:93
> #5 0x00007f97b0042c10 in Worksheet::evaluate() () at ./src/worksheet.cpp:457
> #6 0x00007f97b00387d2 in CantorPart::evaluateOrInterrupt() () at
> ./src/cantor_part.cpp:529
> #7 0x00007f97b00767ed in CantorPart::qt_static_metacall (_o=<optimized out>,
> _id=<optimized out>, _a=<optimized out>, _c=<optimized out>) at
> ./obj-x86_64-linux-gnu/src/cantorpart_autogen/EWIEGA46WW/moc_cantor_part.cpp:207
> #8 0x00007f97c95bb28b in QMetaObject::activate(QObject*, int, int, void**)
> () at kernel/qobject.cpp:3771
> #9 0x00007f97c95bb8a7 in QMetaObject::activate
> (sender=sender@entry=0x55b00525e970, m=m@entry=0x7f97ca3d1840
> <QAction::staticMetaObject>, local_signal_index=local_signal_index@entry=1,
> argv=argv@entry=0x7ffdca3ab9d0) at kernel/qobject.cpp:3633
> #10 0x00007f97c9f01ee2 in QAction::triggered (this=this@entry=0x55b00525e970,
> _t1=<optimized out>) at .moc/moc_qaction.cpp:376
> #11 0x00007f97c9f044f0 in QAction::activate (this=0x55b00525e970,
> event=<optimized out>) at kernel/qaction.cpp:1166
> #12 0x00007f97c9fefc8d in QAbstractButtonPrivate::click (this=0x55b0053538b0)
> at widgets/qabstractbutton.cpp:397
> #13 0x00007f97c9fefec5 in QAbstractButton::mouseReleaseEvent
> (this=0x55b0053533a0, e=0x7ffdca3abea0) at widgets/qabstractbutton.cpp:1011
> #14 0x00007f97ca0d9c0a in QToolButton::mouseReleaseEvent (this=<optimized
> out>, e=<optimized out>) at widgets/qtoolbutton.cpp:622
> #15 0x00007f97c9f467c8 in QWidget::event (this=0x55b0053533a0,
> event=0x7ffdca3abea0) at kernel/qwidget.cpp:8925
> #16 0x00007f97c9ff1103 in QAbstractButton::event
> (this=this@entry=0x55b0053533a0, e=e@entry=0x7ffdca3abea0) at
> widgets/qabstractbutton.cpp:968
> #17 0x00007f97ca0d9cb3 in QToolButton::event (this=0x55b0053533a0,
> event=0x7ffdca3abea0) at widgets/qtoolbutton.cpp:985
> #18 0x00007f97c9f08491 in QApplicationPrivate::notify_helper
> (this=this@entry=0x55b004f5e380, receiver=receiver@entry=0x55b0053533a0,
> e=e@entry=0x7ffdca3abea0) at kernel/qapplication.cpp:3727
> #19 0x00007f97c9f0fd18 in QApplication::notify(QObject*, QEvent*) () at
> kernel/qapplication.cpp:3203
> #20 0x00007f97c9592039 in QCoreApplication::notifyInternal2(QObject*,
> QEvent*) () at
> ../../include/QtCore/5.11.2/QtCore/private/../../../../../src/corelib/thread/qthread_p.h:307
> #21 0x00007f97c9f0f019 in QCoreApplication::sendEvent (event=<optimized out>,
> receiver=<optimized out>) at
> ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:234
> #22 QApplicationPrivate::sendMouseEvent
> (receiver=receiver@entry=0x55b0053533a0, event=event@entry=0x7ffdca3abea0,
> alienWidget=alienWidget@entry=0x55b0053533a0, nativeWidget=0x55b004fa5610,
> buttonDown=buttonDown@entry=0x7f97ca400870 <qt_button_down>,
> lastMouseReceiver=..., spontaneous=true) at kernel/qapplication.cpp:2695
> #23 0x00007f97c9f61304 in QWidgetWindow::handleMouseEvent(QMouseEvent*) () at
> /usr/include/c++/8/bits/atomic_base.h:390
> #24 0x00007f97c9f63e8e in QWidgetWindow::event (this=0x55b005079450,
> event=0x7ffdca3ac2a0) at kernel/qwidgetwindow.cpp:281
> #25 0x00007f97c9f08491 in QApplicationPrivate::notify_helper
> (this=this@entry=0x55b004f5e380, receiver=receiver@entry=0x55b005079450,
> e=e@entry=0x7ffdca3ac2a0) at kernel/qapplication.cpp:3727
> #26 0x00007f97c9f0fad0 in QApplication::notify(QObject*, QEvent*) () at
> kernel/qapplication.cpp:3486
> #27 0x00007f97c9592039 in QCoreApplication::notifyInternal2(QObject*,
> QEvent*) () at
> ../../include/QtCore/5.11.2/QtCore/private/../../../../../src/corelib/thread/qthread_p.h:307
> #28 0x00007f97c993bb2b in QCoreApplication::sendSpontaneousEvent
> (event=0x7ffdca3ac2a0, receiver=0x55b005079450) at
> ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:237
> #29 QGuiApplicationPrivate::processMouseEvent (e=0x55b0051a06f0) at
> kernel/qguiapplication.cpp:2081
> #30 0x00007f97c993da25 in QGuiApplicationPrivate::processWindowSystemEvent
> (e=e@entry=0x55b0051a06f0) at kernel/qguiapplication.cpp:1816
> #31 0x00007f97c9917d8b in QWindowSystemInterface::sendWindowSystemEvents
> (flags=...) at kernel/qwindowsysteminterface.cpp:1032
> #32 0x00007f97c3c5485b in QPAEventDispatcherGlib::processEvents
> (this=0x55b004f9dda0, flags=...) at qeventdispatcher_glib.cpp:70
> #33 0x00007f97c9590d0b in
> QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at
> ../../include/QtCore/../../src/corelib/global/qflags.h:140
> #34 0x00007f97c9598e82 in QCoreApplication::exec() () at
> ../../include/QtCore/../../src/corelib/global/qflags.h:120
> #35 0x000055b004050d17 in main () at ./src/main.cpp:147
> #36 0x00007f97c8fefb17 in __libc_start_main (main=0x55b004050040 <main>,
> argc=1, argv=0x7ffdca3ac7e8, init=<optimized out>, fini=<optimized out>,
> rtld_fini=<optimized out>, stack_end=0x7ffdca3ac7d8) at
> ../csu/libc-start.c:310
> #37 0x000055b0040511ca in _start () at ./src/main.cpp:130
>
>