From 530a901de3cf62d81639229c8299ace39a8da5a7 Mon Sep 17 00:00:00 2001 From: Qingwei Li <332664203@qq.com> Date: Sat, 10 Jan 2026 00:10:02 +0800 Subject: [PATCH 1/2] oracleobjectstorage, sftp: eliminate unnecessary heap allocation Move the declaration location of variables to eliminate heap allocation which may make rclone faster and reduce memory usage slightly. Fixes #9078 --- backend/ftp/ftp.go | 4 ++-- backend/oracleobjectstorage/waiter.go | 9 ++++----- cmd/serve/sftp/connection.go | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/backend/ftp/ftp.go b/backend/ftp/ftp.go index 88ddc1008a2d6..5b73801b059ec 100644 --- a/backend/ftp/ftp.go +++ b/backend/ftp/ftp.go @@ -898,7 +898,7 @@ func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err e resultchan := make(chan []*ftp.Entry, 1) errchan := make(chan error, 1) - go func() { + go func(c *ftp.ServerConn) { result, err := c.List(f.dirFromStandardPath(path.Join(f.root, dir))) f.putFtpConnection(&c, err) if err != nil { @@ -906,7 +906,7 @@ func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err e return } resultchan <- result - }() + }(c) // Wait for List for up to Timeout seconds timer := time.NewTimer(f.ci.TimeoutOrInfinite()) diff --git a/backend/oracleobjectstorage/waiter.go b/backend/oracleobjectstorage/waiter.go index d09f00033fd00..ec6dc7463a350 100644 --- a/backend/oracleobjectstorage/waiter.go +++ b/backend/oracleobjectstorage/waiter.go @@ -60,9 +60,6 @@ type StateChangeConf struct { func (conf *StateChangeConf) WaitForStateContext(ctx context.Context, entityType string) (any, error) { // fs.Debugf(entityType, "Waiting for state to become: %s", conf.Target) - notfoundTick := 0 - targetOccurrence := 0 - // Set a default for times to check for not found if conf.NotFoundChecks == 0 { conf.NotFoundChecks = 20 @@ -84,9 +81,11 @@ func (conf *StateChangeConf) WaitForStateContext(ctx context.Context, entityType // cancellation channel for the refresh loop cancelCh := make(chan struct{}) - result := Result{} - go func() { + notfoundTick := 0 + targetOccurrence := 0 + result := Result{} + defer close(resCh) select { diff --git a/cmd/serve/sftp/connection.go b/cmd/serve/sftp/connection.go index 5d174c2ab362d..a9282fc5bb3be 100644 --- a/cmd/serve/sftp/connection.go +++ b/cmd/serve/sftp/connection.go @@ -291,7 +291,7 @@ func (c *conn) handleChannel(newChannel ssh.NewChannel) { } } fs.Debugf(c.what, " - accepted: %v\n", ok) - err = req.Reply(ok, reply) + err := req.Reply(ok, reply) if err != nil { fs.Errorf(c.what, "Failed to Reply to request: %v", err) return From e51a0599a0ee226865994749c5f95bfe70a1af49 Mon Sep 17 00:00:00 2001 From: dougal <147946567+roucc@users.noreply.github.com> Date: Fri, 9 Jan 2026 16:30:01 +0000 Subject: [PATCH 2/2] log: fix systemd adding extra newline - fixes #9086 This was broken in v1.71.0 as a typo. --- fs/log/systemd_unix.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/log/systemd_unix.go b/fs/log/systemd_unix.go index fa29b203c1da2..8ea34f1e89f28 100644 --- a/fs/log/systemd_unix.go +++ b/fs/log/systemd_unix.go @@ -16,7 +16,7 @@ func startSystemdLog(handler *OutputHandler) bool { handler.clearFormatFlags(logFormatDate | logFormatTime | logFormatMicroseconds | logFormatUTC | logFormatLongFile | logFormatShortFile | logFormatPid) handler.setFormatFlags(logFormatNoLevel) handler.SetOutput(func(level slog.Level, text string) { - _ = journal.Print(slogLevelToSystemdPriority(level), "%-6s: %s\n", level, text) + _ = journal.Print(slogLevelToSystemdPriority(level), "%-6s: %s", level, text) }) return true }