From 49217b19f33540e0342e71c4f05e49c99fc712d5 Mon Sep 17 00:00:00 2001 From: Oskar Eichler Date: Fri, 28 Aug 2026 02:49:28 +0300 Subject: [PATCH 1/2] Normalize path-like objects before retaining the store filename --- lib/pstore.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pstore.rb b/lib/pstore.rb index e730be2..ce637cb 100644 --- a/lib/pstore.rb +++ b/lib/pstore.rb @@ -380,7 +380,7 @@ def initialize(file, thread_safe = false) if File::exist? file and not File::readable? file raise PStore::Error, format("file %s not readable", file) end - @filename = file + @filename = File.path(file) @abort = false @ultra_safe = false @thread_safe = thread_safe From a937e6c08ba5d5332dbb25159ad3253d90f4a965 Mon Sep 17 00:00:00 2001 From: Oskar Eichler <62393985+OskarEichler@users.noreply.github.com> Date: Fri, 28 Aug 2026 15:00:02 +0300 Subject: [PATCH 2/2] test: cover PStore regression --- test/test_pstore.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/test_pstore.rb b/test/test_pstore.rb index 4a65e4f..c4141a2 100644 --- a/test/test_pstore.rb +++ b/test/test_pstore.rb @@ -2,6 +2,7 @@ require 'test/unit' require 'pstore' require 'tmpdir' +require 'pathname' class PStoreTest < Test::Unit::TestCase def setup @@ -190,4 +191,14 @@ def clear_store def second_file File.join(Dir.tmpdir, "pstore.tmp2.#{Process.pid}") end + def test_path_like_filename_is_normalized + store = PStore.new(Pathname(@pstore_file)) + store.ultra_safe = true + store.transaction { store[:foo] = "bar" } + + assert_instance_of(String, store.path) + assert_equal(@pstore_file, store.path) + assert_equal("bar", store.transaction(true) { store[:foo] }) + end + end