[PR #14856] fix(readline): respect USERPROFILE env var for portable installations #14876

Open
opened 2026-04-13 01:04:36 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/14856
Author: @LincolnBurrows2017
Created: 3/14/2026
Status: 🔄 Open

Base: mainHead: fix-readline-userprofile


📝 Commits (2)

  • 22cc767 fix: correct json.Unmarshal error handling logic in openclaw.go
  • 90de8ae fix(readline): respect USERPROFILE env var for portable installations

📊 Changes

2 files changed (+13 additions, -6 deletions)

View changed files

📝 cmd/launch/openclaw.go (+3 -3)
📝 readline/history.go (+10 -3)

📄 Description

Summary

In readline/history.go, the Init() function uses os.UserHomeDir() which on Windows does not respect changes to the %USERPROFILE% environment variable.

This breaks portable Ollama installations that want to change the chat history file location by modifying environment variables.

Fix

Added environment variable check:

home := os.Getenv("HOME")
if home == "" {
    home = os.Getenv("USERPROFILE")
}
if home == "" {
    var err error
    home, err = os.UserHomeDir()
    ...
}

🔄 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/14856 **Author:** [@LincolnBurrows2017](https://github.com/LincolnBurrows2017) **Created:** 3/14/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix-readline-userprofile` --- ### 📝 Commits (2) - [`22cc767`](https://github.com/ollama/ollama/commit/22cc767ae7f8a46ec5499c6609c1164e2fce5e5b) fix: correct json.Unmarshal error handling logic in openclaw.go - [`90de8ae`](https://github.com/ollama/ollama/commit/90de8ae47ac4ea79ff0605a90cdc2c84cec4e733) fix(readline): respect USERPROFILE env var for portable installations ### 📊 Changes **2 files changed** (+13 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `cmd/launch/openclaw.go` (+3 -3) 📝 `readline/history.go` (+10 -3) </details> ### 📄 Description ## Summary In `readline/history.go`, the `Init()` function uses `os.UserHomeDir()` which on Windows does not respect changes to the `%USERPROFILE%` environment variable. This breaks portable Ollama installations that want to change the chat history file location by modifying environment variables. ## Fix Added environment variable check: ```go home := os.Getenv("HOME") if home == "" { home = os.Getenv("USERPROFILE") } if home == "" { var err error home, err = os.UserHomeDir() ... } ``` --- <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-13 01:04:36 -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#14876