Bug #13972 ยป 0001-file.c-document-File.-setuid-setgid-sticky-support-f.patch
| NEWS | ||
|---|---|---|
|
* File.stat, File.exist?, and other rb_stat()-using methods release GVL
|
||
|
[Bug #13941]
|
||
|
* File.rename releases GVL [Feature #13951]
|
||
|
* File.setuid?, File.setgid?, File.sticky? accept bare IO objects
|
||
|
in addition to file names.
|
||
|
* Hash
|
||
| file.c | ||
|---|---|---|
|
* File.setuid?(file_name) -> true or false
|
||
|
*
|
||
|
* Returns <code>true</code> if the named file has the setuid bit set.
|
||
|
*
|
||
|
* _file_name_ can be an IO object.
|
||
|
*/
|
||
|
static VALUE
|
||
| ... | ... | |
|
* File.setgid?(file_name) -> true or false
|
||
|
*
|
||
|
* Returns <code>true</code> if the named file has the setgid bit set.
|
||
|
*
|
||
|
* _file_name_ can be an IO object.
|
||
|
*/
|
||
|
static VALUE
|
||
| ... | ... | |
|
* File.sticky?(file_name) -> true or false
|
||
|
*
|
||
|
* Returns <code>true</code> if the named file has the sticky bit set.
|
||
|
*
|
||
|
* _file_name_ can be an IO object.
|
||
|
*/
|
||
|
static VALUE
|
||
| test/ruby/test_file_exhaustive.rb | ||
|---|---|---|
|
assert_file.grpowned?(utf8_file)
|
||
|
end if POSIX
|
||
|
def io_open(file_name)
|
||
|
# avoid File.open since we do not want #to_path
|
||
|
io = IO.for_fd(IO.sysopen(file_name))
|
||
|
yield io
|
||
|
ensure
|
||
|
io&.close
|
||
|
end
|
||
|
def test_suid
|
||
|
assert_file.not_setuid?(regular_file)
|
||
|
assert_file.not_setuid?(utf8_file)
|
||
|
assert_file.setuid?(suidfile) if suidfile
|
||
|
if suidfile
|
||
|
assert_file.setuid?(suidfile)
|
||
|
io_open(suidfile) { |io| assert_file.setuid?(io) }
|
||
|
end
|
||
|
end
|
||
|
def test_sgid
|
||
|
assert_file.not_setgid?(regular_file)
|
||
|
assert_file.not_setgid?(utf8_file)
|
||
|
assert_file.setgid?(sgidfile) if sgidfile
|
||
|
if sgidfile
|
||
|
assert_file.setgid?(sgidfile)
|
||
|
io_open(sgidfile) { |io| assert_file.setgid?(io) }
|
||
|
end
|
||
|
end
|
||
|
def test_sticky
|
||
|
assert_file.not_sticky?(regular_file)
|
||
|
assert_file.not_sticky?(utf8_file)
|
||
|
assert_file.sticky?(stickyfile) if stickyfile
|
||
|
if stickyfile
|
||
|
assert_file.sticky?(stickyfile)
|
||
|
io_open(stickyfile) { |io| assert_file.sticky?(io) }
|
||
|
end
|
||
|
end
|
||
|
def test_path_identical_p
|
||
|
-
|
||