From eb5a5db74d29fd6369e9871ba1bb254aa0f22f42 Mon Sep 17 00:00:00 2001
From: Jiaying Song <jiaying.song.cn@windriver.com>
Date: Mon, 7 Jul 2025 15:05:57 +0800
Subject: [PATCH] Skip test_rm_r_no_permissions test under root

Skip test_rm_r_no_permissions test under root user and Windows environments since deletion always succeeds.

Upstream-Status: Submitted [https://github.com/ruby/ruby/pull/13828/commits/c510b5ac475e6d3eef935725d21910861816b7a9]

Signed-off-by: Jiaying Song <jiaying.song.cn@windriver.com>
---
 test/fileutils/test_fileutils.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb
index d2096a0..80e3368 100644
--- a/test/fileutils/test_fileutils.rb
+++ b/test/fileutils/test_fileutils.rb
@@ -768,8 +768,8 @@ class TestFileUtils < Test::Unit::TestCase
 
   def test_rm_r_no_permissions
     check_singleton :rm_rf
-
-    return if /mswin|mingw/ =~ RUBY_PLATFORM
+    
+    return if Process.uid == 0 || /mswin|mingw/ =~ RUBY_PLATFORM
 
     mkdir 'tmpdatadir'
     touch 'tmpdatadir/tmpdata'
