ruby-changes:56324
From: git <ko1@a...>
Date: Tue, 2 Jul 2019 04:14:43 +0900 (JST)
Subject: [ruby-changes:56324] git: 93328b5237 (master): * expand tabs.
https://git.ruby-lang.org/ruby.git/commit/?id=93328b5237 From 93328b5237c515878dacfa7350688b016333225d Mon Sep 17 00:00:00 2001 From: git <svn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> Date: Tue, 2 Jul 2019 04:14:17 +0900 Subject: * expand tabs. diff --git a/file.c b/file.c index 7574ede..16d4df1 100644 --- a/file.c +++ b/file.c @@ -4316,54 +4316,54 @@ rb_check_realpath_internal(VALUE basedir, VALUE path, enum rb_realpath_mode mode https://github.com/ruby/ruby/blob/trunk/file.c#L4316 struct stat st; if (mode == RB_REALPATH_DIR) { - return rb_check_realpath_emulate(basedir, path, mode); + return rb_check_realpath_emulate(basedir, path, mode); } unresolved_path = rb_str_dup_frozen(path); origenc = rb_enc_get(unresolved_path); if (*RSTRING_PTR(unresolved_path) != '/' && !NIL_P(basedir)) { - unresolved_path = rb_file_join(rb_assoc_new(basedir, unresolved_path)); + unresolved_path = rb_file_join(rb_assoc_new(basedir, unresolved_path)); } unresolved_path = TO_OSPATH(unresolved_path); if((resolved_ptr = realpath(RSTRING_PTR(unresolved_path), NULL)) == NULL) { - /* glibc realpath(3) does not allow /path/to/file.rb/../other_file.rb, - returning ENOTDIR in that case. - glibc realpath(3) can also return ENOENT for paths that exist, - such as /dev/fd/5. - Fallback to the emulated approach in either of those cases. */ - if (errno == ENOTDIR || - (errno == ENOENT && rb_file_exist_p(0, unresolved_path))) { - return rb_check_realpath_emulate(basedir, path, mode); + /* glibc realpath(3) does not allow /path/to/file.rb/../other_file.rb, + returning ENOTDIR in that case. + glibc realpath(3) can also return ENOENT for paths that exist, + such as /dev/fd/5. + Fallback to the emulated approach in either of those cases. */ + if (errno == ENOTDIR || + (errno == ENOENT && rb_file_exist_p(0, unresolved_path))) { + return rb_check_realpath_emulate(basedir, path, mode); - } - if (mode == RB_REALPATH_CHECK) { - return Qnil; - } - rb_sys_fail_path(unresolved_path); + } + if (mode == RB_REALPATH_CHECK) { + return Qnil; + } + rb_sys_fail_path(unresolved_path); } resolved = ospath_new(resolved_ptr, strlen(resolved_ptr), rb_filesystem_encoding()); free(resolved_ptr); if (rb_stat(resolved, &st) < 0) { - if (mode == RB_REALPATH_CHECK) { - return Qnil; - } - rb_sys_fail_path(unresolved_path); + if (mode == RB_REALPATH_CHECK) { + return Qnil; + } + rb_sys_fail_path(unresolved_path); } if (origenc != rb_enc_get(resolved)) { - if (!rb_enc_str_asciionly_p(resolved)) { - resolved = rb_str_conv_enc(resolved, NULL, origenc); - } - rb_enc_associate(resolved, origenc); + if (!rb_enc_str_asciionly_p(resolved)) { + resolved = rb_str_conv_enc(resolved, NULL, origenc); + } + rb_enc_associate(resolved, origenc); } if(rb_enc_str_coderange(resolved) == ENC_CODERANGE_BROKEN) { - rb_enc_associate(resolved, rb_filesystem_encoding()); - if(rb_enc_str_coderange(resolved) == ENC_CODERANGE_BROKEN) { - rb_enc_associate(resolved, rb_ascii8bit_encoding()); - } + rb_enc_associate(resolved, rb_filesystem_encoding()); + if(rb_enc_str_coderange(resolved) == ENC_CODERANGE_BROKEN) { + rb_enc_associate(resolved, rb_ascii8bit_encoding()); + } } rb_obj_taint(resolved); -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/