Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Make chmod coerce_to Integer, not clamp_short mode #1907

Closed
wants to merge 1 commit into from

2 participants

@tonysidaway

This is necessary to make OpenBSD chmod mimic MRI behaviour.

@dbussink
Owner

We explicitly added this behavior in 8e5aa8a. It looks like @brixen decided here that we don't want to be bug for bug compatible in this case with MRI.

@tonysidaway

I'll revise the test set to reflect the results on OpenBSD with "clamp_short mode"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 kernel/common/file.rb
View
4 kernel/common/file.rb
@@ -173,7 +173,7 @@ def self.chardev?(path)
#
# File.chmod(0644, "testfile", "out") #=> 2
def self.chmod(mode, *paths)
- mode = clamp_short mode
+ mode = Rubinius::Type.coerce_to(mode, Integer, :to_int)
paths.each do |path|
n = POSIX.chmod Rubinius::Type.coerce_to_path(path), mode
@@ -232,7 +232,7 @@ def self.chown(owner, group, *paths)
def chmod(mode)
mode = Rubinius::Type.coerce_to(mode, Integer, :to_int)
- n = POSIX.fchmod @descriptor, clamp_short(mode)
+ n = POSIX.fchmod @descriptor, mode
Errno.handle if n == -1
n
end
Something went wrong with that request. Please try again.