Граф коммитов

368 Коммитов

Автор SHA1 Сообщение Дата
nobu d7dc0c5f03 dir.c: show warnings
* dir.c (replace_real_basename): show warnings at errors.
  [Bug #10015]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02 12:32:09 +00:00
nobu 5a2b77ff4a dir.c: update path type
* dir.c (replace_real_basename): update path type by the target
  attributes if possible, to improve the performance.  [Bug #10015]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02 07:15:09 +00:00
nobu 347da440cf ensure paths NUL-terminated
* dir.c (check_dirname): ensure path name NUL-terminated for
  SHARABLE_MIDDLE_SUBSTRING.
* io.c (rb_sysopen): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-30 14:11:56 +00:00
normal 3fe2773c73 dir.c (check_dirname): avoid volatile, use return value
volatile is unnecessary since we use rb_sys_fail_path nowadays
and that prevents the path argument from being GC-ed.
Using a return value instead of modifying the argument directly
simplifies the generated code (on 32-bit x86):

 text    data     bss     dec     hex filename
20744      40      20   20804    5144 dir.o-orig
20720      40      20   20780    512c dir.o

* dir.c (check_dirname): avoid volatile, use return value
  (dir_s_chroot, dir_s_mkdir, dir_s_rmdir): adjust callers

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-23 00:49:26 +00:00
hsbt 5d6ca9e950 * include/ruby/ruby.h: $SAFE=2 is now obsolete.
* dir.c, ext/fiddle/handle.c, ext/socket/basicsocket.c, file.c
  gc.c, io.c, process.c, safe.c, signal.c, win32/file.c:
  removed code for $SAFE=2
* test/erb/test_erb.rb, test/fiddle/test_handle.rb
  test/ruby/test_env.rb: removed tests for $SAFE=2.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-18 14:21:03 +00:00
nobu 9375ff5b06 dir.c: FNM_SHORTNAME
* dir.c (dirent_match): match short names only when FNM_SHORTNAME
  flag is given, for the backward compatibility, and the new
  behavior is often dangerous.  [ruby-core:69435] [Bug #11206]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-03 22:12:24 +00:00
nobu 9e459f7aa9 dir.c: getattrlist on OSX 10.5
* dir.c (need_normalization): use getattrlist() if fgetattrlist()
  is unavailable, on OSX 10.5.  [ruby-core:68829] [Bug #11054]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-10 14:57:47 +00:00
nobu ec85609f23 dir.c: expand ruby_brace_glob0
* dir.c (ruby_brace_glob_with_enc): call ruby_brace_glob_with_enc
  in ruby_brace_glob, and expanded ruby_brace_glob0 which is no
  longer used anywhere else.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-01 02:42:19 +00:00
nobu 93f6b2a36e dir.c: reduce indirect arguments
* dir.c (push_glob): remove indirect links of arguments for
  trampoline.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-01 02:09:18 +00:00
nobu 78a73a538d dir.c: don't raise after close
* dir.c (dir_close): don't raise on dobule close for consistent to
  IO#close.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-23 14:18:30 +00:00
nobu f5b96e594c win32.c: w32_lstati64
* win32/win32.c (winnt_stat): stat with following symbolic links.
* win32/win32.c (winnt_lstat): rename old winnt_stat, which does
  not follow symbolic links.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-23 05:40:48 +00:00
nobu 41872a8df6 dir.c: fix DT_UNKNOWN recursion
* dir.c (glob_helper): distinguish not-yet-stated and DT_UNKNOWN
  by readdir, and traverse recursively for the former.  Linux
  readdir returns DT_UNKNOWN on some filesystems, e.g., smbfs,
  iso9660.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-17 08:23:14 +00:00
nobu 8e1f6b0750 dir.c: DT_UNKNOWN
* dir.c (glob_helper): deal with DT_UNKNOWN.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-16 10:20:25 +00:00
nobu 00f7db376c dir.h: direct::d_type
* dir.c (glob_helper): use d_type to reduce lstat system calls.
* win32/dir.h (struct direct): add d_type instead of d_isdir and
  d_isrep.  SYMLINKD is unreliable, since the target can be
  replaced after a link was created.
* win32/win32.c (readdir_internal): set d_type.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-14 03:23:56 +00:00
nobu 5b06e83345 dir.c: glob short names
* dir.c (glob_helper): match patterns against legacy short names
  too, not only ordinary names.  [ruby-core:67954] [Bug #10819]
* win32/dir.h (struct direct): add short name members.
* win32/win32.c (opendir_internal, readdir_internal): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-08 07:57:38 +00:00
usa 908c25341e * dir.c (replace_real_basename): need to check the return value of
GLOB_REALLOC().
  [ruby-core:68430] [Bug #10941]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-05 17:51:02 +00:00
usa c529554548 * dir.c (replace_real_basename): shouldn't create Ruby object before
the object system is loaded.
  [ruby-core:68430] [Bug #10941]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-05 17:28:07 +00:00
nobu f4726dcdaa dir.c: same encoding to the pattern
* dir.c (push_pattern, push_glob): make globbed file names same
  encoding to the given pattern.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-25 06:59:39 +00:00
nobu 7294d08d48 dir.c: use packed structs
* dir.c (is_case_sensitive, replace_real_basename): [OSX] use
  packed structs instead of arrays to suppress warning by older
  versions of gcc.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-24 03:34:10 +00:00
nobu 16294913f7 use rb_funcallv
* use rb_funcallv() for no arguments call instead of variadic
  rb_funcall().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-16 04:08:52 +00:00
nobu 034e38d8a2 dir.c: long path name on Windows
* dir.c (has_magic): always get long path name on Windows even if
  no tilde is there.  [ruby-core:68011] [Bug #10819]
* dir.c (replace_real_basename): FindFirstFile ignore redirection
  character, check if exists before call it.  cf. [Bug #8597]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-07 10:25:27 +00:00
nobu 7645c974de dir.c: fix a typo
* dir.c (has_magic): fix a typo, check code not c.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-07 05:08:37 +00:00
nobu b53f9528f3 dir.c: use USE_NAME_ON_FS
* dir.c (glob_helper): use USE_NAME_ON_FS instead of configure and
  platform macro list.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-07 00:11:02 +00:00
nobu 461c38a973 dir.c: fix escaping multibyte char
* dir.c (has_magic): fix escaping multibyte char, with glob
  meta-char in trailing bytes, e.g., Shift-JIS

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-07 00:11:00 +00:00
nobu ef5b8fe12f dir.c: preserve encoding
* dir.c (sys_enc_warning_in): preserve encoding of path name in
  warning messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-06 08:37:27 +00:00
nobu 338bd4cc65 remove duplication in warning
* dir.c (sys_warning_1): remove duplication in the message.
* error.c (rb_mod_sys_fail_str): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-03 06:15:51 +00:00
nobu 45df1c24d2 dir.c: glob legacy short name
* dir.c (glob_helper): obtain real name with FindFirstFile API
  instead of matchin all entries, on Windows.
  [ruby-core:67954] [Bug #10819]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-03 05:04:49 +00:00
nobu 3e2942423e dir.c: GC guard
* dir.c (do_opendir): prevent intermediate string for transcoding
  from GC.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-03 04:43:52 +00:00
nobu d6aa766ad5 dir.c: OSX case-folding
* dir.c (glob_helper): match in case-folding only if the directory
  resides on a case-insensitve file system, on OSX.
  [ruby-core:67364] [Bug #10700]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-08 03:53:45 +00:00
nobu 48ad25568f dir.c: use macros
* dir.c (replace_real_basename): use macros for getattrlist
  buffer.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-07 10:29:49 +00:00
nobu 10e74f035f dir.c: cifs symlinkd on OSX
* dir.c (dir_initialize): workaround of opendir failure at symlink
  directories on Windows via CIFS.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-07 10:19:29 +00:00
nobu 79219d9656 dir.c: GC guard
* dir.c (dir_initialize): add GC guard for retrying.  the argument
  of RSTRING_PTR() may be eliminated by optimization.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-07 10:18:45 +00:00
nobu 376c4e8100 dir.c: normalize CIFS too
* dir.c (need_normalization): not only HFS+, CIFS (SMB) is also
  decomposed.  [Bug #10704]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-07 09:52:53 +00:00
nobu b04c628792 Revert "dir.c: NORMALIZE_UTF8PATH"
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-07 09:52:03 +00:00
nobu a921841b48 dir.c: NORMALIZE_UTF8PATH
* dir.c (NORMALIZE_UTF8PATH): Unicode decomposition seems to
  perform in an upper layer than file systems on OSX, as all path
  names are always decomposed regardless of file system types.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-07 07:51:18 +00:00
nobu 859f3d14ed never-NULL pointer check
* dir.c (ruby_glob0): no need to check never-NULL pointer.
  reported by Denis Denisov <denji0k AT gmail.com>.
* win32/file.c (rb_file_expand_path_internal): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-26 05:51:36 +00:00
nobu 0ebfc6f216 dir.c: replace_real_basename
* dir.c (replace_real_basename): get the real name and replace the
  base name with it by getattrlist(2) if available.
  suggested by Matthew Draper at [ruby-core:67116].  [Bug #10015]
* dir.c (glob_helper): get the real name of the whole path, not
  only the last name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-25 06:36:18 +00:00
nobu fbbf715d27 revert r48975
caused CI fauilures

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-24 14:59:20 +00:00
nobu ae6fb2c8f7 dir.c: shortcut for case-insensitive name
* dir.c (glob_helper): shortcut for case-insensitive name by
  stopping reading after a matching name found.
  [ruby-core:63591] [Bug #10015]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-24 14:39:49 +00:00
nobu 8b764b1daf dir.c: glob performance
* dir.c (glob_make_pattern): restrict searching case-insensitive
  name from the filesystem to only last part, for the performance.
  [ruby-core:63591] [ruby-core:63591]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-24 11:38:21 +00:00
nobu e580a631be use 0 for reserved
use 0 for rb_data_type_t::reserved instead of NULL, since its type
may be changed in the future and possibly not a pointer type.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-01 06:38:04 +00:00
akr 7cd76ab0c5 * internal.h: Include ruby.h and ruby/encoding.h to be
includable without prior inclusion.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15 11:49:06 +00:00
nobu abafe3354f dir.c: fix rdoc [ci skip]
* dir.c (dir_s_aref): fix rdoc.  `Dir.glob` allows an array but
  `Dir[]` not.  the former accepts an optional parameter `flags`,
  while the latter accepts arbitrary number of arguments but no
  `flags`.  [ruby-core:65265] [Bug #10294]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-08 15:53:11 +00:00
nobu 28b9f11d5a protoize no-arguments functions
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-30 05:25:32 +00:00
akr d03315d84a * configure.in (dirfd): Check function.
* dir.c (dir_fileno): New method.
  [ruby-dev:48265] [Feature #9880]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47387 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-04 15:54:04 +00:00
ko1 68f55c4b35 * dir.c (glob_helper): use #ifdef instead of #if.
gcc's -Wundef option shows warning for undefined macro.
* numeric.c (flo_is_finite_p): ditto.
* vm_dump.c (rb_vmdebug_thread_dump_state): ditto.
* vm_core.h: define VM_DEBUG_VERIFY_METHOD_CACHE to 0.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-04 08:50:31 +00:00
nobu 4ce3e118e7 dir.c: Dir.exists? is deprecated
* dir.c (rb_dir_exists_p): [DOC] Document that Dir.exists? is
  deprecated.  [ruby-core:64135] [Bug #10102]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-11 07:17:22 +00:00
nobu aa3b506270 add some documents [ci skip]
* bignum.c (Init_Bignum): [DOC] Bignum::GMP_VERSION.

* complex.c (Init_Complex): [DOC] ignore an internal class.

* dir.c (Init_Dir): [DOC] File::FNM_SYSCASE.

* file.c (rb_file_exists_p): [DOC] File.exists? is deprecated.

* object.c (rb_mod_initialize_clone): [DOC] ignore implementation
  detail.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-28 11:28:55 +00:00
nobu f2980e3e20 encoding.h: constify rb_encoding
* include/ruby/encoding.h: constify `rb_encoding` itself, not only
  arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-02 20:23:47 +00:00
nobu c466dcc05b dir.c: try match PLAIN
* dir.c (glob_helper): try match PLAIN as well as ALPHA, which are
  separated by previous commits.  [ruby-core:61552] [Bug #9648]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-17 02:02:51 +00:00