Skip to content

Commit 9f0253b

Browse files
committed
Merge branch 'master' into truffle-head
2 parents 4cc6aff + 4bd351c commit 9f0253b

File tree

77 files changed

+765
-746
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+765
-746
lines changed

.travis.yml

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@ before_script:
55
- "export JAVA_OPTS='-XX:+TieredCompilation -XX:TieredStopAtLevel=1'"
66
- echo $HOME
77

8-
jdk:
9-
- openjdk7
10-
- oraclejdk8
8+
jdk: openjdk7
119

1210
os:
1311
- linux
14-
- osx
1512

1613
env:
1714
global:
@@ -32,30 +29,16 @@ env:
3229
- PHASE='-Prake -Dtask=spec:profiler'
3330
- PHASE='-Ptruffle-specs-language'
3431
- PHASE='-Ptruffle-specs-core'
32+
- PHASE='-Pmain'
33+
- PHASE='-Pcomplete'
34+
- PHASE='-Posgi'
35+
- PHASE='-Pj2ee'
36+
- PHASE='-Pjruby-jars,test -Dinvoker.test=extended'
37+
- PHASE='-Pmain,test -Dinvoker.test=extended'
38+
- PHASE='-Pjruby_complete_jar_extended -Dinvoker.skip=true'
39+
- COMMAND=test/check_versions.sh
3540

3641
matrix:
37-
include:
38-
# these profile do no need to run for all JDKs
39-
- env: PHASE='-Pdist'
40-
jdk: oraclejdk8
41-
- env: PHASE='-Pjruby-jars'
42-
jdk: openjdk7
43-
- env: PHASE='-Pmain'
44-
jdk: oraclejdk7
45-
- env: PHASE='-Pcomplete'
46-
jdk: oraclejdk8
47-
- env: PHASE='-Posgi'
48-
jdk: openjdk7
49-
- env: PHASE='-Pj2ee'
50-
jdk: oraclejdk7
51-
- env: PHASE='-Pjruby-jars,test -Dinvoker.test=extended'
52-
jdk: oraclejdk7
53-
- env: PHASE='-Pmain,test -Dinvoker.test=extended'
54-
jdk: openjdk7
55-
- env: PHASE='-Pjruby_complete_jar_extended -Dinvoker.skip=true'
56-
jdk: oraclejdk8
57-
- env: COMMAND=test/check_versions.sh
58-
jdk: oraclejdk8
5942
fast_finish: true
6043
allow_failures:
6144
- env: PHASE='-Pcomplete'

antlib/extra.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ build jruby-complete.jar
2525
<env key='GEM_PATH' value='lib/ruby/gems/shared'/>
2626
<arg value='-Djruby.home=uri:classloader://META-INF/jruby.home'/>
2727
<arg value='-cp'/>
28-
<arg value='core/target/test-classes:test/target/test-classes:lib/jruby.jar:maven/jruby-stdlib/target/jruby-stdlib-1.7.17-SNAPSHOT.jar'/>
28+
<arg value='core/target/test-classes:test/target/test-classes:lib/jruby.jar:maven/jruby-stdlib/target/jruby-stdlib-1.7.18-SNAPSHOT.jar'/>
2929
<arg value='org.jruby.Main'/>
3030
<arg value='-I.:test/externals/ruby1.9:test/externals/ruby1.9/ruby'/>
3131
<arg value='-r./test/ruby19_env.rb'/>
@@ -136,7 +136,7 @@ build jruby-complete.jar
136136
<env key='GEM_PATH' value='lib/ruby/gems/shared'/>
137137
<arg value='-Djruby.home=uri:classloader://META-INF/jruby.home'/>
138138
<arg value='-cp'/>
139-
<arg value='core/target/test-classes:test/target/test-classes:maven/jruby-complete/target/jruby-complete-1.7.17-SNAPSHOT.jar'/>
139+
<arg value='core/target/test-classes:test/target/test-classes:maven/jruby-complete/target/jruby-complete-1.7.18-SNAPSHOT.jar'/>
140140
<arg value='org.jruby.Main'/>
141141
<arg value='-I.:test/externals/ruby1.9:test/externals/ruby1.9/ruby'/>
142142
<arg value='-r./test/ruby19_env.rb'/>
@@ -152,7 +152,7 @@ build jruby-complete.jar
152152
<env key='GEM_PATH' value='lib/ruby/gems/shared'/>
153153
<arg value='-Djruby.home=uri:classloader://META-INF/jruby.home'/>
154154
<arg value='-cp'/>
155-
<arg value='core/target/test-classes:test/target/test-classes:lib/jruby.jar:maven/jruby-stdlib/target/jruby-stdlib-1.7.17-SNAPSHOT.jar'/>
155+
<arg value='core/target/test-classes:test/target/test-classes:lib/jruby.jar:maven/jruby-stdlib/target/jruby-stdlib-1.7.18-SNAPSHOT.jar'/>
156156
<arg value='org.jruby.Main'/>
157157
<arg value='-I.:test/externals/ruby1.9:test/externals/ruby1.9/ruby'/>
158158
<arg value='-r./test/ruby19_env.rb'/>
@@ -168,7 +168,7 @@ build jruby-complete.jar
168168
<env key='GEM_PATH' value='lib/ruby/gems/shared'/>
169169
<arg value='-Djruby.home=uri:classloader://META-INF/jruby.home'/>
170170
<arg value='-cp'/>
171-
<arg value='core/target/test-classes:test/target/test-classes:lib/jruby.jar:maven/jruby-stdlib/target/jruby-stdlib-1.7.17-SNAPSHOT.jar'/>
171+
<arg value='core/target/test-classes:test/target/test-classes:lib/jruby.jar:maven/jruby-stdlib/target/jruby-stdlib-1.7.18-SNAPSHOT.jar'/>
172172
<arg value='org.jruby.Main'/>
173173
<arg value='-I.:test/externals/ruby1.9:test/externals/ruby1.9/ruby'/>
174174
<arg value='-r./test/ruby19_env.rb'/>
@@ -460,7 +460,7 @@ build jruby-complete.jar
460460
<env key='GEM_PATH' value='lib/ruby/gems/shared'/>
461461
<arg value='-Djruby.home=uri:classloader://META-INF/jruby.home'/>
462462
<arg value='-cp'/>
463-
<arg value='core/target/test-classes:test/target/test-classes:maven/jruby-complete/target/jruby-complete-1.7.17-SNAPSHOT.jar'/>
463+
<arg value='core/target/test-classes:test/target/test-classes:maven/jruby-complete/target/jruby-complete-1.7.18-SNAPSHOT.jar'/>
464464
<arg value='org.jruby.Main'/>
465465
<arg value='-I.:test/externals/ruby1.9:test/externals/ruby1.9/ruby'/>
466466
<arg value='-r./test/ruby19_env.rb'/>

core/pom.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@
3131
jar 'org.ow2.asm:asm-analysis:${asm.version}'
3232
jar 'org.ow2.asm:asm-util:${asm.version}'
3333

34-
jar 'com.github.jnr:jnr-netdb:1.1.2'
35-
jar 'com.github.jnr:jnr-enxio:0.4'
34+
jar 'com.github.jnr:jnr-netdb:1.1.3'
35+
jar 'com.github.jnr:jnr-enxio:0.5'
3636
jar 'com.github.jnr:jnr-x86asm:1.0.2'
37-
jar 'com.github.jnr:jnr-unixsocket:0.3'
38-
jar 'com.github.jnr:jnr-posix:3.0.7'
39-
jar 'com.github.jnr:jnr-constants:0.8.6-SNAPSHOT'
37+
jar 'com.github.jnr:jnr-unixsocket:0.4'
38+
jar 'com.github.jnr:jnr-posix:3.0.8'
39+
jar 'com.github.jnr:jnr-constants:0.8.6'
4040
jar 'com.github.jnr:jnr-ffi:2.0.0'
4141
jar 'com.github.jnr:jffi:${jffi.version}'
4242
jar 'com.github.jnr:jffi:${jffi.version}:native'
@@ -45,7 +45,7 @@
4545
jar 'org.jruby.extras:bytelist:1.0.12'
4646
jar 'org.jruby.jcodings:jcodings:1.0.12'
4747

48-
jar 'com.headius:invokebinder:1.5-SNAPSHOT'
48+
jar 'com.headius:invokebinder:1.5'
4949
jar 'com.headius:options:1.1'
5050
jar 'com.headius:coro-mock:1.0', :scope => 'provided'
5151
jar 'com.headius:unsafe-mock', '${unsafe.version}', :scope => 'provided'

core/pom.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@
5151
<dependency>
5252
<groupId>com.github.jnr</groupId>
5353
<artifactId>jnr-netdb</artifactId>
54-
<version>1.1.2</version>
54+
<version>1.1.3</version>
5555
</dependency>
5656
<dependency>
5757
<groupId>com.github.jnr</groupId>
5858
<artifactId>jnr-enxio</artifactId>
59-
<version>0.4</version>
59+
<version>0.5</version>
6060
</dependency>
6161
<dependency>
6262
<groupId>com.github.jnr</groupId>
@@ -66,17 +66,17 @@
6666
<dependency>
6767
<groupId>com.github.jnr</groupId>
6868
<artifactId>jnr-unixsocket</artifactId>
69-
<version>0.3</version>
69+
<version>0.4</version>
7070
</dependency>
7171
<dependency>
7272
<groupId>com.github.jnr</groupId>
7373
<artifactId>jnr-posix</artifactId>
74-
<version>3.0.7</version>
74+
<version>3.0.8</version>
7575
</dependency>
7676
<dependency>
7777
<groupId>com.github.jnr</groupId>
7878
<artifactId>jnr-constants</artifactId>
79-
<version>0.8.6-SNAPSHOT</version>
79+
<version>0.8.6</version>
8080
</dependency>
8181
<dependency>
8282
<groupId>com.github.jnr</groupId>
@@ -112,7 +112,7 @@
112112
<dependency>
113113
<groupId>com.headius</groupId>
114114
<artifactId>invokebinder</artifactId>
115-
<version>1.5-SNAPSHOT</version>
115+
<version>1.5</version>
116116
</dependency>
117117
<dependency>
118118
<groupId>com.headius</groupId>

core/src/main/java/org/jruby/Ruby.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@
161161
import java.security.AccessControlException;
162162
import java.security.SecureRandom;
163163
import java.util.ArrayList;
164+
import java.util.Arrays;
164165
import java.util.EnumMap;
165166
import java.util.EnumSet;
166167
import java.util.HashMap;
@@ -3037,7 +3038,7 @@ public synchronized void addEventHook(EventHook hook) {
30373038
}
30383039

30393040
EventHook[] hooks = eventHooks;
3040-
EventHook[] newHooks = new EventHook[hooks.length + 1];
3041+
EventHook[] newHooks = Arrays.copyOf(hooks, hooks.length + 1);
30413042
newHooks[hooks.length] = hook;
30423043
eventHooks = newHooks;
30433044
hasEventHooks = true;

core/src/main/java/org/jruby/RubyClass.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ public static boolean checkFuncallCallable(ThreadContext context, DynamicMethod
675675
// MRI: rb_method_call_status
676676
// FIXME: Partial impl because we don't have these "NOEX" flags
677677
public static boolean rbMethodCallStatus(ThreadContext context, DynamicMethod method, CallType callType, IRubyObject self) {
678-
return !method.isUndefined() && method.isCallableFrom(self, callType);
678+
return method != null && !method.isUndefined() && method.isCallableFrom(self, callType);
679679
}
680680

681681
private static IRubyObject checkFuncallMissing(ThreadContext context, RubyClass klass, IRubyObject self, String method, IRubyObject... args) {

core/src/main/java/org/jruby/RubyFile.java

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import java.io.IOException;
4343
import java.io.InputStream;
4444
import java.io.Reader;
45+
import java.io.UnsupportedEncodingException;
4546
import java.net.URI;
4647
import java.net.URL;
4748
import java.nio.channels.Channels;
@@ -502,16 +503,28 @@ public IRubyObject inspect() {
502503

503504
@JRubyMethod(required = 1, optional = 1, meta = true)
504505
public static IRubyObject basename(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
505-
String name = get_path(context,args[0]).getUnicodeValue();
506+
Ruby runtime = context.runtime;
507+
508+
RubyString origString = get_path(context,args[0]);
509+
Encoding origEncoding = origString.getEncoding();
510+
String name = origString.toString();
506511

507512
// MRI-compatible basename handling for windows drive letter paths
508513
if (Platform.IS_WINDOWS) {
509514
if (name.length() > 1 && name.charAt(1) == ':' && Character.isLetter(name.charAt(0))) {
510515
switch (name.length()) {
511516
case 2:
512-
return RubyString.newEmptyString(context.runtime).infectBy(args[0]);
517+
return RubyString.newEmptyString(runtime, origString.getEncoding()).infectBy(args[0]);
513518
case 3:
514-
return context.runtime.newString(name.substring(2)).infectBy(args[0]);
519+
if (origEncoding.getCharset() != null) {
520+
try {
521+
return RubyString.newString(runtime, new ByteList(name.substring(2).getBytes(origEncoding.getCharsetName()), origString.getEncoding())).infectBy(args[0]);
522+
} catch (UnsupportedEncodingException uee) {
523+
// fall through to UTF-8 logic
524+
}
525+
}
526+
527+
return RubyString.newString(runtime, name.substring(2)).infectBy(args[0]);
515528
default:
516529
switch (name.charAt(2)) {
517530
case '/':
@@ -566,7 +579,15 @@ public static IRubyObject basename(ThreadContext context, IRubyObject recv, IRub
566579
name = name.substring(0, name.length() - ext.length());
567580
}
568581
}
569-
return context.runtime.newString(name).infectBy(args[0]);
582+
if (origEncoding.getCharset() != null) {
583+
try {
584+
return RubyString.newString(runtime, new ByteList(name.getBytes(origEncoding.getCharsetName()), origString.getEncoding())).infectBy(args[0]);
585+
} catch (UnsupportedEncodingException uee) {
586+
// fall through to UTF-8 logic
587+
}
588+
}
589+
590+
return RubyString.newString(runtime, name).infectBy(args[0]);
570591
}
571592

572593
@JRubyMethod(required = 2, rest = true, meta = true)

core/src/main/java/org/jruby/RubyFileStat.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ private void setup(String filename, boolean lstat) {
132132
file = JRubyFile.createResource(runtime.getPosix(), runtime.getCurrentDirectory(), filename);
133133
stat = lstat ? file.lstat() : file.stat();
134134

135-
if (stat == null) throw runtime.newErrnoFromInt(runtime.getPosix().errno(), filename);
135+
if (stat == null) throw runtime.newErrnoFromInt(file.errno(), filename);
136136
}
137137

138138
public IRubyObject initialize(IRubyObject fname, Block unusedBlock) {

core/src/main/java/org/jruby/RubyFileTest.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,19 @@ public static IRubyObject directory_p(ThreadContext context, IRubyObject filenam
9797

9898
@JRubyMethod(name = "executable?", required = 1, module = true)
9999
public static IRubyObject executable_p(IRubyObject recv, IRubyObject filename) {
100-
FileStat stat = fileResource(filename).stat();
101-
102-
return recv.getRuntime().newBoolean(stat != null && stat.isExecutable());
100+
return recv.getRuntime().newBoolean(fileResource(filename).canExecute());
103101
}
104102

105103
@JRubyMethod(name = "executable_real?", required = 1, module = true)
106104
public static IRubyObject executable_real_p(IRubyObject recv, IRubyObject filename) {
107-
FileStat stat = fileResource(filename).stat();
105+
if (recv.getRuntime().getPosix().isNative()) {
106+
FileStat stat = fileResource(filename).stat();
108107

109-
return recv.getRuntime().newBoolean(stat != null && stat.isExecutableReal());
108+
return recv.getRuntime().newBoolean(stat != null && stat.isExecutableReal());
109+
}
110+
else {
111+
return executable_p(recv, filename);
112+
}
110113
}
111114

112115
public static IRubyObject exist_p(IRubyObject recv, IRubyObject filename) {

0 commit comments

Comments
 (0)