Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: c8703286af07
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: eeb744b13dbc
Choose a head ref
  • 7 commits
  • 10 files changed
  • 2 contributors

Commits on Nov 15, 2016

  1. Copy the full SHA
    4321d0e View commit details
  2. Move Solaris File#flock specs in a different describe

    * Both before/after were running.
    eregon committed Nov 15, 2016
    Copy the full SHA
    45e9e5b View commit details
  3. Fix UDPSocket.new spec, Solaris reports a different error on unknown …

    …protocol family.
    Stefan Anzinger authored and eregon committed Nov 15, 2016
    Copy the full SHA
    d5a1e62 View commit details
  4. Copy the full SHA
    72f7f4b View commit details
  5. Copy the full SHA
    70281d2 View commit details
  6. [Truffle] Fix Stat.dev_{major,minor} for Solaris/SPARCv9.

    Stefan Anzinger authored and eregon committed Nov 15, 2016
    Copy the full SHA
    525d631 View commit details
  7. Solaris returns -1 on rdev on ordinary files; update test to use /dev…

    …/zfs on Solaris.
    Stefan Anzinger authored and eregon committed Nov 15, 2016
    Copy the full SHA
    eeb744b View commit details
10 changes: 5 additions & 5 deletions lib/ruby/truffle/pr-zlib/lib/pr/rbzlib.rb
Original file line number Diff line number Diff line change
@@ -241,19 +241,19 @@ def -(dec)
end

def [](idx)
@buffer[(idx * 2) + @offset, 2].unpack('S').first
@buffer[(idx * 2) + @offset, 2].unpack('v').first
end

def []=(idx, val)
@buffer[(idx * 2) + @offset, 2] = [val].pack('S')
@buffer[(idx * 2) + @offset, 2] = [val].pack('v')
end

def get()
@buffer[@offset, 2].unpack('S').first
@buffer[@offset, 2].unpack('v').first
end

def set(val)
@buffer[@offset, 2] = [val].pack('S')
@buffer[@offset, 2] = [val].pack('v')
end
end

@@ -669,7 +669,7 @@ def getLong(s)

s.z_err = Z_DATA_ERROR if (c == Z_EOF)

return (x.unpack('L').first)
return (x.unpack('v').first)
end

# Check the gzip header of a gz_stream opened for reading. Set the stream
4 changes: 3 additions & 1 deletion spec/ruby/core/file/flock_spec.rb
Original file line number Diff line number Diff line change
@@ -71,8 +71,10 @@
f2.flock(File::LOCK_UN).should == 0
end
end
end

platform_is :solaris, :java do
platform_is :solaris, :java do
describe "File#flock on Solaris or Java" do
before :each do
@read_file = File.open @name, "r"
@write_file = File.open @name, "w"
13 changes: 10 additions & 3 deletions spec/ruby/core/file/stat/rdev_major_spec.rb
Original file line number Diff line number Diff line change
@@ -2,12 +2,19 @@

describe "File::Stat#rdev_major" do
before :each do
@name = tmp("file.txt")
touch(@name)
platform_is :solaris do
@name = "/dev/zfs"
end
platform_is_not :solaris do
@name = tmp("file.txt")
touch(@name)
end
end

after :each do
rm_r @name
platform_is_not :solaris do
rm_r @name
end
end

platform_is_not :windows do
13 changes: 10 additions & 3 deletions spec/ruby/core/file/stat/rdev_minor_spec.rb
Original file line number Diff line number Diff line change
@@ -2,12 +2,19 @@

describe "File::Stat#rdev_minor" do
before :each do
@name = tmp("file.txt")
touch(@name)
platform_is :solaris do
@name = "/dev/zfs"
end
platform_is_not :solaris do
@name = tmp("file.txt")
touch(@name)
end
end

after :each do
rm_r @name
platform_is_not :solaris do
rm_r @name
end
end

platform_is_not :windows do
14 changes: 12 additions & 2 deletions spec/ruby/library/socket/udpsocket/new_spec.rb
Original file line number Diff line number Diff line change
@@ -26,7 +26,17 @@
@socket.should be_an_instance_of(UDPSocket)
end

it 'raises Errno::EAFNOSUPPORT if unsupported family passed' do
lambda { UDPSocket.new(-1) }.should raise_error(Errno::EAFNOSUPPORT)
platform_is_not :solaris do
it 'raises Errno::EAFNOSUPPORT if unsupported family passed' do
lambda { UDPSocket.new(-1) }.should raise_error(Errno::EAFNOSUPPORT)
end
end

platform_is :solaris do
# Solaris throws error EPROTONOSUPPORT if the protocol family is not recognized.
# https://docs.oracle.com/cd/E19253-01/816-5170/socket-3socket/index.html
it 'raises Errno::EPROTONOSUPPORT if unsupported family passed' do
lambda { UDPSocket.new(-1) }.should raise_error(Errno::EPROTONOSUPPORT)
end
end
end
4 changes: 2 additions & 2 deletions spec/truffle/tags/core/file/flock_tags.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fails:File#flock blocks if trying to lock an exclusively locked file
fails:File#flock returns 0 if trying to lock a non-exclusively locked file
fails:File#flock fails with EBADF acquiring exclusive lock on read-only File
fails:File#flock fails with EBADF acquiring shared lock on read-only File
fails:File#flock on Solaris or Java fails with EBADF acquiring exclusive lock on read-only File
fails:File#flock on Solaris or Java fails with EBADF acquiring shared lock on read-only File
slow:File#flock returns false if trying to lock an exclusively locked file
8 changes: 2 additions & 6 deletions truffle/src/main/java/org/jruby/truffle/RubyEngine.java
Original file line number Diff line number Diff line change
@@ -64,7 +64,7 @@ private Source loadSource(String source, String name) {

public int doCheckSyntax(InputStream in, String filename) {
// check primary script
boolean status = checkStreamSyntax(in, filename);
boolean status = checkSyntax(in, filename);

// check other scripts specified on argv
for (String arg : context.getInstanceConfig().getArgv()) {
@@ -78,7 +78,7 @@ private boolean checkFileSyntax(String filename) {
File file = new File(filename);
if (file.exists()) {
try {
return checkStreamSyntax(new FileInputStream(file), filename);
return checkSyntax(new FileInputStream(file), filename);
} catch (FileNotFoundException fnfe) {
context.getInstanceConfig().getError().println("File not found: " + filename);
return false;
@@ -88,10 +88,6 @@ private boolean checkFileSyntax(String filename) {
}
}

private boolean checkStreamSyntax(InputStream in, String filename) {
return checkSyntax(in, filename);
}

public boolean checkSyntax(InputStream in, String filename) {
context.setSyntaxCheckInputStream(in);
context.setOriginalInputFile(filename);
Original file line number Diff line number Diff line change
@@ -9,6 +9,8 @@
*/
package org.jruby.truffle.extra;

import com.kenai.jffi.Platform;
import com.kenai.jffi.Platform.OS;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.Cached;
@@ -517,18 +519,26 @@ public int flock(int fd, int constant) {
public abstract static class MajorNode extends CoreMethodArrayArgumentsNode {

@Specialization
public int major(int dev) {
return (dev >> 24) & 255;
}
public int major(long dev) {
if (Platform.getPlatform().getOS() == OS.SOLARIS) {
return (int) (dev >> 32); // Solaris has major number in the upper 32 bits.
} else {
return (int) ((dev >> 24) & 0xff);

}
}
}

@CoreMethod(names = "minor", isModuleFunction = true, required = 1, lowerFixnum = 1, unsafe = UnsafeGroup.IO)
public abstract static class MinorNode extends CoreMethodArrayArgumentsNode {

@Specialization
public int minor(int dev) {
return (dev & 16777215);
public int minor(long dev) {
if (Platform.getPlatform().getOS() == OS.SOLARIS) {
return (int) dev; // Solaris has minor number in the lower 32 bits.
} else {
return (int) (dev & 0xffffff);
}
}

}
13 changes: 8 additions & 5 deletions truffle/src/main/ruby/core/process.rb
Original file line number Diff line number Diff line change
@@ -57,11 +57,14 @@ module Constants
RLIMIT_SBSIZE = Rubinius::Config['rbx.platform.process.RLIMIT_SBSIZE']
RLIMIT_STACK = Rubinius::Config['rbx.platform.process.RLIMIT_STACK']

RLIMIT_RTPRIO = Rubinius::Config['rbx.platform.process.RLIMIT_RTPRIO']
RLIMIT_RTTIME = Rubinius::Config['rbx.platform.process.RLIMIT_RTTIME']
RLIMIT_SIGPENDING = Rubinius::Config['rbx.platform.process.RLIMIT_SIGPENDING']
RLIMIT_MSGQUEUE = Rubinius::Config['rbx.platform.process.RLIMIT_MSGQUEUE']
RLIMIT_NICE = Rubinius::Config['rbx.platform.process.RLIMIT_NICE']
has_rlimit_rtprio = Rubinius::Config['rbx.platform.process.RLIMIT_RTPRIO']
if has_rlimit_rtprio
RLIMIT_RTPRIO = Rubinius::Config['rbx.platform.process.RLIMIT_RTPRIO']
RLIMIT_RTTIME = Rubinius::Config['rbx.platform.process.RLIMIT_RTTIME']
RLIMIT_SIGPENDING = Rubinius::Config['rbx.platform.process.RLIMIT_SIGPENDING']
RLIMIT_MSGQUEUE = Rubinius::Config['rbx.platform.process.RLIMIT_MSGQUEUE']
RLIMIT_NICE = Rubinius::Config['rbx.platform.process.RLIMIT_NICE']
end

WNOHANG = 1
WUNTRACED = 2
2 changes: 1 addition & 1 deletion truffle/src/main/ruby/core/stat.rb
Original file line number Diff line number Diff line change
@@ -197,7 +197,7 @@ def dev_major
end

def dev_minor
minor = Truffle::POSIX.major dev
minor = Truffle::POSIX.minor dev
minor < 0 ? nil : minor
end