Bug 40964

Summary: menu entries should lower indirections
Product: LibreOffice Reporter: Jérôme <jerome.bouat>
Component: InstallationAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED WONTFIX    
Severity: normal CC: chris, jerome.bouat, samuel.mehrbrodt
Priority: medium    
Version: 3.3.3 release   
Hardware: All   
OS: Linux (All)   
Whiteboard:
Crash report or crash signature: Regression By:

Description Jérôme 2011-09-17 05:49:55 UTC
With the Ubuntu 11.04 (natty) package, the menu entry description provides the below command :
---
j@lu64:~$ grep -i exec /usr/share/applications/libreoffice-writer.desktop
Exec=libreoffice -writer %U
Exec=libreoffice -writer %U
j@lu64:~$
---

The above command line is equivalent to the below pseudo instructions :
---
j@lu64:~$ which libreoffice 
/usr/bin/libreoffice
j@lu64:~$ file /usr/bin/libreoffice
/usr/bin/libreoffice: POSIX shell script text executable
j@lu64:~$ cat /usr/bin/libreoffice
#!/bin/sh
/usr/lib/libreoffice/program/soffice  "$@"
j@lu64:~$ file /usr/lib/libreoffice/program/soffice
/usr/lib/libreoffice/program/soffice: POSIX shell script text executable
j@lu64:~$ /bin/sh /usr/lib/libreoffice/program/soffice -writer %U
---

I think the /usr/share/applications/libreoffice-writer.desktop file should provide the below command line instead :
---
Exec=/bin/sh /usr/lib/libreoffice/program/soffice -writer %U
---

The below Ubuntu bug report shows that removing all those indirect calls speeds
up the cold startup time by more than 20% :

https://bugs.launchpad.net/ubuntu/+source/openoffice.org/+bug/452043
Comment 1 Björn Michaelsen 2011-12-23 12:39:27 UTC
[This is an automated message.]
This bug was filed before the changes to Bugzilla on 2011-10-16. Thus it
started right out as NEW without ever being explicitly confirmed. The bug is
changed to state NEEDINFO for this reason. To move this bug from NEEDINFO back
to NEW please check if the bug still persists with the 3.5.0 beta1 or beta2 prereleases.
Details on how to test the 3.5.0 beta1 can be found at:
http://wiki.documentfoundation.org/QA/BugHunting_Session_3.5.0.-1

more detail on this bulk operation: http://nabble.documentfoundation.org/RFC-Operation-Spamzilla-tp3607474p3607474.html
Comment 2 Jérôme 2012-01-30 13:39:25 UTC
The new 3.5.0rc2 version decreased the number of indirection. However we could go further.

Menu entry :
---
j@j-K64:~$ grep -i exec /usr/share/applications/libreoffice3.5-writer.desktop 
Exec=libreoffice3.5 --writer %U
j@j-K64:~$
---

The above command line is equivalent to the below pseudo instructions :
---
j@j-K64:~$ which libreoffice3.5
/usr/bin/libreoffice3.5
j@j-K64:~$ file /usr/bin/libreoffice3.5
/usr/bin/libreoffice3.5: symbolic link to `/opt/libreoffice3.5/program/soffice'
j@j-K64:~$ file /opt/libreoffice3.5/program/soffice
/opt/libreoffice3.5/program/soffice: POSIX shell script text executable
j@j-K64:~$ head -1 /opt/libreoffice3.5/program/soffice
#!/bin/sh
j@j-K64:~$ /bin/sh /opt/libreoffice3.5/program/soffice --writer %U
---

I think the /usr/share/applications/libreoffice3.5-writer.desktop file should
provide the below command line instead :
---
Exec=/bin/sh /opt/libreoffice3.5/program/soffice --writer %U
---
Comment 3 Jérôme 2012-02-12 06:15:37 UTC
The bug still occurs with 3.5.0 RC3 (2012-02-04).
Comment 4 Samuel Mehrbrodt (allotropia) 2013-12-01 22:18:59 UTC
I don't think this is a bug in LibreOffice. LibreOffice can be installed in different places and this should not be hard-coded.
Comment 5 Jérôme 2013-12-08 14:12:42 UTC
I think the installation process should deal with the final path of the programs.

For example, you keep the symbolic link /usr/bin/libreoffice which points to /usr/lib/libreoffice/program/soffice.

However, the /usr/share/applications/libreoffice-writer.desktop would have the below Exec mapping :
---
Exec=/bin/sh /usr/lib/libreoffice/program/soffice -writer %U
---

Anyway you have to deal with the final path when you create the symbolic link.

Maybe the tools which package the archives/installer are already dealing with this indirection.