[前][次][番号順一覧][スレッド一覧]

ruby-changes:65511

From: Kazuhiro <ko1@a...>
Date: Thu, 18 Mar 2021 15:27:00 +0900 (JST)
Subject: [ruby-changes:65511] e0dd072978 (master): Fix errors when XDG_CONFIG_HOME points to non-writable directory

https://git.ruby-lang.org/ruby.git/commit/?id=e0dd072978

From e0dd072978e6c2c8180e75617e7ee37830caefa3 Mon Sep 17 00:00:00 2001
From: Kazuhiro NISHIYAMA <zn@m...>
Date: Thu, 18 Mar 2021 15:20:41 +0900
Subject: Fix errors when XDG_CONFIG_HOME points to non-writable directory

`$HOME/.config` is not writable on CI
because I think tests should not corrupt user's data.

And GitHub Actions CI sets `XDG_CONFIG_HOME`
since `Version: 20210309.1`.

https://github.com/ruby/actions/runs/2130811016?check_suite_focus=true#step:16:301
```
Errno::EACCES: Permission denied @ dir_s_mkdir - /home/runner/.config/irb
```
---
 test/irb/test_cmd.rb | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/test/irb/test_cmd.rb b/test/irb/test_cmd.rb
index 41f84f1..16f5940 100644
--- a/test/irb/test_cmd.rb
+++ b/test/irb/test_cmd.rb
@@ -17,12 +17,14 @@ module TestIRB https://github.com/ruby/ruby/blob/trunk/test/irb/test_cmd.rb#L17
       Dir.chdir(@tmpdir)
       @home_backup = ENV["HOME"]
       ENV["HOME"] = @tmpdir
+      @xdg_config_home_backup = ENV.delete("XDG_CONFIG_HOME")
       @default_encoding = [Encoding.default_external, Encoding.default_internal]
       @stdio_encodings = [STDIN, STDOUT, STDERR].map {|io| [io.external_encoding, io.internal_encoding] }
       IRB.instance_variable_get(:@CONF).clear
     end
 
     def teardown
+      ENV["XDG_CONFIG_HOME"] = @xdg_config_home_backup
       ENV["HOME"] = @home_backup
       Dir.chdir(@pwd)
       FileUtils.rm_rf(@tmpdir)
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]