1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
## 940_test_file_exhaustive_fails_as_root.dpatch by Lucas Nussbaum <lucas@lucas-nussbaum.net>
4
## All lines beginning with `## DP:' are a description of the patch.
5
## DP: several tests fail when building as root.
6
## DP: see http://redmine.ruby-lang.org/issues/show/1170
9
diff -urNad ruby1.9-1.9.1.0~/test/ruby/test_file_exhaustive.rb ruby1.9-1.9.1.0/test/ruby/test_file_exhaustive.rb
10
--- ruby1.9-1.9.1.0~/test/ruby/test_file_exhaustive.rb 2009-01-12 14:33:08.000000000 +0100
11
+++ ruby1.9-1.9.1.0/test/ruby/test_file_exhaustive.rb 2009-02-18 14:52:37.000000000 +0100
15
return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM
16
+ return if Process.euid == 0
17
File.chmod(0200, @file)
18
assert(!(File.readable?(@file)))
19
File.chmod(0600, @file)
22
def test_readable_real_p
23
return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM
24
+ return if Process.euid == 0
25
File.chmod(0200, @file)
26
assert(!(File.readable_real?(@file)))
27
File.chmod(0600, @file)
31
return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM
32
+ return if Process.euid == 0
33
File.chmod(0400, @file)
34
assert(!(File.writable?(@file)))
35
File.chmod(0600, @file)
38
def test_writable_real_p
39
return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM
40
+ return if Process.euid == 0
41
File.chmod(0400, @file)
42
assert(!(File.writable_real?(@file)))
43
File.chmod(0600, @file)
46
def test_owned_p ## xxx
47
return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM
48
+ return if Process.euid == 0 # only needed on HPPA?
49
assert(File.owned?(@file))
50
assert(File.grpowned?(@file))
54
def test_stat_readable_p
55
return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM
56
+ return if Process.euid == 0
57
File.chmod(0200, @file)
58
assert(!(File::Stat.new(@file).readable?))
59
File.chmod(0600, @file)
62
def test_stat_readable_real_p
63
return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM
64
+ return if Process.euid == 0
65
File.chmod(0200, @file)
66
assert(!(File::Stat.new(@file).readable_real?))
67
File.chmod(0600, @file)
70
def test_stat_writable_p
71
return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM
72
+ return if Process.euid == 0
73
File.chmod(0400, @file)
74
assert(!(File::Stat.new(@file).writable?))
75
File.chmod(0600, @file)
78
def test_stat_writable_real_p
79
return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM
80
+ return if Process.euid == 0
81
File.chmod(0400, @file)
82
assert(!(File::Stat.new(@file).writable_real?))
83
File.chmod(0600, @file)
86
def test_stat_owned_p ## xxx
87
return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM
88
+ return if Process.euid == 0 # only needed on HPPA?
89
assert(File::Stat.new(@file).owned?)
90
assert(File::Stat.new(@file).grpowned?)