Webdav upload and wrong modify time stamp (0.7.65, 0.8.34)

Hello,

I noticed that uploading file (webdav) when client_body_temp_path and
document root are on different partitions sets access and modify time
stamps to 1970-01-01 instead of valid time. It works fine if
client_body_temp_path and document root are on the same partition.

I tested nginx 0.7.65 and 0.8.34, both on Debian lenny.

  1. Test partition: ext3, default mount options

mount -o defaults -t ext3 /dev/sda3 /home/nginx-test

  1. client_body_temp_path and document root on different partitions
    root /home/nginx-test/upload
    client_body_temp_path /tmp

curl -T test.txt http://127.0.0.1:8080/test.txt

stat /home/nginx-test/upload/test.txt

File: `/home/nginx-test/upload/test.txt’
Size: 5 Blocks: 8 IO Block: 4096 regular file
Device: 803h/2051d Inode: 22896642 Links: 1
Access: (0640/-rw-r-----) Uid: ( 33/www-data) Gid: ( 33/www-data)
Access: 1970-01-01 00:59:59.000000000 +0100
Modify: 1970-01-01 00:59:59.000000000 +0100
Change: 2010-03-30 10:53:22.000000000 +0200

Wrong access and modify.

  1. client_body_temp_path and document root on the same partition
    root /home/nginx-test/upload
    client_body_temp_path /home/nginx-test/tmp

curl -T test.txt http://127.0.0.1:8080/test2.txt

stat /home/nginx-test/upload/test2.txt

File: `/home/nginx-test/upload/test2.txt’
Size: 5 Blocks: 8 IO Block: 4096 regular file
Device: 803h/2051d Inode: 15564807 Links: 1
Access: (0640/-rw-r-----) Uid: ( 33/www-data) Gid: ( 33/www-data)
Access: 2010-03-30 10:57:28.000000000 +0200
Modify: 2010-03-30 10:57:28.000000000 +0200
Change: 2010-03-30 10:57:28.000000000 +0200

Access and modify are OK.

  1. My nginx.conf
    user www-data;
    pid /var/run/nginx.pid;
    error_log /var/log/nginx/error.log;

events {
}

http {
server {
listen 127.0.0.1:8080;
access_log /var/log/nginx/access.log;
root /home/nginx-test/upload;

client_max_body_size 4g;
create_full_put_path on;
client_body_temp_path /home/nginx-test/tmp;
# client_body_temp_path /tmp;
dav_methods PUT DELETE MKCOL MOVE;
dav_access user:rw group:r;

}
}

Best regards,

Marcin Engelmann

Hello!

On Tue, Mar 30, 2010 at 01:16:00PM +0200, Marcin Engelmann wrote:

I noticed that uploading file (webdav) when client_body_temp_path and
document root are on different partitions sets access and modify time
stamps to 1970-01-01 instead of valid time. It works fine if
client_body_temp_path and document root are on the same partition.

Try the attached patch.

Maxim D.

Dnia 2010-03-30, wto o godzinie 15:34 +0400, Maxim D. pisze:

I noticed that uploading file (webdav) when client_body_temp_path and
document root are on different partitions sets access and modify time
stamps to 1970-01-01 instead of valid time. It works fine if
client_body_temp_path and document root are on the same partition.
Try the attached patch.
Works great!

Best regards,

Marcin Engelmann