Bug 95792 - Lock missing when saving a file (save as) on some webdav server
Summary: Lock missing when saving a file (save as) on some webdav server
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
5.1.0.0.alpha0+ Master
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:5.2.0 target:5.1.0.1 target:7...
Keywords:
Depends on: 90249
Blocks:
  Show dependency treegraph
 
Reported: 2015-11-13 10:06 UTC by lnunes
Modified: 2021-11-01 17:28 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description lnunes 2015-11-13 10:06:53 UTC
Documents are stored on webdav server and are opened directely with LO (LO interface)
* I open a document1=> file lock is correctly set on document1.
* I save document1 as document2=> lock is released on document1 BUT lock is not set on document2

version: libo-master~2015-11-12_23.49.56_LibreOfficeDev_5.1.0.0.alpha1_Win_x64.
OS: windows 7.
Webdav server: openkm
Comment 1 Giuseppe Castagno (aka beppec56) 2015-11-13 10:57:22 UTC
(In reply to lnunes from comment #0)
> Documents are stored on webdav server and are opened directely with LO (LO
> interface)
> * I open a document1=> file lock is correctly set on document1.
> * I save document1 as document2=> lock is released on document1 BUT lock is
> not set on document2

It seems that OpenKM doesn't implement the part of the WebDAV standard LO uses on new created documents, namely this:
<http://tools.ietf.org/html/rfc4918#section-7.3>

though I need to look into the matter more closely to confirm it.

The lock on the new created document should be created when you save it the first time after a edit, that is do a small edit to it, then save: the lock should be in place.

Can you do this check on your installation:
- save a new document: not locked
- do a small edit on the document and save: the lock is in place
- when you close the document the lock should be released.
Comment 2 lnunes 2015-11-13 12:40:29 UTC
I create a new document with LO and saved it in webdav server => no lock.
I modified it and try to save = > Error saving the document LO-test:
Error transferring data to the Internet.
Server error message: 500 Internal Server Error.
and no lock on file is displayed on server.

Note:
I opened an already existing document in my webdav server (lock was set) then modified and save it=> same error happens. But if I remove manually the lock on server before saving, it is ok. Strange...
Comment 3 Giuseppe Castagno (aka beppec56) 2015-11-13 13:32:30 UTC
(In reply to lnunes from comment #2)
> I create a new document with LO and saved it in webdav server => no lock.
> I modified it and try to save = > Error saving the document LO-test:
> Error transferring data to the Internet.
> Server error message: 500 Internal Server Error.
> and no lock on file is displayed on server.
> 
> Note:
> I opened an already existing document in my webdav server (lock was set)
> then modified and save it=> same error happens. But if I remove manually the
> lock on server before saving, it is ok. Strange...

when you have spare time, can you repeat the above tests on the public OpenKM server?
Comment 4 lnunes 2015-11-13 13:56:51 UTC
Testing with demo server:

-I create a new document with LO and saved it in webdav server => no lock.

-I modified it and try to save = > file is saved and lock is put.

This is not the same behaviour...
Probably an openkm bug  :-( 
Difference between Openkm demo server and our own, is the version: demo server is a professional version whereas we installed the community one.
Comment 5 Giuseppe Castagno (aka beppec56) 2015-11-16 11:20:06 UTC
Added dependency, since most of the information about the WebDAV server type involved are there (issue #90249)
Comment 6 Giuseppe Castagno (aka beppec56) 2015-11-20 11:37:20 UTC
lnunes:

In order to understand what is going on, I prepared a special crafted version of LO, adding textual logging to
the WebDAV layer.

I built it myself, it's derived from master branch, you may download it from here:

http://www.acca-esse.it/dwnld/lo/LibreOfficeDev_5.1.0.0.alpha1_Win_x86_en-US_it_fr_de_qtz.msi

The source code of this specific version is in github:

https://github.com/beppec56/core/commit/eaa7856aa68355db39d16eca93a9cada0cee63e3

Install following the instruction here:

https://wiki.documentfoundation.org/Installing_in_parallel/Windows

I'd suggest you use the SI-GUI application:

https://wiki.documentfoundation.org/Installing_in_parallel/Windows#SI-GUI

when installed, you may start it and repeat the test that fails.

Then close LO to save all the log generated during the run phase.
The logs, in textual form, with the installation folder as in C:\test-lo\lo5100a1 folder,
are available in the following folder:

C:\test-lo\lo5100a1\user\logs

They are saved in textual Linux format so to open them you need an editor like Netpad++:

https://notepad-plus-plus.org

Before posting them here, have a look to see if they contain any sensible information, edit it if you find it necessary.

Then zip and attach here.

Thanks.
Comment 7 Giuseppe Castagno (aka beppec56) 2015-12-01 10:35:56 UTC
lnunes:

Thank you for taking time to provide me a log.

I had a look at it, this is what I gathered.
   
Saving a new file gives '501 Not implemented' server error when trying to lock an unallocated URL:

at time 11.51.51.480
 Content::lock - CALLED
 LOCK (create) - relative URL: </OpenKM/webdav/okm_root/zzz-old/totov2.odt>
 Obtaining lock for <http://openkm:8080/OpenKM/webdav/okm_root/zzz-old/totov2.odt failed!
 Neon received http error: '501 Not Implemented'

 meaning OpenKM WebDAV server you use doesn't implement this part:
 <http://tools.ietf.org/html/rfc4918#section-7.3>
 of the current WebDAV standard.
 Apparently the public demo server doesn't implement it as well. 
 
 That explains why the lock is not placed on a newly created document.
 
 One last thing worth nothing. 
 At time 11.50.41.391 you see the following:

 GET - relative URL <an url>
  received headers:
   last-modified: a date
   date: another date
   content-length: 23558
   cache-control: no-cache
   etag: 505f3574-fab2-442b-af57-80f502377662_622901945
   server: milton.io-1.8.1.3
   content-type: application/vnd.oasis.opendocument.text

The interested string here is this:
server: milton.io-1.8.1.3

milton.io is a WebDAV server core in form of Java library:
<http://milton.io/>
currently at version 2.7.1.3, if OpenKM doesn't lie about it, it uses a version that seems old (1.8.1.3).

Probably something your IT colleagues should look into?

I didn't see anything related to the error you reported in comment #2.

When you have spare time, using the same LO logging version can you repeat the test you reported in comment #2 to activate error 502?
I'm curious about what LO does.
Comment 8 Giuseppe Castagno (aka beppec56) 2015-12-03 17:01:16 UTC
Checked the issue with LO libreoffice-5-1:2365ff9, wrt the lock when saving a new file on two other WebDAV server:

Test done:

Open a file locally. salve as new on the server, then saved again on the same server with a different name.

1) Apache WebDAV server: no bug, lock it's correctly set when saving as new. Saving the new file again with a different name on the same server the lock is removed from the old and set on the new file, as expected.

2) Alfresco 5.0.d community, WebDAV connector: no bug, same test and results as in 1), behaves as expected.

3) Alfresco 5.0.d community, Sharepoint protocol: test as in 1) LO report error: '500 Internal Server Error'; bug is present, and it's not possible to save a new file with LO, reason: the lock on a null resource is not supported.
Being a Sharepoint protocol the reason is probably this lack of compliance:
<https://msdn.microsoft.com/en-us/library/jj575165%28v=office.12%29.aspx#endNote15>
better outlined here:
<https://msdn.microsoft.com/en-us/library/jj575265%28v=office.12%29.aspx#id15>
Both links retrieved 2015-12-03.

Bug is confirmed present in some WebDAV servers.
Set as NEW.
Comment 9 Giuseppe Castagno (aka beppec56) 2015-12-03 17:02:46 UTC
Changed description to a more appropriate one.
Comment 10 Commit Notification 2015-12-15 14:27:06 UTC
Giuseppe Castagno committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=4c82edfb3a9286a0bfef3f006e468e5c331987eb

tdf#95792: fix saving file the first time on some WebDAV servers.

It will be available in 5.2.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 11 Commit Notification 2015-12-15 19:27:22 UTC
Giuseppe Castagno committed a patch related to this issue.
It has been pushed to "libreoffice-5-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=522de0352ae5968d4f24726812504a2749ad0958&h=libreoffice-5-1

tdf#95792: fix saving file the first time on some WebDAV servers.

It will be available in 5.1.0.1.

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 12 Giuseppe Castagno (aka beppec56) 2015-12-21 15:49:04 UTC
lnunes:

LO 5.1.0 RC1 should contain this fix.

You may download it from here:

http://www.libreoffice.org/download/pre-releases

and check if it works for you.

Thanks
Comment 13 lnunes 2015-12-22 08:25:11 UTC
Hi Giuseppe.

I downloaded version 5.1.0.1 from 
http://www.libreoffice.org/download/pre-releases but it is not possible to configure webdav server: when pressing on server icon, select Webdav option in menu, but in fact, Google drive remains selected.
Regards
Comment 14 Giuseppe Castagno (aka beppec56) 2015-12-22 10:22:59 UTC
Hi Licinia,

a bug. I'll report it after I tested with current daily.

You should be able to select the File service type using the arrow (up/down) keys.
Comment 15 lnunes 2015-12-22 10:47:15 UTC
Hi Giuseppe.

You are right: I need to select serveer type option using arrows...
I performed quickly tests around lock on webdav server and seems fine to me:

* I open a document1=> file lock is correctly set on document1.
* I save document1 as document2=> file lock is correctly set on document12 and released in document1
* create file on LO and save it to webdav server => file created and lock is put on it
* If a doc is lock on server, Lo can only open doc in readly mode

Thanks.
Looking forward to see an official version including it.
Comment 16 Giuseppe Castagno (aka beppec56) 2015-12-22 11:31:17 UTC
Hi Licinia,

thank you for your time.

Feel free to report any other issue you may find along the way.
Comment 17 Commit Notification 2021-11-01 17:28:52 UTC
Giuseppe Castagno committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/11a457538a300d8df0c5c03d3cb590e94e6d99fa

ucb: webdav-curl: tdf#95792: fix saving file the first time on some WebDAV servers.

It will be available in 7.3.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.