[PR #9305] [MERGED] ml/backend/ggml: avoid std::filesystem code with undefined behavior #12913

Closed
opened 2026-04-13 00:12:36 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/9305
Author: @jmorganca
Created: 2/24/2025
Status: Merged
Merged: 2/24/2025
Merged by: @jmorganca

Base: mainHead: jmorganca/fix-patch-18


📝 Commits (1)

  • 533999d ml/backend/ggml: avoid std::filesystem code with undefined behavior

📊 Changes

2 files changed (+101 additions, -63 deletions)

View changed files

📝 llama/patches/0018-use-std-filesystem-path-instead-of-wstring.patch (+69 -39)
📝 ml/backend/ggml/ggml/src/ggml-backend-reg.cpp (+32 -24)

📄 Description

Calling .wstring() and .string() on an std::filesystem::path is implementation-defined and sometimes leads to crashes. This code avoids using these two member functions instead of assuming conversion between wchar_t * and char *, which is not implemented in LLVM 19 on Windows. It also avoids using the deprecated codecvt_utf8_utf16.


🔄 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/9305 **Author:** [@jmorganca](https://github.com/jmorganca) **Created:** 2/24/2025 **Status:** ✅ Merged **Merged:** 2/24/2025 **Merged by:** [@jmorganca](https://github.com/jmorganca) **Base:** `main` ← **Head:** `jmorganca/fix-patch-18` --- ### 📝 Commits (1) - [`533999d`](https://github.com/ollama/ollama/commit/533999d8b8c0a64e68ee0462caecc392334b3ad7) ml/backend/ggml: avoid std::filesystem code with undefined behavior ### 📊 Changes **2 files changed** (+101 additions, -63 deletions) <details> <summary>View changed files</summary> 📝 `llama/patches/0018-use-std-filesystem-path-instead-of-wstring.patch` (+69 -39) 📝 `ml/backend/ggml/ggml/src/ggml-backend-reg.cpp` (+32 -24) </details> ### 📄 Description Calling `.wstring()` and `.string()` on an `std::filesystem::path` is implementation-defined and sometimes leads to crashes. This code avoids using these two member functions instead of assuming conversion between `wchar_t *` and `char *`, which is not implemented in LLVM 19 on Windows. It also avoids using the deprecated `codecvt_utf8_utf16`. --- <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 00:12: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#12913