dCache / dcache

dCache - a system for storing and retrieving huge amounts of data, distributed among a large number of heterogenous server nodes, under a single virtual filesystem tree with a variety of standard access methods
https://dcache.org
284 stars 135 forks source link

Change modification date with a WebDAV PROPPATCH #6829

Open onnozweers opened 1 year ago

onnozweers commented 1 year ago

Dear dCache developers,

We have a user who wants to upload a dataset while retaining the original modification dates. I don't expect that dCache does that by default. So I looked into the WebDAV PROPPATCH operation, to try and modify the modification date. Here's what I tried:

First a PROPFIND to find out the names of the properties:

13:23 ui.grid.surfsara.nl:/home/onno 
onno$ curl --user onno --request PROPFIND https://penguin12.grid.surfsara.nl:2881/pnfs/grid.sara.nl/data/users/onno/README.txt | xmllint -format -
Enter host password for user 'onno':
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   806    0   806    0     0   3466      0 --:--:-- --:--:-- --:--:--  3489
<?xml version="1.0" encoding="utf-8"?>
<d:multistatus xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:cs="http://calendarserver.org/ns/" xmlns:card="urn:ietf:params:xml:ns:carddav" xmlns:d="DAV:">
  <d:response>
    <d:href>/pnfs/grid.sara.nl/data/users/onno/README.txt</d:href>
    <d:propstat>
      <d:prop>
        <d:getcontentlength>1145</d:getcontentlength>
        <d:getetag>"0000D1B4A9DEA4F848CA99A28B527CF26C58_1525068542"</d:getetag>
        <d:displayname>README.txt</d:displayname>
        <d:getcontenttype>text/plain</d:getcontenttype>
        <d:getlastmodified>Mon, 02 Jul 2018 12:10:26 GMT</d:getlastmodified>
        <d:creationdate>2018-07-02T12:10:24Z</d:creationdate>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
    <d:propstat>
      <d:prop>
        <d:resourcetype/>
      </d:prop>
      <d:status>HTTP/1.1 404 Not Found</d:status>
    </d:propstat>
  </d:response>
</d:multistatus>

I see a getlastmodified, that looks good.

From the user manual I saw some examples on how to do a PROPPATCH.

I created a request:

13:58 ui.grid.surfsara.nl:/home/onno 
onno$ cat proppatch.xml
<?xml version="1.0"?>
<propertyupdate xmlns:d="DAV:">
    <set>
        <prop>
            <d:getlastmodified>Sun, 12 Aug 1928 12:10:00 GMT</d:getlastmodified>
        </prop>
    </set>
</propertyupdate> 

Sending the request:

13:59 ui.grid.surfsara.nl:/home/onno 
onno$ curl --user onno --upload-file proppatch.xml --request PROPPATCH https://penguin12.grid.surfsara.nl:2881/pnfs/grid.sara.nl/data/users/onno/README.txt --fail | xmllint -format -
Enter host password for user 'onno':
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   505    0   300  100   205   1267    866 --:--:-- --:--:-- --:--:--  1276
<?xml version="1.0" encoding="utf-8"?>
<d:multistatus xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:cs="http://calendarserver.org/ns/" xmlns:card="urn:ietf:params:xml:ns:carddav" xmlns:d="DAV:">
  <d:response>
    <d:href>/pnfs/grid.sara.nl/data/users/onno/README.txt</d:href>
  </d:response>
</d:multistatus> 

The request does not appear in the billing file.

In the access file webdav2881-penguin12Domain.access:

webdav2881-penguin12Domain.access:level=INFO ts=2022-10-13T14:01:44.795+0200 event=org.dcache.webdav.request request.method=PROPPATCH request.url=https://penguin12.grid.surfsara.nl:2881/pnfs/grid.sara.nl/data/users/onno/README.txt response.code=207 response.reason=Multi-status socket.remote=145.38.218.162:49016 user-agent=curl/7.29.0 user.mapped=***** duration=6

There were no obvious errors. But the modification date of the file wasn't changed.

I tried the same with the creationdate, but that didn't work either.

Kind regards, Onno

onnozweers commented 1 year ago

Ah, I found an error in the PROPPATCH request. Trying again with:

onno$ cat proppatch.xml
<?xml version="1.0"?>
<d:propertyupdate xmlns:d="DAV:">
    <d:set>
        <d:prop>
            <d:getlastmodified>Sun, 12 Aug 1928 12:10:00 GMT</d:getlastmodified>
        </d:prop>
    </d:set>
</d:propertyupdate>

This time I got an error: <d:status>HTTP/1.1 403</d:status> (Forbidden).

In the door log:

13 Oct 2022 17:34:38 (webdav2881-penguin12) [door:webdav2881-penguin12@webdav2881-penguin12Domain:AAXq7D9GkSA] property is not writable in source: class io.milton.http.webdav.WebDavProtocol

In the access log:

level=INFO ts=2022-10-13T17:34:38.330+0200 event=org.dcache.webdav.request request.method=PROPPATCH request.url=https://penguin12.grid.surfsara.nl:2881/pnfs/grid.sara.nl/data/users/onno/README.txt response.code=207 response.reason=Multi-status socket.remote=145.38.218.162:50128 user-agent=curl/7.29.0 user.mapped=31029:31040,44736,40304,44436,47798,41385,30013,30014 duration=5

Here the response code is 207, not 403.