[PR #15164] fix(fileutil): use user-scoped temp directory for backups #40932

Open
opened 2026-04-23 01:42:39 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15164
Author: @Junior00619
Created: 3/31/2026
Status: 🔄 Open

Base: mainHead: fix/user-scoped-backup-dir


📝 Commits (1)

  • ae3407c fix(fileutil): use user-scoped temp directory for backups

📊 Changes

3 files changed (+8 additions, -5 deletions)

View changed files

📝 cmd/internal/fileutil/files.go (+5 -3)
📝 cmd/launch/droid_test.go (+1 -1)
📝 cmd/launch/openclaw_test.go (+2 -1)

📄 Description

On multi-user systems the shared /tmp/ollama-backups directory causes two problems:

  1. Permission conflict: the first user creates the directory with mode 755, so a second user gets EACCES when trying to write their own backup files.
  2. Privacy: backup files (which may contain user configuration) are readable by any local user.

Use os.Getuid() to make each user's backup directory unique, e.g. /tmp/ollama-backups-1000. Set the directory mode to 0700 so only the owning user can access it.

Update tests to call fileutil.BackupDir() instead of reproducing the path construction inline, so they stay in sync with future changes.

Fixes #15130


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/15164 **Author:** [@Junior00619](https://github.com/Junior00619) **Created:** 3/31/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/user-scoped-backup-dir` --- ### 📝 Commits (1) - [`ae3407c`](https://github.com/ollama/ollama/commit/ae3407cce4edca6f0cedf8ddb7a0302794f9d113) fix(fileutil): use user-scoped temp directory for backups ### 📊 Changes **3 files changed** (+8 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `cmd/internal/fileutil/files.go` (+5 -3) 📝 `cmd/launch/droid_test.go` (+1 -1) 📝 `cmd/launch/openclaw_test.go` (+2 -1) </details> ### 📄 Description On multi-user systems the shared /tmp/ollama-backups directory causes two problems: 1. Permission conflict: the first user creates the directory with mode 755, so a second user gets EACCES when trying to write their own backup files. 2. Privacy: backup files (which may contain user configuration) are readable by any local user. Use os.Getuid() to make each user's backup directory unique, e.g. /tmp/ollama-backups-1000. Set the directory mode to 0700 so only the owning user can access it. Update tests to call fileutil.BackupDir() instead of reproducing the path construction inline, so they stay in sync with future changes. Fixes #15130 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-23 01:42:39 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#40932