SIGSEGV crash on Google Drive upload from pipe (in code fix/workaround available)

What is the problem you are having with rclone?

I was consistently getting SIGSEGV crash on rclone sync from Google Drive to local directory. The problem always happened on the same file (see log below). It didn't matter if I answered y or n to "rclone: upload from pipe "REDACTED.docx.95f243d1.partial"?" question. I always got a SIGSEGV.

I was able to build rclone from source, reproduce the problem and apply a workaround in code (I'm not sure if nil is the right value to return here, but it prevents the segfault since dst is clearly nil in my case):

diff --git a/fs/operations/operations.go b/fs/operations/operations.go
index eeba711fb..7e07778e6 100644
--- a/fs/operations/operations.go
+++ b/fs/operations/operations.go
@@ -86,6 +86,9 @@ func checkHashes(ctx context.Context, src fs.ObjectInfo, dst fs.Object, ht hash.
                return nil
        })
        g.Go(func() (err error) {
+               if dst == nil {
+                       return nil
+               }
                dstHash, dstErr = dst.Hash(ctx, ht)
                if dstErr != nil {
                        return dstErr

Unfortunately once the sync went through with the fixes above, I no longer have these .partial files to sync so I can't reproduce the issue anymore (and provide -vv log).

Run the command 'rclone version' and share the full output of the command.

rclone v1.68.2
- os/version: arch (64 bit)
- os/kernel: 6.12.4-arch1-1 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.23.3
- go/linking: dynamic
- go/tags: none

Which cloud storage system are you using? (eg Google Drive)

Google Drive

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone sync --interactive GoogleDrive_pasza: ~/GoogleDrive

The rclone config contents with secrets removed.

[GoogleDrive_pasza]
type = drive
client_id = REDACTED.apps.googleusercontent.com
client_secret = REDACTED
scope = drive
token = {"access_token":"REDACTED","token_type":"Bearer","refresh_token":"REDACTED","expiry":"2024-12-12T13:12:14.975769753+01:00"}
team_drive = 

A log from the command with the -vv flag

Unfortunately I can no longer reproduce the issue (and run with -vv), however this should be enough to pinpoint it:

rclone: upload from pipe "REDACTED.docx.95f243d1.partial"?
y) Yes, this is OK (default)
n) No, skip this
s) Skip all upload from pipe operations with no more questions
!) Do all upload from pipe operations with no more questions
q) Exit rclone now.
y/n/s/!/q> n
2024/12/12 12:12:44 NOTICE: REDACTED.docx.95f243d1.partial: Skipped upload from pipe as --interactive is set

y/n/s/!/q> panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x616ce94b0c39]

goroutine 1095 [running]:
github.com/rclone/rclone/fs/operations.checkHashes.func2()
        github.com/rclone/rclone/fs/operations/operations.go:89 +0x39
golang.org/x/sync/errgroup.(*Group).Go.func1()
        golang.org/x/sync@v0.8.0/errgroup/errgroup.go:78 +0x50
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 131
        golang.org/x/sync@v0.8.0/errgroup/errgroup.go:75 +0x96