OpenOffice.org automatic detection of file lock requirement does not work - WITH SOLUTION

Bug #232160 reported by Thomas Ribbrock
6
Affects Status Importance Assigned to Milestone
openoffice.org (Ubuntu)
Fix Released
Undecided
Unassigned
Hardy
Fix Released
Undecided
Chris Cheney

Bug Description

Binary package hint: openoffice.org

When switching from SuSE 10.0/OpenOffice 2.0 to Kubuntu 8.04/OpenOffice 2.4 I noticed that file locking no longer worked - two users were able to open the same document at the same time and save changes, with the last save winning. As this is a very undesirable situation I went to investigate. I found that (K)Ubuntu uses custom scripts to start OpenOffice and that these scripts contain some code to automatically determine whether $HOME or the edited file is located on a NFS (or Samba) share depending on the setting of FILE_LOCKING in
/etc/openoffice/soffice.sh. FILE_LOCKING defaults to "auto' so the auto detection code is used.

Unfortunately, this code does not work - file locking is never enabled, despite the fact that we use NFS-mounted home directories. Having a closer look at /usr/lib/openoffice/program/soffice revealed the problematic part:

[...current version of the script...]
if [ -z "$SAL_ENABLE_FILE_LOCKING" ]; then
    case "$FILE_LOCKING" in
        auto)
        if ! file_or_home_on_nfs "$@"; then
            # file locking now enabled by default
            SAL_ENABLE_FILE_LOCKING=1
            export SAL_ENABLE_FILE_LOCKING
        fi
[...]

The second if statement is never evaluated successfully, no matter what "file_or_home_on_nfs" returns. Hence, SAL_ENABLE_FILE_LOCKING is never set and thus file locking never enabled. I've modified the code as follows:

[...WORKING version...]
if [ -z "$SAL_ENABLE_FILE_LOCKING" ]; then
    case "$FILE_LOCKING" in
        auto)
        file_or_home_on_nfs "$@"
        if [ $? -eq 0 ]; then
            # file locking now enabled by default
            SAL_ENABLE_FILE_LOCKING=1
            export SAL_ENABLE_FILE_LOCKING
        fi
[...]

This version works and correctly sets SAL_ENABLE_FILE_LOCKING to "1". This is most likely not the most elegant variant, but at least it works. I have noticed that there are more if statements like this in the same file (e.g. "if ! working_opengl_support; then" a bit further on) and I have not checked the other scripts in that directory, so there might be similar bugs waiting...

WORKAROUND:
For those who need file locking to be working before the developers have released a fix:
Set FILE_LOCKING to "yes" in /etc/openoffice/soffice.sh to force file locking on all the time (on all types of file systems).

Version Information:
> lsb_release -rd
Description: Ubuntu 8.04
Release: 8.04

> apt-cache policy openoffice.org
openoffice.org:
  Installed: 1:2.4.0-3ubuntu6
  Candidate: 1:2.4.0-3ubuntu6
  Version table:
 *** 1:2.4.0-3ubuntu6 0

Revision history for this message
Chris Cheney (ccheney) wrote :

Thanks for the patch, it will be in the next upload to hardy-proposed and will should make it into intrepid soon as well.

Chris Cheney

Changed in openoffice.org:
status: New → In Progress
Chris Cheney (ccheney)
Changed in openoffice.org:
assignee: nobody → ccheney
status: New → In Progress
Revision history for this message
Paul Rensing (paulrensing) wrote :

This seems to fix a long-term problem I had. If I start OOo with a file on a local hard drive, then it would pause "forever" when I tried to open a file on an NFS mount. Same thing in reverse order. I applied the patch and it behaves better.

However, I now see a new problem. OOo is not running. From a terminal, I do "ooffice /tmp/foo.csv". The startup banner window pops up but then goes away. I get the following in the terminal:

 Locking assertion failure. Backtrace:
#0 /usr/lib/libxcb-xlib.so.0 [0x7fd26a4f297c]
#1 /usr/lib/libxcb-xlib.so.0(xcb_xlib_lock+0x15) [0x7fd26a4f2a15]
#2 /usr/lib/libX11.so.6 [0x7fd26e1bc323]
#3 /usr/lib/libX11.so.6(XCreateWindow+0x44) [0x7fd26e1b3d54]
#4 /usr/lib/libgdk-x11-2.0.so.0(gdk_window_new+0x395) [0x7fd26a09cc05]
#5 /usr/lib/libgtk-x11-2.0.so.0 [0x7fd26572b4c8]
#6 /usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x10f) [0x7fd269530bcf]
#7 /usr/lib/libgobject-2.0.so.0 [0x7fd269544386]
#8 /usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x875) [0x7fd2695460d5]
#9 /usr/lib/libgobject-2.0.so.0(g_signal_emit+0x83) [0x7fd269546483]
#10 /usr/lib/libgtk-x11-2.0.so.0(gtk_widget_realize+0x77) [0x7fd26571c957]
#11 /usr/lib/openoffice/program/libvclplug_gtk680lx.so [0x7fd265ad476d]
#12 /usr/lib/openoffice/program/libvclplug_gtk680lx.so [0x7fd265ad516a]
#13 /usr/lib/openoffice/program/libvclplug_gtk680lx.so [0x7fd265ad582b]
#14 /usr/lib/openoffice/program/libvclplug_gtk680lx.so [0x7fd265aadf64]
#15 /usr/lib/openoffice/program/libvcl680lx.so [0x7fd271a594ed]
#16 /usr/lib/openoffice/program/libvcl680lx.so [0x7fd2719ee322]
#17 /usr/lib/openoffice/program/libvcl680lx.so(_ZN9TabDialogC2EP6WindowRK5ResId+0x5f) [0x7fd271a2b1cf]
#18 /usr/lib/openoffice/program/libsvx680lx.so [0x7fd25db65084]
#19 /usr/lib/openoffice/program/libsvx680lx.so [0x7fd25dd39db4]

I don't get this if I don't give it a file on startup, and then open it later with the same command. "foo.csv" is just one line with "a,b" in it.

Chris Cheney (ccheney)
Changed in openoffice.org:
status: In Progress → Triaged
status: In Progress → Fix Committed
Revision history for this message
Steve Langasek (vorlon) wrote :

OOo 2.4.1 copied to intrepid.

Changed in openoffice.org:
status: Fix Committed → Fix Released
status: Triaged → Fix Committed
Revision history for this message
Steve Langasek (vorlon) wrote :

Accepted into -proposed, please test and give feedback here

Revision history for this message
Martin Pitt (pitti) wrote :

Copied to hardy-updates.

Changed in openoffice.org:
status: Fix Committed → Fix Released
Revision history for this message
Thomas Ribbrock (emgaron+ubuntu) wrote :

I tested the new package yesterday with FILE_LOCKING set to "auto" in /etc/openoffice/soffice.sh - and now it is indeed working as expected on our NFS directories. Thank you!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.