Bug 101898 - Saving a presentation hangs, if username is a substring of "username"
Summary: Saving a presentation hangs, if username is a substring of "username"
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: framework (show other bugs)
Version:
(earliest affected)
5.2.0.0.alpha0+
Hardware: All Linux (All)
: high critical
Assignee: Stephan Bergmann
URL:
Whiteboard: target:5.3.0 target:5.2.3
Keywords: dataLoss, haveBacktrace, needsDevAdvice, regression
: 102252 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-09-04 23:03 UTC by Ofir
Modified: 2016-09-27 14:29 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
gdb backtrace from LO 5.3.0.0.alpha0 (25.53 KB, text/plain)
2016-09-13 20:44 UTC, Ofir
Details
strace.log from simpress --strace (9.46 MB, text/x-log)
2016-09-18 21:20 UTC, E. Wayne Johnson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ofir 2016-09-04 23:03:46 UTC
When trying to save en empty odp presentation under Ubuntu, the cpu goes to almost 100% and Impress get stuck. This happen with an empty presentation:
1. Open Impress with the default empty presentation.
2. Click on save.

This is a regression.

The default LibreOffice version installed on Ubuntu 16.04 works fine:
Version: 5.1.4.2
Build ID: 1:5.1.4-0ubuntu1
CPU Threads: 1; OS Version: Linux 4.4; UI Render: default; 
Locale: en-US (en_US.UTF-8)

Saving a presentation hangs when upgrading to 5.2.1.2 from the ppa ppa:libreoffice/libreoffice-5-2
Version: 5.2.1.2
Build ID: 1:5.2.1~rc2-0ubuntu1~xenial0
CPU Threads: 1; OS Version: Linux 4.4; UI Render: default; 
Locale: en-US (en_US.UTF-8); Calc: group

I'm using fresh Ubuntu 16.04 64bit as a VirtualBox guest with 1 CPU and 2048MB RAM.
Possibly related to this environment.
Comment 1 Jean-Baptiste Faure 2016-09-05 04:56:14 UTC
I do not reproduce with Version: 5.2.2.0.0+
Build ID: 36ee7be1e3e34b8eb07de1fc5e7f9f3681e58173
Threads CPU : 4; Version de l'OS :Linux 4.4; UI Render : par défaut; 
Ubuntu_16.04_x86-64
Locale : fr-FR (fr_FR.UTF-8); Calc: single

built at home.

Best regards. JBF
Comment 2 steve 2016-09-05 06:40:59 UTC
no repro
Version: 5.2.1.1
Build-ID: 4afc24bb8402fb220914e41da1503f86441578cb
CPU-Threads: 8; BS-Version: Mac OS X 10.11.6; UI-Render: Standard; 
Gebietsschema: de-DE (de.UTF-8); Calc: group
Comment 3 Aron Budea 2016-09-05 06:50:11 UTC
No hang for me, also Ubuntu 16.04 in VM (VMWare Player):

Version: 5.2.1.2
Build ID: 31dd62db80d4e60af04904455ec9c9219178d620
CPU Threads: 1; OS Version: Linux 4.4; UI Render: default; 
Locale: en-US (en_US.UTF-8); Calc: group
Comment 4 Ofir 2016-09-05 09:06:32 UTC
Thank you for trying to reproduce.

A screencast showing that Impress hangs when trying to save a presentation:
https://drive.google.com/open?id=0B0odzw1WMqkGcXRSaDFjNkVFVlk

This is how I'm installing LibreOffice 5.2 from the ppa on a clean Ubuntu 16.04 installation under virtualbox:

sudo apt-get remove --purge libreoffice*
sudo apt-get autoremove
sudo add-apt-repository ppa:libreoffice/libreoffice-5-2
sudo apt-get update
sudo apt-get install libreoffice
Comment 5 Ofir 2016-09-07 15:18:20 UTC
I have the same problem with a daily build of Ubuntu 16.10 installed as a  VirtualBox guest. It has LibreOffice 5.2.1-rc2 installed by default.

Can someone please test on Ubuntu 16.04 or 16.10 as a VirtualBox guest (Windows 7 host)?

Version: 5.2.1.2
Build ID: 1:5.2.1~rc2-0ubuntu1
CPU Threads: 1; OS Version: Linux 4.4; UI Render: default; 
Locale: en-US (en_IL); Calc: group
Comment 6 Ofir 2016-09-13 20:44:49 UTC
Created attachment 127318 [details]
gdb backtrace from LO 5.3.0.0.alpha0

Added gdb backtrace from the nightly debug version after impress freeze when saving a presentation.

Version: 5.3.0.0.alpha0+
Build ID: b570fa88adb005ce0868fdefe5d94489dcd00c93
CPU Threads: 1; OS Version: Linux 4.4; UI Render: default; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF-dbg, Branch:master, Time: 2016-09-13_01:29:54
Locale: en-US (en_IL); Calc: group
Comment 7 Markus Mohrhard 2016-09-13 20:52:41 UTC
The interesting part is:

#0  0x00007ffff7b68423 in rtl_ustr_indexOfStr_WithLength (
    pStr=0x7fffa0722010 u"$(inst)/share/palette%3B$($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($($("..., nStrLen=94344, pSubStr=0x7fffd6ae8ef8 u"file:///home/user/Downloads/LibreOfficeDev_5.3.0.0.alpha0_Linux_x86-64_archive/program/../program", nSubLen=97)
    at /home/buildslave/source/libo-core/sal/rtl/strtmpl.cxx:513
#1  0x00007fffc39743f4 in rtl::OUString::indexOf (this=0x7fffffff9180, str=..., fromIndex=0) at /home/buildslave/source/libo-core/include/rtl/ustring.hxx:1879
#2  0x00007fffc3a44f13 in (anonymous namespace)::SubstitutePathVariables::impl_reSubstituteVariables (this=0x7ffff7ebd888, rURL=...)
    at /home/buildslave/source/libo-core/framework/source/services/substitutepathvars.cxx:1095
#3  0x00007fffc3a43906 in (anonymous namespace)::SubstitutePathVariables::reSubstituteVariables (this=0x7ffff7ebd888, aText=...)
    at /home/buildslave/source/libo-core/framework/source/services/substitutepathvars.cxx:778


The question is where the ($ repetition in pStr is coming from.
Comment 8 E. Wayne Johnson 2016-09-18 20:47:05 UTC
I see the same behaviour with Slackware64 -current and lo5.2 and lo5.3.  Cpu goes to 100% in one core and impress hangs when saving as .odp

occurs whether presentation is empty, old, new, pictures and text or text only.
Comment 9 E. Wayne Johnson 2016-09-18 21:20:20 UTC
Created attachment 127418 [details]
strace.log from simpress --strace
Comment 10 Aron Budea 2016-09-18 21:57:43 UTC
(In reply to Markus Mohrhard from comment #7)
> The question is where the ($ repetition in pStr is coming from.

There's this for loop at #2:
http://opengrok.libreoffice.org/xref/core/framework/source/services/substitutepathvars.cxx#1086

Inside that, there's this substitution which is responsible for the "$(...)" chains:
http://opengrok.libreoffice.org/xref/core/framework/source/services/substitutepathvars.cxx#1137

On my Windows system:
-'m_aReSubstUserVarOrder' is empty,
-'m_aReSubstFixedVarOrder' contains twin vectors, one with stuff like $(inst), $(prog), $(user) etc., and the other contains corresponding directories,
-initial aURL is "file:///D:/sources/libreoffice/instdir/program/../share/palette%3Bfile:///D:/sources/libreoffice/instdir/user/config/standard.sob",
-substituted aURL (at return statement) is "$(inst)/share/palette%3B$(user)/config/standard.sob"

I assume there's an infinite recursion during substitution of user variables (I'm not sure where they're coming from). The content of 'm_aReSubstUserVarOrder' and the initial value of 'aURL' would be interesting.

While normally one could limit recursion to a sensible number, in this case the substitution might be completely bogus.

Confirming bug report based on bug 102252.
Comment 11 Aron Budea 2016-09-18 22:06:13 UTC
*** Bug 102252 has been marked as a duplicate of this bug. ***
Comment 12 Aron Budea 2016-09-18 22:12:35 UTC
Also, the recursive code's been there for some time, so it's not the direct cause of this regression.

Ofir, Wayne, thanks for your help with this issue so far.
Can either of you check if this bug was already present in v5.2.0.4 (or any 5.2 beta/prerelease version)? LibreOffice can easily be installed separately from the existing installation, as describted in [1].

If it's consistently reproducible in a recent version, and not in some previous version, bibisecting would be an option to find when this bug was introduced [2].

[1] https://wiki.documentfoundation.org/Installing_in_parallel
[2] https://wiki.documentfoundation.org/QA/Bibisect
Comment 13 E. Wayne Johnson 2016-09-18 22:29:45 UTC
Aron, will try to help more later today.
Note that for me, the problem occurred after a upgrade to Slackware64-current
which included a kernel upgrade from 4.19 to 4.20, but others using LO5.2.12 with this -current upgrade report no issues.  I was using 5.3.x before and after the problem occurred, and reinstalled the OS on a reformatted /  root and tried other 5's with no success.

I have a 5.1.x i can try and will download the 5.2 you suggest later today.
Comment 14 Aron Budea 2016-09-18 23:58:40 UTC
So on first look it seems the issue isn't tied to LibreOffice version.
Bibisecting is probably a dead end.
Comment 15 E. Wayne Johnson 2016-09-19 07:16:40 UTC
Aron,
I had a 5.2.0.2 that I had used 19 July 2016 successfully and later upgraded to 5.3.x which also worked fine until recently.

Version: 5.2.0.2
Build ID: a7567a46e5d2953c320b13eb88a3981c4f9bd1e0
CPU Threads: 8; OS Version: Linux 4.4; UI Render: default; 
Locale: en-US (en_US.UTF-8)

It does not work now.
Comment 16 Xisco Faulí 2016-09-19 15:29:45 UTC Comment hidden (obsolete)
Comment 17 Aron Budea 2016-09-21 01:53:45 UTC
Resetting status so developer assistance can be properly requested.
Comment 18 E. Wayne Johnson 2016-09-21 04:43:13 UTC
Is it really an unconfirmed bug?

No doubt there is something "special" about the strucure of my system and that of the other guy who reported it but it is likely that others out there have the same experience as me.

It's a rather irritating bug because if one doesnt take care to manage the autosave properties of LibreOffice the little feller will try to save for you and hang the system which can be, uh, less than desirable when the net effect is appropriately analyzed.

It's an excuse for superfluity of profanity if one is seeking such things.
Comment 19 Cor Nouws 2016-09-21 12:55:27 UTC
I think this problem is linked with the Ubuntu ppa for version 5.2.1.x
So NotOurBug?
Comment 20 E. Wayne Johnson 2016-09-21 14:52:40 UTC
I have experienced this bug with Slackware 14.2 stable and -current and with LibreOffice 5.2.X and LibreOffice 5.3.x from the LO site, from Eric Hameleer's packages, and from SlackBuilds that build and install LO 5.2.1.2 from source.  it is not an Ubuntu problem and it seems it is not a Slackware problem per se, either.
Comment 21 E. Wayne Johnson 2016-09-22 16:47:39 UTC
I cleared out a new partition on my hard drive and installed Arch Linux.

I then installed among other things LibreOffice-fresh which is 5.2.1.2.

It gave me the hang on save in Impress!!!

I then Removed LibreOffice-fresh (5.2.1.2) with the pacman tool in arch.

I immediately installed LibreOffice-still (5.1.5).

The save error is gone!!!!  LibreOffice works again!!!

Yay! and Hurrah! and mama gotta honda wanna kawasaki de Hallelujah!!!

Ok it's bibisected that far.  5.2.0.2 has the problem 5.1.5 does not.

Please take it from here.
Comment 22 Aron Budea 2016-09-23 02:58:47 UTC
So far only the two of you have this issue, it's impossible for anyone else to bibisect it. However, knowing 5.1 was fine is still important discovery, thanks for checking earlier versions.

The aforementioned rules that cause the infinite loop seem to be coming from some kind of Sharepoint configuration. Do you have anything like that set up in the system? Or maybe it's related to CMIS integration in general?
Comment 23 E. Wayne Johnson 2016-09-23 04:55:50 UTC
My first encounter with the Save odp in Impress bug was when I upgraded my slackware64 to the latest version of current which included a kernel upgrade to 4.4.20.  5.3.x dev version was already on that machine and started to blow up immediately after the upgrade.  I had a 4.4.19 on a different partition and it worked fine with all 5.2 and 5.3 LO that I tried.

I couldnt go back to 5.1.x easily on the machine with the 4.4.20 kernel because too many deps were upgraded.

Reinstalling LO on a completely clean Slackware64 -current 4.4.20 kernel version failed to clear up the problem.

After that Cor stated it looked like an Ubuntu ppa problem to him (and I imagined it would be a Slackware problem next),  I ablated the 4.19 Slackware partition and installed Arch Linux with the latest cutting edge everything and the 4.7.4 kernel.  

In LO 5.2.1.2 there is the error.   It is absent from 5.1.5.  Yes I am motivated to try to slice the 5.2's until i find the version where the change occured.

I am not running any special software like SharePoint or any other CMIS.  On Archlinux I only installed Fluxbox and KDE Plasma and SDDM (display manager tool) and then LO-fresh which Archlinux pacman installed with its deps.  When LO-fresh showed the bug, I removed it and installed LO-stll 5.1.5 which seems ok.

I'll try to install an early 5.2 to see if the problem persists and read the bibisection procedure.

Thanks for your continued interest.

Meanwhile I am trying to roll back to 5.1.5 on my Slackware64-current.
Comment 24 Ofir 2016-09-23 05:03:29 UTC
I have this issue with a daily build of Ubuntu 16.10 installed as a VirtualBox guest. It has LibreOffice 5.2.1-rc2 installed by default.
I didn't install or change anything.
Comment 26 E. Wayne Johnson 2016-09-23 08:38:53 UTC
The hang on save impress bug seems to be in the first alpha of 5.2.0.0.

This version in the archives has the problem:

Filename: LibreOfficeDev_5.2.0.0.alpha1_Linux_x86-64_rpm.tar.gz
Path: /libreoffice/old/5.2.0.0.alpha1/rpm/x86_64/LibreOfficeDev_5.2.0.0.alpha1_Linux_x86-64_rpm.tar.gz
Size: 226M (236475156 bytes)
Last modified: Sun, 24 Apr 2016 17:48:21 GMT (Unix time: 1461520101)
SHA-256 Hash: e41a1b3f96d1ee37cfcf6b2ba5686634d4d8db73bda58d0bf479f064e3eb8e6d
SHA-1 Hash: be29c128b174829ad43cde597f41a755018035a1
MD5 Hash: 95ea82307147f9c486b9151174fc3a4f
BitTorrent Information Hash: b3539ea80ae1b36a631882b8f880021fd269b176
PGP signature available

The final old version of 5.1 (5.1.5.2) aka LO-still is OK...

Version: 5.1.5.2
Build ID: 7a864d8825610a8c07cfc3bc01dd4fce6a9447e5
Comment 27 E. Wayne Johnson 2016-09-23 08:55:14 UTC
Aron -
Not sure what to do at this point.

I looked at the -git dbgutil- tables and not sure what to do next.

Clearly the bug was introduced at the very first alpha of 5.2.0.0 .

Since this was a fork point I am not sure which side to look at.
Comment 28 Stephan Bergmann 2016-09-26 15:08:29 UTC
(In reply to Aron Budea from comment #10)
> I assume there's an infinite recursion during substitution of user variables
> (I'm not sure where they're coming from). The content of
> 'm_aReSubstUserVarOrder' and the initial value of 'aURL' would be
> interesting.

Those values in m_aReSubstUserVarOrder ultimately come from an obscure /org.openoffice.Office/Substitution/SharePoints configuration set.  There is nothing in the LO code base that adds anything to that set (and there's no sign that there ever was, in neither LO nor OOo), though, so that dubious code would normally be dead code.

Unless that Ubuntu "ppa:libreoffice/libreoffice-5-2" ships with nonstandard means to populate that configuration set?  Björn?
Comment 29 Björn Michaelsen 2016-09-26 16:20:44 UTC
There should be no "SharePoints" customization in LibreOffice ppas. There certainly isnt any in my uploads (on the current release), and I would be very surpised, if there would be such modification on the backports (5.2 on Xenial) by Rico (CC'ed).

Also, this has been found on:
- Slackware (Comment 13)
- Arch Linux (Comment 21)
- fresh vanilla Ubuntu 16.04 daily-iso (Comment 5, Comment 24)

The last point makes me doubt this is related to the "SharePoints" config ...

Still moving this to NEEDINFO, as there isnt even a basic reproduction scenario yet. Once someone manages to reproduce this, a bibisect is still needed. Of course, since we dont know what is needed for reproduction, it might get interesting in that this is reproduced on a release build, but not on a bibisect build. But even that would be valuable information.
Comment 30 Ofir 2016-09-26 17:35:38 UTC
Bjorn, you can reproduce it with Ubuntu running as a VirtualBox guest.
- Ubuntu 16.10 daily build
- Ubuntu 16.04 with LibreOffice installed from the 5.2 ppa
- Ubuntu 16.04 with LibreOffice 5.2 or 5.3 dev package from the LibreOffice website
Comment 31 Björn Michaelsen 2016-09-26 17:57:13 UTC
(In reply to Ofir from comment #30)
> Bjorn, you can reproduce it with Ubuntu running as a VirtualBox guest.

I quickly tested that: No, I can not.

I fired up one of my VMs running a random daily image of 16.10 with LibreOffice 5.2.0~rc4 which according to Comment 27 should be affected. Saving an empty odp works without a hitch.
Comment 32 E. Wayne Johnson 2016-09-27 04:23:50 UTC
I just yesterday upgraded Slackware64 --current to the 4.4.22 kernel.  The problem with saving impress .odp files persists for LO 5.2.x and following.

I dont want to do any more fiddling with my Slackware installation and software as I want to do some actual work.

However, I have ArchLinux installed on a different partition and it always produces this error on all versions since 5.2.0.0 alpha and I can try to do some bibisecting.  

The last release of 5.1.x.x now called "still" does not have the bug.

I have tried the LO 5.2.x from different repositories - from the LO web site, from AlienBob packages and i have built LO 5.2.1.2 from source code.  All produce the same error.  

I have looked at the documentation on bibisection but it is not at all clear to me which file i should pull from the git.

I dont want to waste time digging in the wrong place, and particularly so since the files are humongous and take some time to download...

Please advise.
Comment 33 Commit Notification 2016-09-27 07:24:20 UTC
Stephan Bergmann committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=653e0ccc4e6230f28dd4c553dc7e9482beafa3cd

tdf#101898: Only re-substitute whole segments with $(username)

It will be available in 5.3.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 34 Stephan Bergmann 2016-09-27 07:33:48 UTC
So the NEEDINFO request now is:  Whoever who was able to reproduce this, did your username happen to be "user" (or a prefix thereof, like "use")?

In which case (and I very strongly assume so) the commit from comment 33 should fix this.
Comment 35 E. Wayne Johnson 2016-09-27 09:34:27 UTC
Was my username "user" or "use"?

No, my user name is "e" as in E. Wayne Johnson.
Comment 36 Commit Notification 2016-09-27 09:47:22 UTC
Stephan Bergmann committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=eb637b3195f0099e6e21361d625d7292fb484329&h=libreoffice-5-2

tdf#101898: Only re-substitute whole segments with $(username)

It will be available in 5.2.3.

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

Affected users are encouraged to test the fix and report feedback.
Comment 37 Stephan Bergmann 2016-09-27 10:46:19 UTC
(In reply to E. Wayne Johnson from comment #35)
> Was my username "user" or "use"?
> 
> No, my user name is "e" as in E. Wayne Johnson.

That's even more catastrophic in the context of this issue (where it would replace whatever "e" occurring in a URL with "$(username)", and then continue replacing the first "e" in "$(username)" again with "$(username)", etc.).

Considering the root cause of this issue found (and the issue thus fixed per the commit from comment 33).
Comment 38 E. Wayne Johnson 2016-09-27 14:29:13 UTC
Deleted my former user account "e" and created a new one with a longer name and reinstalled LO5.3.x and now it works just fine, as it did before I upgraded --current a few days ago.

I'll try a new build of LO5.3 in a day or two.

thanks for the fix!!!

wayne