jstaf / onedriver

A native Linux filesystem for Microsoft OneDrive
GNU General Public License v3.0
1.97k stars 96 forks source link

OpenSuse Tumbleweed Crash - slice bounds out of range #234

Closed sweethuman closed 2 years ago

sweethuman commented 2 years ago
Jan 31 17:46:25 latitude systemd[2294]: Started onedriver.
Jan 31 17:46:25 latitude onedriver[20609]: 17:46:25 INF onedriver v0.12.0 9f26ac08
Jan 31 17:46:36 latitude onedriver[20609]: panic: runtime error: slice bounds out of range [::2700962214] with length 2147483647
Jan 31 17:46:36 latitude onedriver[20609]: goroutine 1 [running]:
Jan 31 17:46:36 latitude onedriver[20609]: go.etcd.io/bbolt.unsafeByteSlice(...)
Jan 31 17:46:36 latitude onedriver[20609]:         /builddir/build/BUILD/onedriver-0.12.0/vendor/go.etcd.io/bbolt/unsafe.go:27
Jan 31 17:46:36 latitude onedriver[20609]: go.etcd.io/bbolt.(*leafPageElement).value(...)
Jan 31 17:46:36 latitude onedriver[20609]:         /builddir/build/BUILD/onedriver-0.12.0/vendor/go.etcd.io/bbolt/page.go:133
Jan 31 17:46:36 latitude onedriver[20609]: go.etcd.io/bbolt.(*Cursor).keyValue(0xc002fd78a0)
Jan 31 17:46:36 latitude onedriver[20609]:         /builddir/build/BUILD/onedriver-0.12.0/vendor/go.etcd.io/bbolt/cursor.go:350 +0x172
Jan 31 17:46:36 latitude onedriver[20609]: go.etcd.io/bbolt.(*Cursor).next(0xc002fd78a0)
Jan 31 17:46:36 latitude onedriver[20609]:         /builddir/build/BUILD/onedriver-0.12.0/vendor/go.etcd.io/bbolt/cursor.go:242 +0xd2
Jan 31 17:46:36 latitude onedriver[20609]: go.etcd.io/bbolt.(*Cursor).Next(0xc00020d8a0)
Jan 31 17:46:36 latitude onedriver[20609]:         /builddir/build/BUILD/onedriver-0.12.0/vendor/go.etcd.io/bbolt/cursor.go:75 +0x2b
Jan 31 17:46:36 latitude onedriver[20609]: go.etcd.io/bbolt.(*Bucket).ForEach(0xc003236a80, 0xc002fd7900)
Jan 31 17:46:36 latitude onedriver[20609]:         /builddir/build/BUILD/onedriver-0.12.0/vendor/go.etcd.io/bbolt/bucket.go:389 +0x94
Jan 31 17:46:36 latitude onedriver[20609]: github.com/jstaf/onedriver/fs.NewUploadManager.func1(0x0)
Jan 31 17:46:36 latitude onedriver[20609]:         /builddir/build/BUILD/onedriver-0.12.0/fs/upload_manager.go:46 +0x88
Jan 31 17:46:36 latitude onedriver[20609]: go.etcd.io/bbolt.(*DB).View(0x30, 0xc00020d9c0)
Jan 31 17:46:36 latitude onedriver[20609]:         /builddir/build/BUILD/onedriver-0.12.0/vendor/go.etcd.io/bbolt/db.go:725 +0x82
Jan 31 17:46:36 latitude onedriver[20609]: github.com/jstaf/onedriver/fs.NewUploadManager(0x77359400, 0xc00021c000, 0xc000216410, 0xc0001ac1e0)
Jan 31 17:46:36 latitude onedriver[20609]:         /builddir/build/BUILD/onedriver-0.12.0/fs/upload_manager.go:37 +0x176
Jan 31 17:46:36 latitude onedriver[20609]: github.com/jstaf/onedriver/fs.NewFilesystem(0xc0001ac1e0, {0xc0001ce140, 0x0})
Jan 31 17:46:36 latitude onedriver[20609]:         /builddir/build/BUILD/onedriver-0.12.0/fs/cache.go:102 +0x39e
Jan 31 17:46:36 latitude onedriver[20609]: main.main()
Jan 31 17:46:36 latitude onedriver[20609]:         /builddir/build/BUILD/onedriver-0.12.0/main.go:118 +0x8b8
Jan 31 17:46:36 latitude systemd[2294]: onedriver@home-sweethuman-OneDrive.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Jan 31 17:46:36 latitude fusermount[20949]: /usr/bin/fusermount: entry for /home/sweethuman/OneDrive not found in /etc/mtab
Jan 31 17:46:36 latitude systemd[2294]: onedriver@home-sweethuman-OneDrive.service: Control process exited, code=exited, status=1/FAILURE
Jan 31 17:46:36 latitude systemd[2294]: onedriver@home-sweethuman-OneDrive.service: Failed with result 'exit-code'.
Jan 31 17:46:36 latitude systemd[2294]: onedriver@home-sweethuman-OneDrive.service: Consumed 10.721s CPU time.
Jan 31 17:46:39 latitude systemd[2294]: onedriver@home-sweethuman-OneDrive.service: Scheduled restart job, restart counter is at 9.
Jan 31 17:46:39 latitude systemd[2294]: Stopped onedriver.

I keep getting this error when I access the ondriver folder, regardless if I started the onerdriver using systemd or GUI. Onedriver info:

Information for package onedriver:
----------------------------------
Repository     : Copr repo for onedriver owned by jstaf
Name           : onedriver
Version        : 0.12.0-1.suse.tw
Arch           : x86_64
Vendor         : Fedora Copr - user jstaf
Installed Size : 7.7 MiB
Installed      : Yes
Status         : up-to-date
Source package : onedriver-0.12.0-1.suse.tw.src
Summary        : A native Linux filesystem for Microsoft Onedrive
Description    : 
    Onedriver is a native Linux filesystem for Microsoft Onedrive. Files and
    metadata are downloaded on-demand with the goal of having no local state to
    break.

If i start it like this: onedriver ~/OneDrive/ it works without crashing. It just says that the keys are expired, reauthenticating and i can see and read the folder contents without a problem.

jstaf commented 2 years ago

I'm not sure how, but the cache db for the copy of onedriver mounted via the systemd unit is corrupted somehow, it's trying to seek in an increment of 2147483647, the highest value a signed int32 can go.

Not sure how this happened, but this is an easy fix. The reason the onedriver ~/OneDrive command works is it has a different DB. Either copy over the working onedriver.db to the account (cp ~/.cache/onedriver/onedriver.db ~/.cache/onedriver/home-sweethuman-OneDrive/onedriver.db`) or just delete the drive from the GUI and readd it. Both of these steps will purge the bad db and start fresh with the existing one that's good (1st option) or a new one (2nd option). Feel free to make a backup of the old db beforehand if you want.