Bug 121384 - Crash of Writer opening any document with "invalid" python file in home directory (linux)
Summary: Crash of Writer opening any document with "invalid" python file in home direc...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.1.3.2 release
Hardware: All Linux (All)
: medium normal
Assignee: Caolán McNamara
URL:
Whiteboard: target:7.1.0 target:7.0.0.1 target:6....
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-13 09:27 UTC by Konstantin Tkachenko
Modified: 2020-06-23 09:22 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
File, causing LibreOffice crash when lying in home directory (1.84 KB, text/x-python)
2018-11-16 19:30 UTC, Konstantin Tkachenko
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Tkachenko 2018-11-13 09:27:49 UTC
Description:
I've tried to open multiple documents (or create new ones from template) all with the same result - libreoffice crashes and asked me to repair opened documents. Repairing also lead to crash and new question about repairing opened documents.

LibreOffice version 6.0.5 (openSuse Leap 15).
Upgrade to 6.1.3 (from LibreOffice Factory of openSuse Leap 15) haven't fixed the issue.

Starting LibreOffice from a terminal window reported issues loading my "abc.py" file, that I've simply placed in home directory to same some script. This script is not runnable and is not marked as executable at all.
Renaming it to abc.py.bck has fixed an issue with Writer.

I haven't tested, whether another Components are also affected.

Steps to Reproduce:
1. Place some invalid *.py-File in a home directory
2. Try to open some non-empty Writer document.

Actual Results:
LibreOffice crashes and askes me to repair the document.
Repairing leads to crash and the same question (infinite loop)

Expected Results:
no crash


Reproducible: Always


User Profile Reset: No



Additional Info:
Comment 1 Xisco Faulí 2018-11-13 09:46:03 UTC
I can't reproduce it in

Versió: 6.1.3.2
ID de la construcció: 1:6.1.3~rc2-0ubuntu0.16.04.1
Fils de CPU: 4; SO: Linux 4.15; Renderitzador de la IU: per defecte; VCL: gtk3; 
Configuració local: ca-ES (ca_ES.UTF-8); Calc: group threaded

To be certain the reported issue is not
related to corruption in the user profile, could you please reset your
Libreoffice profile ( https://wiki.documentfoundation.org/UserProfile ) and
re-test?

I have set the bug's status to 'NEEDINFO'. Please change it back to
'UNCONFIRMED' if the issue is still present
Comment 2 Konstantin Tkachenko 2018-11-16 19:23:38 UTC
Restarting libreoffice in safe mode didn't helped.
> libreoffice --safe-mode
Fatal Python error: Py_Initialize: can't initialize sys standard streams
Traceback (most recent call last):
  File "/usr/lib64/python3.6/io.py", line 52, in <module>
  File "/home/ktk/abc.py", line 40, in <module>
  File "/home/ktk/abc.py", line 23, in handleFirstArmy
  File "/home/ktk/abc.py", line 12, in findNearestEnemyLimitDistance
NameError: name 'hero' is not defined
Application Error
Comment 3 Konstantin Tkachenko 2018-11-16 19:30:25 UTC
Created attachment 146697 [details]
File, causing LibreOffice crash when lying in home directory
Comment 4 Konstantin Tkachenko 2018-11-16 20:26:50 UTC
Output of my sys.path from python
(using script 
import sys
print('\n'.join(sys.path))
):

/home/ktk
/usr/lib/python36.zip
/usr/lib64/python3.6
/usr/lib64/python3.6/lib-dynload
/usr/lib64/python3.6/site-packages
/usr/lib64/python3.6/_import_failed
/usr/lib/python3.6/site-packages

So the issue is clear. But the solution - not for me.
Why is my home directory in the python search path?
The name of my python file was really unfortunate.
Module abc is imported in the io
Comment 5 Konstantin Tkachenko 2018-11-16 20:36:24 UTC
Starting libreoffice using the icon leads to crash.
Starting libreoffice from any directory other then the home directory works fine (from terminal).
Starting libreoffice from the home directory leads to crash.

It seems for me to be really unlucky to have such a different behavior depending on the working directory and its content.
Is that possible to prevent the python adding current working directory to the sys.path?
Comment 6 Roman Kuznetsov 2018-11-17 14:58:13 UTC
don't confirm in

Версия: 6.2.0.0.alpha1+
ID сборки: 7cf6cee97bc05512fae482733ee45f039e9d2160
Потоков ЦП: 4; ОС:Linux 4.18; Отрисовка ИП: по умолчанию; VCL: kde5; 
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2018-11-04_22:10:34
Локаль: ru-RU (ru_RU.UTF-8); Calc: threaded

Kubuntu 18.10

Konstantin, can you delete LibreOffice from SuSe , install LibreOffice from TDF site and try repeat your problem?
Comment 7 Konstantin Tkachenko 2018-11-19 15:46:44 UTC
I also couldn't reproduce an issue on kubuntu 18.10.
I could reproduce the issue on a new standard opensuse leap 15.0 installation (desktop). After removing libreoffice packages via yast software-module and installing from TDF rpm the issue is not reproducible any more.

Seems to be an issue of opensuse packages.
Comment 8 Roman Kuznetsov 2018-11-19 15:50:53 UTC
Konstantin, thank you. I close this as NotOurBug
Comment 9 Commit Notification 2020-06-19 19:14:49 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/327153471ae38abe90463f6272e00aaa996c5ba3

tdf#121384 don't leave a bare trailing : in PYTHONPATH

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2020-06-20 11:13:58 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-0":

https://git.libreoffice.org/core/commit/448ba86f200942a580bdeaa9e8dff10cd32d86ed

tdf#121384 don't leave a bare trailing : in PYTHONPATH

It will be available in 7.0.0.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Commit Notification 2020-06-20 12:46:11 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-6-4":

https://git.libreoffice.org/core/commit/b72705d5391b849fc70a0a4cac33523c0ea5d054

tdf#121384 don't leave a bare trailing : in PYTHONPATH

It will be available in 6.4.6.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Commit Notification 2020-06-23 09:22:51 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-6-4-5":

https://git.libreoffice.org/core/commit/f463cbd6ea2fd8ab80b812425eb05ae83fa6a426

tdf#121384 don't leave a bare trailing : in PYTHONPATH

It will be available in 6.4.5.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.