texstudio-org / texstudio

TeXstudio is a fully featured LaTeX editor. Our goal is to make writing LaTeX documents as easy and comfortable as possible.
http://www.texstudio.org/
GNU General Public License v3.0
2.82k stars 345 forks source link

SIGSEGV (TXS-Version 0.0.0++ R ) #3826

Closed homocomputeris closed 3 weeks ago

homocomputeris commented 1 month ago

Environment

Expected behavior

Do not crash

Actual behavior

SIGSEGV (TXS-Version 0.0.0++ R )
[bt] /usr/bin/texstudio(_Z15print_backtraceRK7QString+0x4) [0x5f6813b8e5a4]
[bt] /usr/bin/texstudio(_ZN13LatexDocument13getListOfDocsEP4QSetIPS_Eb+0x290) [0x5f68138e8010]
[bt] /usr/bin/texstudio(_ZN13LatexDocument13getListOfDocsEP4QSetIPS_Eb+0x5f7) [0x5f68138e8377]
[bt] /usr/bin/texstudio(_ZN13LatexDocument13getListOfDocsEP4QSetIPS_Eb+0x377) [0x5f68138e80f7]
[bt] /usr/bin/texstudio(_ZN13LatexDocument21handleRescanDocumentsENS_11HandledDataE+0x307) [0x5f68138e55f7]
[bt] /usr/bin/texstudio(_ZN13LatexDocument14patchStructureEiib+0x7b0) [0x5f68138e6820]
[bt] /usr/lib/libQt6Core.so.6(+0x1a36aa) [0x7c2c69ba36aa]
[bt] /usr/bin/texstudio(_ZN16QDocumentPrivate18emitContentsChangeEii+0xef) [0x5f6813b4bd9f]
[bt] /usr/bin/texstudio(_ZN21QDocumentEraseCommand4redoEv+0x15c) [0x5f6813b5ae6c]
[bt] /usr/lib/libQt6Gui.so.6(_ZN10QUndoStack4pushEP12QUndoCommand+0x40) [0x7c2c6a5983c0]
[bt] /usr/bin/texstudio(_ZN21QDocumentCursorHandle18removeSelectedTextEb+0xea) [0x5f6813b35d8a]
[bt] /usr/bin/texstudio(_ZN7QEditor20processEditOperationER15QDocumentCursorPK9QKeyEventNS_13EditOperationE+0xa1) [0x5f6813afee71]
[bt] /usr/bin/texstudio(_ZN7QEditor13keyPressEventEP9QKeyEvent+0x1990) [0x5f6813af45f0]
[bt] /usr/lib/libQt6Widgets.so.6(_ZN7QWidget5eventEP6QEvent+0x864) [0x7c2c6ab4e444]
[bt] /usr/lib/libQt6Widgets.so.6(_ZN6QFrame5eventEP6QEvent+0x38) [0x7c2c6abe5d28]
[bt] /usr/bin/texstudio(_ZN7QEditor5eventEP6QEvent+0x44) [0x5f6813aeda04]
[bt] /usr/lib/libQt6Widgets.so.6(_ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent+0x9c) [0x7c2c6aafd9cc]
[bt] /usr/lib/libQt6Widgets.so.6(_ZN12QApplication6notifyEP7QObjectP6QEvent+0x1392) [0x7c2c6ab031f2]
[bt] /usr/lib/libQt6Core.so.6(_ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent+0x158) [0x7c2c69b45be8]
[bt] /usr/lib/libQt6Widgets.so.6(+0x166126) [0x7c2c6ab66126]
[bt] /usr/lib/libQt6Widgets.so.6(_ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent+0x9c) [0x7c2c6aafd9cc]
[bt] /usr/lib/libQt6Core.so.6(_ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent+0x158) [0x7c2c69b45be8]
[bt] /usr/lib/libQt6Gui.so.6(_ZN22QGuiApplicationPrivate15processKeyEventEPN29QWindowSystemInterfacePrivate8KeyEventE+0x264) [0x7c2c6a179fc4]
[bt] /usr/lib/libQt6Gui.so.6(_ZN22QWindowSystemInterface22sendWindowSystemEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE+0x304) [0x7c2c6a1e7d24]
[bt] /usr/lib/libQt6Gui.so.6(+0x605734) [0x7c2c6a605734]
[bt] /usr/lib/libglib-2.0.so.0(+0x5d559) [0x7c2c68d0d559]
[bt] /usr/lib/libglib-2.0.so.0(+0xc0157) [0x7c2c68d70157]
[bt] /usr/lib/libglib-2.0.so.0(g_main_context_iteration+0x35) [0x7c2c68d0ca55]
[bt] /usr/lib/libQt6Core.so.6(_ZN20QEventDispatcherGlib13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE+0x8d) [0x7c2c69da985d]
[bt] /usr/lib/libQt6Core.so.6(_ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE+0x1a6) [0x7c2c69b50106]
[bt] /usr/lib/libQt6Core.so.6(_ZN16QCoreApplication4execEv+0x8d) [0x7c2c69b4a27d]
[bt] /usr/bin/texstudio(main+0x17d) [0x5f681373990d]
[bt] /usr/lib/libc.so.6(+0x25e08) [0x7c2c69434e08]
[bt] /usr/lib/libc.so.6(__libc_start_main+0x8c) [0x7c2c69434ecc]

How to reproduce

Not sure. I'm trying to type \include{../common/config.tex} and it crashes (seems not the case, though).

homocomputeris commented 1 month ago
SIGSEGV (TXS-Version 0.0.0++ R )
[bt] /usr/bin/texstudio(_Z15print_backtraceRK7QString+0x4) [0x63f4901345a4]
[bt] /usr/bin/texstudio(_ZN13LatexDocument13getListOfDocsEP4QSetIPS_Eb+0x41) [0x63f48fe8ddc1]
[bt] /usr/bin/texstudio(_ZN13LatexDocument13getListOfDocsEP4QSetIPS_Eb+0x5f7) [0x63f48fe8e377]
[bt] /usr/bin/texstudio(_ZN13LatexDocument13getListOfDocsEP4QSetIPS_Eb+0x377) [0x63f48fe8e0f7]
[bt] /usr/bin/texstudio(_ZN9Texstudio9fileCloseEv+0xc4) [0x63f48ffd7274]
[bt] /usr/lib/libQt6Core.so.6(+0x1a36aa) [0x77906d7a36aa]
[bt] /usr/lib/libQt6Core.so.6(+0x1a36aa) [0x77906d7a36aa]
[bt] /usr/bin/texstudio(_ZN12TxsTabWidget17onTabCloseRequestEi+0x7d) [0x63f490048acd]
[bt] /usr/lib/libQt6Core.so.6(+0x1a36aa) [0x77906d7a36aa]
[bt] /usr/lib/libQt6Widgets.so.6(+0x33b31f) [0x77906e93b31f]
[bt] /usr/lib/libQt6Core.so.6(+0x1a36aa) [0x77906d7a36aa]
[bt] /usr/lib/libQt6Widgets.so.6(_ZN14QTabBarPrivate8closeTabEv+0xd4) [0x77906e9137e4]
[bt] /usr/lib/libQt6Core.so.6(+0x1a3457) [0x77906d7a3457]
[bt] /usr/lib/libQt6Widgets.so.6(+0x211deb) [0x77906e811deb]
[bt] /usr/lib/libQt6Widgets.so.6(+0x2122e8) [0x77906e8122e8]
[bt] /usr/lib/libQt6Widgets.so.6(_ZN15QAbstractButton17mouseReleaseEventEP11QMouseEvent+0xde) [0x77906e81ed8e]
[bt] /usr/lib/libQt6Widgets.so.6(_ZN7QWidget5eventEP6QEvent+0xc36) [0x77906e74e816]
[bt] /usr/lib/libQt6Widgets.so.6(_ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent+0x9c) [0x77906e6fd9cc]
[bt] /usr/lib/libQt6Widgets.so.6(_ZN12QApplication6notifyEP7QObjectP6QEvent+0x10f9) [0x77906e702f59]
[bt] /usr/lib/libQt6Core.so.6(_ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent+0x158) [0x77906d745be8]
[bt] /usr/lib/libQt6Widgets.so.6(_ZN19QApplicationPrivate14sendMouseEventEP7QWidgetP11QMouseEventS1_S1_PS1_R8QPointerIS0_Ebb+0x23c) [0x77906e6f507c]
[bt] /usr/lib/libQt6Widgets.so.6(+0x164b02) [0x77906e764b02]
[bt] /usr/lib/libQt6Widgets.so.6(+0x166160) [0x77906e766160]
[bt] /usr/lib/libQt6Widgets.so.6(_ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent+0x9c) [0x77906e6fd9cc]
[bt] /usr/lib/libQt6Core.so.6(_ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent+0x158) [0x77906d745be8]
[bt] /usr/lib/libQt6Gui.so.6(_ZN22QGuiApplicationPrivate17processMouseEventEPN29QWindowSystemInterfacePrivate10MouseEventE+0x7e5) [0x77906dd78695]
[bt] /usr/lib/libQt6Gui.so.6(_ZN22QWindowSystemInterface22sendWindowSystemEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE+0x304) [0x77906dde7d24]
[bt] /usr/lib/libQt6Gui.so.6(+0x605734) [0x77906e205734]
[bt] /usr/lib/libglib-2.0.so.0(+0x5d559) [0x77906c90d559]
[bt] /usr/lib/libglib-2.0.so.0(+0xc0157) [0x77906c970157]
[bt] /usr/lib/libglib-2.0.so.0(g_main_context_iteration+0x35) [0x77906c90ca55]
[bt] /usr/lib/libQt6Core.so.6(_ZN20QEventDispatcherGlib13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE+0x8d) [0x77906d9a985d]
[bt] /usr/bin/texstudio(_ZN9Texstudio16recoverFromCrashEv+0xcb0) [0x63f49001e0e0]
[bt] /usr/bin/texstudio(_ZNK13LatexDocument15getRootDocumentEP4QSetIPKS_Eb+0x6d9) [0x63f48fe97e99]
[bt] /usr/bin/texstudio(_ZNK13LatexDocument19getAbsoluteFilePathERK7QStringS2_RK5QListIS0_E+0x59) [0x63f48fea2db9]
[bt] /usr/bin/texstudio(_ZNK14LatexDocuments12findDocumentERK7QStringb+0x171) [0x63f48fe99501]
[bt] /usr/bin/texstudio(_ZN9Texstudio4loadERK7QStringbbb+0xb58) [0x63f48ffcf1a8]
[bt] /usr/bin/texstudio(_ZN9Texstudio22gotoLogEntryEditorOnlyEi+0x168) [0x63f4900099d8]
[bt] /usr/lib/libQt6Core.so.6(+0x1a36aa) [0x77906d7a36aa]
[bt] /usr/bin/texstudio(_ZN14LatexLogWidget12gotoLogEntryEi+0x7c) [0x63f48feebf1c]
[bt] /usr/lib/libQt6Core.so.6(+0x1a36aa) [0x77906d7a36aa]
[bt] /usr/lib/libQt6Widgets.so.6(_ZN17QAbstractItemView17mouseReleaseEventEP11QMouseEvent+0x578) [0x77906e9e31b8]
[bt] /usr/lib/libQt6Widgets.so.6(_ZN7QWidget5eventEP6QEvent+0xc36) [0x77906e74e816]
[bt] /usr/lib/libQt6Widgets.so.6(_ZN6QFrame5eventEP6QEvent+0x38) [0x77906e7e5d28]
[bt] /usr/lib/libQt6Core.so.6(_ZN23QCoreApplicationPrivate29sendThroughObjectEventFiltersEP7QObjectP6QEvent+0x118) [0x77906d745058]
[bt] /usr/lib/libQt6Widgets.so.6(_ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent+0x8c) [0x77906e6fd9bc]
[bt] /usr/lib/libQt6Widgets.so.6(_ZN12QApplication6notifyEP7QObjectP6QEvent+0x10f9) [0x77906e702f59]
[bt] /usr/lib/libQt6Core.so.6(_ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent+0x158) [0x77906d745be8]
sunderme commented 1 month ago

a test case is needed

homocomputeris commented 1 month ago

I think I figured it out:

  1. Create a file, say, main.tex
  2. Add magic comment with root=main.tex
  3. Rename the file to something like file.tex
  4. Do not update the magic comment.
  5. Try to compile: some file like /tmp/main_Sgdjk.tex will be compiled instead of file.tex.
  6. Try to include something like \include{../file/text.tex}
  7. TXS will likely crash
sunderme commented 1 month ago

clarification needed: "Rename the file to something like file.tex", how ? in terminal ?

sunderme commented 1 month ago

I have seen and fixed "a" crash. Can you try latest dev build / master ?

homocomputeris commented 1 month ago

clarification needed: "Rename the file to something like file.tex", how ? in terminal ?

In any way. You just need to have a name that differs from the magic comment in the file.

My assumptions is that when TXS puts a mismatching pseudo-root into /tmp/, \input{../config/whatever} tries to read/write from / and fails without permissions.

homocomputeris commented 1 month ago

Can you try latest dev build / master ?

That's a bit painful on Arch, but I'll try.

sunderme commented 1 month ago

Can you try latest dev build / master ?

That's a bit painful on Arch, but I'll try.

how is it painful ? You can easily compile ?

sunderme commented 3 weeks ago

assume fixed