abraunegg / onedrive

OneDrive Client for Linux
https://abraunegg.github.io
GNU General Public License v3.0
10.03k stars 859 forks source link

Move failed 412(Precondition failed) #715

Closed SRGOM closed 4 years ago

SRGOM commented 4 years ago

OneDrive client version: 2nd October- 2ef4f88458d65c7c41a31ee31bc3953b6e8af16b

Issue:

Cmd1: I issued an mv command on my linux client for a file. Cmd2: Then I deleted the containing directory.

Looks like OneDrive client is powerful enough to detect move commands. (Thanks!) However, the server didn't process the command and returned an error. The erroneous part seems to be the following- my subsequent delete (Cmd2) went through fine. So OneDrive server deleted the directory. Without knowing that the file had moved. So the file was deleted too. I panicked and went up to the online interface and restored from Recycle Bin.

However the panic wasn't required in my case because the file was then uploaded from the new moved location in the next pass. My guess is, if I hadn't restored, it would have been deleted too in the next pass. So all would have been fine.

But I figured I should still bring this to your attention.

Here is the log of all three actions (move file, delete containing folder, restore from recycle bin). FIrst line is unrelated, just for context.

Deleting item from OneDrive: Books/SomeRandomBook_LogLeftHereForContext.pdf
Applying changes of Path ID: MyOneDriveHash!110
Syncing changes from OneDrive ...
Applying changes of Path ID: MyOneDriveHash!110
[M] Item moved: Books/BookNotMoved.pdf -> Library/Books/NonFiction/SomeCategory/BookNotMoved.pdf
Moving Books/BookNotMoved.pdf to Library/Books/NonFiction/SomeCategory/BookNotMoved.pdf
Cannot move item:, HTTP request returned status code 412 (Precondition Failed)
{
    "error": {
        "code": "notAllowed",
        "innerError": {
            "date": "2019-11-01T19:39:29",
            "request-id": "48dc4fa7-fc2f-4692-9794-e286b3bcaab7"
        },
        "message": "ETag does not match current item's value"
    }
}
[M] Item deleted: ./Books
Deleting item from OneDrive: ./Books
Applying changes of Path ID: MyOneDriveHash!110
Applying changes of Path ID: MyOneDriveHash!110
Applying changes of Path ID: MyOneDriveHash!110
Creating directory: Books
Downloading file Books/BookNotMoved.pdf ...
Downloading 100% |oooooooooooooooooooooooooooooooooooooooo| DONE IN 00:00:08
done.
Monitor directory: ./Books
abraunegg commented 4 years ago

@SRGOM Whilst you have provided some details, you have not used the template for submitting issues. Please can you update your post above with the following:

Application and Operating System Details:

This critically important as it helps configure a system in an attempt to replicate the issue or identify very quickly if this is a version issue.

Please can you also generate a verbose debug log as per: https://github.com/abraunegg/onedrive/wiki/Generate-debug-log-for-support

This is needed so the code can be correctly tracked through as to what may be occurring and why.

More importantly - this MOST likely is a duplicate of #706 - which means you are not running the latest version of the client where this is fixed.

SRGOM commented 4 years ago

Sorry, this was bad manners to delete the issue template. I've attached the required data.

As you suspected I am using a month old version (last release, 2nd October https://github.com/abraunegg/onedrive/commit/2ef4f88458d65c7c41a31ee31bc3953b6e8af16b ). And the issue you linked does seem similar. But my issue was with a pdf file. So maybe not? EDIT: I saw the fix in the code and it seems a general case handling. So I think it would allay my fears but I'm still a tiny bit surprised as to why it happened...

Here are the data:

System details

$uname -a                                                                                                                                                 [zx@Nix_Desk 5:08:41 ]
Linux Nix_Desk 4.19.80 #1-NixOS SMP Thu Oct 17 20:45:44 UTC 2019 x86_64 GNU/Linux

Headless or GUI?

  • Short: GUI. Long: I log in to console. From there I startx into i3.

OneDrive a/c type

  • Personal, free
$bin/dmd --version                                                                                                                                        [zx@Nix_Desk 5:15:54 ]
DMD64 D Compiler v2.085.1

Copyright (C) 1999-2019 by The D Language Foundation, All Rights Reserved written by Walter Bright

Config

$bin/onedrive --display-config                                                                                                                            [zx@Nix_Desk 5:18:11 ]
onedrive version                    = v2.3.10
Config path                         = /home/zx/.config/onedrive
Config file found in config path    = true
Config option 'check_nosync'        = false
Config option 'sync_dir'            = /home/zx/Library/OneDrive
Config option 'skip_dir'            =
Config option 'skip_file'           = ~*|.~*|*.tmp
Config option 'skip_dotfiles'       = false
Config option 'skip_symlinks'       = false
Config option 'monitor_interval'    = 45
Config option 'min_notify_changes'  = 5
Config option 'log_dir'             = /var/log/onedrive/
Config option 'sync_root_files'     = false
Selective sync configured           = false

Curl

$bin/curl --version                                                                                                                                       [zx@Nix_Desk 5:26:55 ]
curl 7.65.3 (x86_64-pc-linux-gnu) libcurl/7.65.3 OpenSSL/1.1.1d zlib/1.2.11 libssh2/1.9.0 nghttp2/1.39.2
Release-Date: 2019-07-19
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS GSS-API HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz NTLM NTLM_WB SPNEGO SSL TLS-SRP UnixSockets

Please do let me know if I've missed anything. Thank you.

abraunegg commented 4 years ago

@SRGOM

Please do let me know if I've missed anything. Thank you.

Can you generate and send a debug log - this will confirm the issue & and I firmly believe this is fixed by PR #707. Marking this as duplicate as I am 100% confident that it is.

So I think it would allay my fears but I'm still a tiny bit surprised as to why it happened...

I think this is an API issue as per:

SRGOM commented 4 years ago

Sorry I completely missed that, I will generate a log in a bit!

SRGOM commented 4 years ago

Also, the way you handle 412 is generic and it does fix my issue (as far as my understanding of that code goes).

I'm just concerned that it happened on a pdf.

SRGOM commented 4 years ago

Closing this...

abraunegg commented 4 years ago

@SRGOM

I'm just concerned that it happened on a pdf.

This should be no cause for concern. The issue you were having is an API issue and could happen with any file type - it just so happened you are seeing it with PDF files - for others it may be image files, or text, or other MS Office type files.

SRGOM commented 4 years ago

Alright, thanks. I've been using it very cautiously. Comparing against a snapshot after every few actions. And so far it's been working wonderfully! Thank you for a well-working onedrive client!

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.