Merge pull request #5019 from mruby/stable

Merge mruby 2.1.1
This commit is contained in:
Yukihiro "Matz" Matsumoto
2020-06-05 13:04:36 +09:00
committed by GitHub
8 changed files with 64 additions and 19 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "mruby"
PROJECT_NUMBER = 2.1.0
PROJECT_NUMBER = 2.1.1
PROJECT_BRIEF = "mruby is the lightweight implementation of the Ruby language"
+1 -1
View File
@@ -1,4 +1,4 @@
Copyright (c) 2019 mruby developers
Copyright (c) 2020 mruby developers
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
+1 -1
View File
@@ -17,7 +17,7 @@ of the Ministry of Economy, Trade and Industry of Japan.
## How to get mruby
The stable version 2.1.0 of mruby can be downloaded via the following URL: [https://github.com/mruby/mruby/archive/2.1.0.zip](https://github.com/mruby/mruby/archive/2.1.0.zip)
The stable version 2.1.1 of mruby can be downloaded via the following URL: [https://github.com/mruby/mruby/archive/2.1.1.zip](https://github.com/mruby/mruby/archive/2.1.1.zip)
The latest development version of mruby can be downloaded via the following URL: [https://github.com/mruby/mruby/zipball/master](https://github.com/mruby/mruby/zipball/master)
+1 -1
View File
@@ -38,7 +38,7 @@ To confirm mrdb was installed properly, run mrdb with the `--version` option:
```bash
$ mrdb --version
mruby 2.1.0 (2019-11-19)
mruby 2.1.1 (2020-06-04)
```
## 2.2 Basic Operation
+10 -10
View File
@@ -38,7 +38,7 @@ puts [1,2,3]
3
```
#### mruby [2.1.0 (2019-11-19)]
#### mruby [2.1.1 (2020-06-04)]
```
[1, 2, 3]
@@ -61,7 +61,7 @@ end
`ZeroDivisionError` is raised.
#### mruby [2.1.0 (2019-11-19)]
#### mruby [2.1.1 (2020-06-04)]
No exception is raised.
@@ -89,7 +89,7 @@ p Liste.new "foobar"
` [] `
#### mruby [2.1.0 (2019-11-19)]
#### mruby [2.1.1 (2020-06-04)]
`ArgumentError` is raised.
@@ -119,7 +119,7 @@ false
true
```
#### mruby [2.1.0 (2019-11-19)]
#### mruby [2.1.1 (2020-06-04)]
```
true
@@ -156,7 +156,7 @@ p 'ok'
ok
```
#### mruby [2.1.0 (2019-11-19)]
#### mruby [2.1.1 (2020-06-04)]
```
test.rb:8: undefined method 'test_func' (NoMethodError)
@@ -178,7 +178,7 @@ defined?(Foo)
nil
```
#### mruby [2.1.0 (2019-11-19)]
#### mruby [2.1.1 (2020-06-04)]
`NameError` is raised.
@@ -195,7 +195,7 @@ alias $a $__a__
` nil `
#### mruby [2.1.0 (2019-11-19)]
#### mruby [2.1.1 (2020-06-04)]
Syntax error
@@ -217,7 +217,7 @@ end
`ArgumentError` is raised.
The re-defined `+` operator does not accept any arguments.
#### mruby [2.1.0 (2019-11-19)]
#### mruby [2.1.1 (2020-06-04)]
` 'ab' `
Behavior of the operator wasn't changed.
@@ -233,7 +233,7 @@ $ ruby -e 'puts Proc.new {}.binding'
#<Binding:0x00000e9deabb9950>
```
#### mruby [2.1.0 (2019-11-19)]
#### mruby [2.1.1 (2020-06-04)]
```
$ ./bin/mruby -e 'puts Proc.new {}.binding'
@@ -255,7 +255,7 @@ $ ruby -e 'def m(*r,**k) p [r,k] end; m("a"=>1,:b=>2)'
[[{"a"=>1}], {:b=>2}]
```
#### mruby [mruby 2.1.0]
#### mruby [mruby 2.1.1]
```
$ ./bin/mruby -e 'def m(*r,**k) p [r,k] end; m("a"=>1,:b=>2)'
+1 -1
View File
@@ -1,7 +1,7 @@
/*
** mruby - An embeddable Ruby implementation
**
** Copyright (c) mruby developers 2010-2019
** Copyright (c) mruby developers 2010-2020
**
** Permission is hereby granted, free of charge, to any person obtaining
** a copy of this software and associated documentation files (the
+4 -4
View File
@@ -47,7 +47,7 @@ MRB_BEGIN_DECL
/*
* Tiny release version number.
*/
#define MRUBY_RELEASE_TEENY 0
#define MRUBY_RELEASE_TEENY 1
/*
* The mruby version.
@@ -62,17 +62,17 @@ MRB_BEGIN_DECL
/*
* Release year.
*/
#define MRUBY_RELEASE_YEAR 2019
#define MRUBY_RELEASE_YEAR 2020
/*
* Release month.
*/
#define MRUBY_RELEASE_MONTH 11
#define MRUBY_RELEASE_MONTH 6
/*
* Release day.
*/
#define MRUBY_RELEASE_DAY 19
#define MRUBY_RELEASE_DAY 4
/*
* Release date as a string.
+45
View File
@@ -67,6 +67,36 @@ mkdtemp(char *temp)
#include "mruby/variable.h"
#include <mruby/ext/io.h>
int wd_save;
int socket_available_p;
#if !defined(_WIN32) && !defined(_WIN64)
static int mrb_io_socket_available()
{
int fd, retval = 0;
struct sockaddr_un sun0;
char socketname[] = "tmp.mruby-io-socket-ok.XXXXXXXX";
if (!(fd = mkstemp(socketname))) {
goto sock_test_out;
}
unlink(socketname);
close(fd);
fd = socket(AF_UNIX, SOCK_STREAM, 0);
if (fd == -1) {
goto sock_test_out;
}
sun0.sun_family = AF_UNIX;
strncpy(sun0.sun_path, socketname, sizeof(sun0.sun_path));
if (bind(fd, (struct sockaddr *)&sun0, sizeof(sun0)) == 0) {
retval = 1;
}
sock_test_out:
unlink(socketname);
close(fd);
return retval;
}
#endif
static mrb_value
mrb_io_test_io_setup(mrb_state *mrb, mrb_value self)
{
@@ -81,6 +111,14 @@ mrb_io_test_io_setup(mrb_state *mrb, mrb_value self)
int i;
#if !defined(_WIN32) && !defined(_WIN64)
struct sockaddr_un sun0;
if(!(socket_available_p = mrb_io_socket_available())) {
char *tmpdir;
wd_save = open(".", O_DIRECTORY);
tmpdir = getenv("TMPDIR");
if (tmpdir) chdir(tmpdir);
else chdir("/tmp");
}
#endif
mrb_gv_set(mrb, mrb_intern_cstr(mrb, "$mrbtest_io_msg"), mrb_str_new_cstr(mrb, msg));
@@ -181,6 +219,13 @@ mrb_io_test_io_cleanup(mrb_state *mrb, mrb_value self)
mrb_gv_set(mrb, mrb_intern_cstr(mrb, "$mrbtest_io_socketname"), mrb_nil_value());
mrb_gv_set(mrb, mrb_intern_cstr(mrb, "$mrbtest_io_msg"), mrb_nil_value());
#if !defined(_WIN32) && !defined(_WIN64)
if(!socket_available_p) {
fchdir(wd_save);
close(wd_save);
}
#endif
return mrb_nil_value();
}