[前][次][番号順一覧][スレッド一覧]

ruby-changes:44328

From: usa <ko1@a...>
Date: Wed, 12 Oct 2016 21:07:22 +0900 (JST)
Subject: [ruby-changes:44328] usa:r56401 (trunk): * ruby.c (open_load_file): revert r56385. it introduced incompatibility

usa	2016-10-12 21:07:16 +0900 (Wed, 12 Oct 2016)

  New Revision: 56401

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56401

  Log:
    * ruby.c (open_load_file): revert r56385.  it introduced incompatibility
      about `DATA.binmode?`.

  Modified files:
    trunk/ChangeLog
    trunk/ruby.c
Index: ruby.c
===================================================================
--- ruby.c	(revision 56400)
+++ ruby.c	(revision 56401)
@@ -1878,17 +1878,13 @@ open_load_file(VALUE fname_v, int *xflag https://github.com/ruby/ruby/blob/trunk/ruby.c#L1878
 	   use O_NONBLOCK. */
 #if defined O_NONBLOCK && HAVE_FCNTL && !(O_NONBLOCK & O_ACCMODE)
 	/* TODO: fix conflicting O_NONBLOCK in ruby/win32.h */
-# define MODE_TO_LOAD (O_NONBLOCK)
+# define MODE_TO_LOAD (O_RDONLY | O_NONBLOCK)
 #elif defined O_NDELAY && HAVE_FCNTL && !(O_NDELAY & O_ACCMODE)
-# define MODE_TO_LOAD (O_NDELAY)
+# define MODE_TO_LOAD (O_RDONLY | O_NDELAY)
 #else
-# define MODE_TO_LOAD (0)
+# define MODE_TO_LOAD (O_RDONLY)
 #endif
-	int mode = O_RDONLY |
-#ifdef O_BINARY
-	    O_BINARY |
-#endif
-	    MODE_TO_LOAD;
+	int mode = MODE_TO_LOAD;
 #if defined DOSISH || defined __CYGWIN__
 # define isdirsep(x) ((x) == '/' || (x) == '\\')
 	{
@@ -1896,6 +1892,7 @@ open_load_file(VALUE fname_v, int *xflag https://github.com/ruby/ruby/blob/trunk/ruby.c#L1892
 	    enum {extlen = sizeof(exeext)-1};
 	    if (flen > extlen && !isdirsep(fname[flen-extlen-1]) &&
 		STRNCASECMP(fname+flen-extlen, exeext, extlen) == 0) {
+		mode |= O_BINARY;
 		*xflag = 1;
 	    }
 	}
@@ -1906,7 +1903,7 @@ open_load_file(VALUE fname_v, int *xflag https://github.com/ruby/ruby/blob/trunk/ruby.c#L1903
 	}
 	rb_update_max_fd(fd);
 
-#if defined HAVE_FCNTL && MODE_TO_LOAD
+#if defined HAVE_FCNTL && MODE_TO_LOAD != O_RDONLY
 	/* disabling O_NONBLOCK */
 	if (fcntl(fd, F_SETFL, 0) < 0) {
 	    e = errno;
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 56400)
+++ ChangeLog	(revision 56401)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Oct 12 21:05:50 2016  NAKAMURA Usaku  <usa@r...>
+
+	* ruby.c (open_load_file): revert r56385.  it introduced incompatibility
+	  about `DATA.binmode?`.
+
 Wed Oct 12 15:24:53 2016  SHIBATA Hiroshi  <hsbt@r...>
 
 	* tool/downloader.rb: Removed verification of gem certification.

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]