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

542 Коммитов

Автор SHA1 Сообщение Дата
nobu 9590e99031 dir.c: use rb_gc_for_fd
* dir.c (rb_dir_s_empty_p): use rb_gc_for_fd for the condition to
  invoke GC by errno.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-21 07:40:50 +00:00
nobu 1e09d98b23 dir.c: inline to_be_ignored
* dir.c (to_be_ignored): make an inline function to get rid of
  multiple errno function calls.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-21 07:40:48 +00:00
nobu ccc9841a82 prefer rb_syserr_fail
* dir.c (dir_initialize, dir_read): prefer rb_syserr_fail over
  rb_sys_fail.

* io.c (ruby_dup, rb_sysopen): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-21 07:40:47 +00:00
nobu c463366dfd rb_funcallv
* *.c: rename rb_funcall2 to rb_funcallv, except for extensions
  which are/will be/may be gems.  [Fix GH-1406]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-29 11:57:14 +00:00
nobu 65ca6391ed Name USE_NAME_ON_FS constants
* dir.c (USE_NAME_ON_FS): name constants.
  * USE_NAME_ON_FS_REAL_BASENAME: platform dependent APIs to get
    real basenames.
  * USE_NAME_ON_FS_BY_FNMATCH: select the matching basename by
    fnmatch.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-20 11:00:17 +00:00
normal bee0756ea9 dir.c (dir_close): update RDoc for 2.3 #close change
[ruby-core:75679] [Bug #12413]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-22 23:09:38 +00:00
nobu 4f969f6eee dir.c: paths as UTF-8
* dir.c (push_pattern, push_glob): deal with read paths as UTF-8
  to stat later, on Windows as well as OS X.
  [ruby-core:73868] [Bug #12081]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53877 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-20 04:04:59 +00:00
nobu 135a171ce1 dir.c: Dir.empty?
* dir.c (rb_dir_s_empty_p): add Dir.empty? method, which tells the
  argument is the name of an empty directory.  [Feature #10121]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-16 08:34:47 +00:00
hsbt 6851be0f0c * compile.c: fix typos.
[ci skip][fix GH-1140] Patch by @jutaz
* dir.c: ditto.
* gc.c: ditto.
* io.c: ditto.
* node.h: ditto.
* thread_pthread.c: ditto.
* vm_insnhelper.c: ditto.
* vsnprintf.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-14 02:51:13 +00:00
nobu dec78a7a73 dir.c, io.c: use rb_id_encoding
* dir.c (dir_initialize): rb_id_encoding() returns same ID with
  caching.

* io.c (Init_IO): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-09 18:15:04 +00:00
ko1 2f5b8f0529 * *.c (*_memsize): do not check ptr.
NULL checking is finished Before call of memsize functions.
  See r52979.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-09 00:38:32 +00:00
normal 61e5fe0674 use rb_gc_for_fd for more callers
* dir.c (dir_initialize): use rb_gc_for_fd for ENOMEM
* ext/socket/init.c (rsock_socket): ditto
* ext/socket/socket.c (rsock_socketpair): ditto
* internal.h (rb_gc_for_fd): prototype
* io.c (rb_gc_for_fd): remove static
  [ruby-core:71623] [Feature #11727]

Manpages for opendir(2), socket(2), and socketpair(3posix)
describe ENOMEM as a possible error for each of these;
handle it consistently with our existing wrappers for
open(2)/pipe(2) etc...

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-23 22:50:53 +00:00
ngoto 7ceb0f9eb4 * dir.c (dir_fileno, dirfd): support of Dir#fileno on Solaris 10.
Solaris 10 does not have dirfd, but the file descriptor of a
  directory is stored in the d_fd or dd_fd member in the DIR struct.
  Note that Solaris 11 has dirfd(3C).

* configure.in: checks for DIR.d_fd and DIR.dd_fd on Solaris 10.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-06 17:07:08 +00:00
ko1 56eee285be revert r52336 (commit miss)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29 05:30:50 +00:00
ko1 106f033b89 * gc.c (gc_mark_ptr): remove debug code for #11244.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29 05:10:06 +00:00
nobu ff3288fe5a dir.c: glob brace expansion [Fix GH-1061]
* dir.c (ruby_brace_expand): glob brace expansion edge case fix.
  When there are closing braces '}' before a open brace '{' it
  must be ignored and considered as literal.
  [ruby-core:71138] [Bug #11609]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-22 04:16:21 +00:00
nobu 4d753671b2 dir.c: make ASCII-8BIT
* dir.c (rb_dir_getwd): make ASCII-8BIT if filesystem encoding is
  US-ASCII, like as Dir.glob.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52031 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-04 15:53:53 +00:00
nobu c604000a31 dir.c: normalize cwd
* dir.c (rb_dir_getwd): normalize OS path to UTF-8 on OS X.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-04 01:10:00 +00:00
nobu 563127d710 dir.c: give pathlen from callers
* dir.c (glob_helper): move pathlen to argument which is known in
  the callers almost.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-30 08:12:14 +00:00
kosaki 06ca0b67f4 * dir.c (glob_helper): check pathtype once again by lstat(2) if
dp->d_type is DT_UNKNOWN. XFS may return DT_UNKNOWN.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-16 03:19:53 +00:00
nobu 2046f38aa6 dir.c: fundamental_encoding_p
* dir.c (fundamental_encoding_p, push_glob): compare by encoding
  index immediately.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-15 06:06:19 +00:00
nobu 82da3da5ac win32.c: support known reparse points only
* dir.c (replace_real_basename), win32/win32.c (opendir_internal):
  check reparse point tags and treat supported tags only as
  symbolic links.  [ruby-core:70454] [Bug #11462]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-19 23:31:19 +00:00
nobu d8f628e582 dir.c: get attributes by fd
* dir.c (is_case_sensitive): get attributes by the file descriptor
  of open directory, instead of using mount point name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-10 08:41:57 +00:00
nobu 911cf9e83c dir.c: set errno
* dir.c (replace_real_basename): Win32 API does not set errno, get
  the last error by GetLastError() and map to errno.  [Bug #10015]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02 22:13:17 +00:00
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
nobu f88481740a dir.c: set PLAIN for non-magical
* dir.c (glob_make_pattern): set PLAIN for non-magical path to
  skip parts which not need to glob.
  [ruby-core:61552] [Bug #9648]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-17 01:40:34 +00:00
nobu 47f4eee420 dir.c: fix conditions for ALPHA
* dir.c (has_magic): return ALPHA at alphabetical name regardless
  FNM_CASEFOLD flag.
* dir.c (glob_helper): fix conditions for ALPHA.
  [ruby-core:61552] [Bug #9648]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-17 01:05:06 +00:00
nobu 8cb6f21e1a dir.c: reduce matching
* dir.c (glob_helper): reduce matching at non-mgaical path on
  Windows.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-16 16:49:38 +00:00
nobu 17d31216ea dir.c: match plain names as-is
* dir.c (glob_pattern_type): separate names with alphabet but no
  magical from plain.
* dir.c (glob_helper): match plain names as-is to treat super-root
  same as the root.  [ruby-core:61552] [Bug #9648]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-16 16:49:25 +00:00
nobu 29b5de1de2 dir.c: check boundary
* dir.c (glob_make_pattern): check boundary before accessing.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-16 08:22:41 +00:00
nobu 1f30b7437e dir.c: match in UTF-8
* dir.c (push_glob): match in UTF-8 on Mac OS X.
  [ruby-dev:48213] [Bug #9825]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-10 13:37:58 +00:00
normal 87661039e7 dir.c (dir_s_glob): RB_GC_GUARD instead of volatile
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-16 05:53:14 +00:00
nobu c512cfdb1f dir.c: fallback to ASCII-8BIT
* dir.c (push_glob): fallback to ASCII-8BIT for the case non-ascii
  path name exists.  failed with LANG=C, on MacOS X which has a
  localized symlink on the root directory.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-05 06:23:37 +00:00
nobu 8d9b300a72 dir.c: glob cases on case-insensitive system
* dir.c (glob_helper): return the filename with actual cases on
  the filesystem if it is case-insensitive.  [ruby-core:42469]
  [Feature #5994]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-04 08:20:05 +00:00
nobu 5b92c0bea3 dir.c: glob cases on case-insensitive system
* dir.c (glob_make_pattern): all alphabets are magic characters on
  case-insensitive filesystems.  [ruby-core:42469] [Feature #5994]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44802 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-04 03:45:17 +00:00
naruse 859ae7764c Revert "dir.c: glob cases on case-insensitive system"
This reverts commit r44796.

    * dir.c (glob_helper): return the filename with actual cases on
      the filesystem if it is case-insensitive.  [ruby-core:42469]
      [Feature #5994]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-04 03:19:57 +00:00
nobu 0f9da4228d dir.c: glob cases on case-insensitive system
* dir.c (glob_helper): return the filename with actual cases on
  the filesystem if it is case-insensitive.  [ruby-core:42469]
  [Feature #5994]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-03 01:49:50 +00:00
hsbt 6f53ea480a * dir.c: Add example for Dir.pwd in Dir.getwd doc by @jasonrclark [fix GH-504]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-21 12:10:17 +00:00
nobu b9cafaf524 vm_insnhelper.c: rb_get_kwargs
* vm_insnhelper.c (rb_get_kwargs): get keyword argument values from an
  option hash, not only checking keys.
* dir.c (dir_initialize): use rb_get_kwargs.
* gc.c (gc_start_internal): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-06 08:10:47 +00:00
nobu bf9c1d9818 dir.c: check unknown keywords
* dir.c (dir_initialize): check unknown keywords.  [ruby-dev:47152]
  [Bug #8060]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43935 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-30 12:22:20 +00:00
glass 5c54eb4045 * dir.c, pack.c, ruby.c, struct.c, vm_eval.c: use RARRAY_CONST_PTR().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-08 02:37:47 +00:00
ko1 c5e08b764e * add RUBY_TYPED_FREE_IMMEDIATELY to data types which only use
safe functions during garbage collection such as xfree().
  On default, T_DATA objects are freed at same points as fianlizers.
  This approach protects issues such as reported by [ruby-dev:35578].
  However, freeing T_DATA objects immediately helps heap usage.
  Most of T_DATA (in other words, most of dfree functions) are safe.
  However, we turned off RUBY_TYPED_FREE_IMMEDIATELY by default
  for safety.
* cont.c: ditto.
* dir.c: ditto.
* encoding.c: ditto.
* enumerator.c: ditto.
* error.c: ditto.
* file.c: ditto.
* gc.c: ditto.
* io.c: ditto.
* iseq.c: ditto.
* marshal.c: ditto.
* parse.y: ditto.
* proc.c: ditto.
* process.c: ditto.
* random.c: ditto.
* thread.c: ditto.
* time.c: ditto.
* transcode.c: ditto.
* variable.c: ditto.
* vm.c: ditto.
* vm_backtrace.c: ditto.
* vm_trace.c: ditto.
* ext/bigdecimal/bigdecimal.c: ditto.
* ext/objspace/objspace.c: ditto.
* ext/stringio/stringio.c: ditto.
* ext/strscan/strscan.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-29 11:16:54 +00:00
nobu f57c988e34 dir.c: DOTMATCH to current directory
* dir.c (glob_helper): don't skip current directories if FNM_DOTMATCH
  is given.  [ruby-core:53108] [Bug #8006]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-22 06:59:54 +00:00
nobu 22a961383a dir.c: warn Dir.exists?
* dir.c (rb_dir_exists_p): warn deprecated name.  [Bug #9041]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-21 17:06:31 +00:00
drbrain 2614d9ba2f * dir.c (dir_s_glob): [DOC] Improve wording and layout.
* dir.c (file_s_fnmatch):  ditto.

* dir.c (Init_Dir):  [DOC] Document File::Constants::FNM_XXX
  constants.  (These won't show up in RDoc until a new RDoc is
  imported.)



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-13 21:08:36 +00:00
nobu 378161fe68 dir.c: reduce string object
* dir.c (dir_each): get rid of allocate new string from UTF-8 string.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-31 04:30:25 +00:00
nobu 51705124e8 dir.c: normalization
* dir.c (glob_helper): re-enalbe normalization.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-10 23:55:05 +00:00
naruse 9962aad7b0 * file.c (rb_str_normalize_ospath):
HFS Plus (Mac OS Extended) uses a variant of Normal Form D in which
  U+2000 through U+2FFF, U+F900 through U+FAFF, and U+2F800 through
  U+2FAFF are not decomposed (this avoids problems with round trip
  conversions from old Mac text encodings).
  http://developer.apple.com/library/mac/qa/qa1173/_index.html
  Therefore fix r42457 to exclude the range.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-10 20:44:10 +00:00
nobu 354028abe1 file.c: rb_str_normalize_ospath
* file.c (rb_str_normalize_ospath): extract and move from dir.c.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-08 01:26:27 +00:00
naruse 276457dfac fix typo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-25 04:16:08 +00:00
nobu 7ec4a44762 file.c: split rb_home_dir
* dir.c (dir_s_home): use rb_home_dir_of and rb_default_home_dir.
* file.c (rb_home_dir_of): split from rb_home_dir() for the home
  directry of the given user, and the user name is a VALUE, not a bare
  pointer.  should raise if the user does not exist.
* file.c (rb_default_home_dir): split from rb_home_dir() for the home
  directry of the current user.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-25 04:06:50 +00:00
ktsj 8dd4a3c604 * dir.c: [DOC] add docs for :encoding option.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-19 04:40:07 +00:00
nobu 48b19a3a75 dir.c: get rid of FindFirstFile bug
* dir.c (do_stat): use rb_w32_ustati64() in win32.c to get rid of
  mysterious behavior of FindFirstFile() Windows API which treat "<"
  and ">" like as wildcard characters.  [ruby-core:55764] [Bug #8597]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-03 05:15:28 +00:00
nobu 89e38a2b7c dir.c: do_lstat alias
* dir.c (do_lstat): make an alias of do_stat instead of two same
  functions, when no lstat is available.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-03 05:12:03 +00:00
nobu 14dfdb5eaf dir.c: use built-in encoding indexes
* internal.h: add UTF8-MAC.
* dir.c (rb_utf8mac_encoding): use built-in encoding indexes in
  internal.h.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-02 08:22:43 +00:00
shugo 1f828497d1 * safe.c (rb_set_safe_level, safe_setter): raise an ArgumentError
when $SAFE is set to 4.  $SAFE=4 is now obsolete.
  [ruby-core:55222] [Feature #8468]

* object.c (rb_obj_untrusted, rb_obj_untrust, rb_obj_trust):
  Kernel#untrusted?, untrust, and trust are now deprecated.
  Their behavior is same as tainted?, taint, and untaint,
  respectively.

* include/ruby/ruby.h (OBJ_UNTRUSTED, OBJ_UNTRUST): OBJ_UNTRUSTED()
  and OBJ_UNTRUST() are aliases of OBJ_TAINTED() and OBJ_TAINT(),
  respectively.

* array.c, class.c, debug.c, dir.c, encoding.c, error.c, eval.c,
  ext/curses/curses.c, ext/dbm/dbm.c, ext/dl/cfunc.c,
  ext/dl/cptr.c, ext/dl/dl.c, ext/etc/etc.c, ext/fiddle/fiddle.c,
  ext/fiddle/pointer.c, ext/gdbm/gdbm.c, ext/readline/readline.c,
  ext/sdbm/init.c, ext/socket/ancdata.c, ext/socket/basicsocket.c,
  ext/socket/socket.c, ext/socket/udpsocket.c,
  ext/stringio/stringio.c, ext/syslog/syslog.c, ext/tk/tcltklib.c,
  ext/win32ole/win32ole.c, file.c, gc.c, hash.c, io.c, iseq.c,
  load.c, marshal.c, object.c, proc.c, process.c, random.c, re.c,
  safe.c, string.c, thread.c, transcode.c, variable.c,
  vm_insnhelper.c, vm_method.c, vm_trace.c: remove code for
  $SAFE=4.

* test/dl/test_dl2.rb, test/erb/test_erb.rb,
  test/readline/test_readline.rb,
  test/readline/test_readline_history.rb, test/ruby/test_alias.rb,
  test/ruby/test_array.rb, test/ruby/test_dir.rb,
  test/ruby/test_encoding.rb, test/ruby/test_env.rb,
  test/ruby/test_eval.rb, test/ruby/test_exception.rb,
  test/ruby/test_file_exhaustive.rb, test/ruby/test_hash.rb,
  test/ruby/test_io.rb, test/ruby/test_method.rb,
  test/ruby/test_module.rb, test/ruby/test_object.rb,
  test/ruby/test_pack.rb, test/ruby/test_rand.rb,
  test/ruby/test_regexp.rb, test/ruby/test_settracefunc.rb,
  test/ruby/test_struct.rb, test/ruby/test_thread.rb,
  test/ruby/test_time.rb: remove tests for $SAFE=4.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12 14:20:51 +00:00
nobu 482f0e6b97 dir.c: use fd to fstatfs
* dir.c (is_hfs): use the file descriptor instead of a path.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-03 10:02:39 +00:00
kosaki 523bd6737e * configure.in: removes AC_CHECK_FUNCS(readdir_r). readdir_r()
is only used from dir.c and it doesn't need readdir_r().
* configure.in (SIZEOF_STRUCT_DIRENT_TOO_SMALL): remvoed. It is
  only used for readdir_r.
* dir.c: removes NAME_MAX_FOR_STRUCT_DIRENT. It is not right way
  to detect maximum length of path len. POSIX require to use
  fpathconf(). IOW, it might have lead to make a vulnerability
  using stack smashing. Moreover, readdir() works enough for our
  usage.
* dir.c (READDIR): removes an implementation which uses
  readdir_r() and parenthesize in a macro body correctly.
* dir.c (dir_read): removes IF_HAVE_READDIR_R(DEFINE_STRUCT_DIRENT
  entry), it is used only for readdir_r().
* dir.c (dir_each): ditto.
* dir.c (glob_helper): ditto.

* dir.c (READDIR): removes entry and dp argument.
* dir.c (dir_read): adjust for the above change.
* dir.c (dir_each): ditto.
* dir.c (glob_helper): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-02 22:38:11 +00:00
mame a0b3e03202 * dir.c (bracket): fix copy-paste error. When the first and last
characters of fnmatch range have different length, fnmatch may
  have wrongly matched a path that does not really match.
  Coverity Scan found this bug.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-25 09:32:47 +00:00
nobu 1891b60f26 dir.c: compose HFS file names
* dir.c (dir_each): compose HFS file names from
  UTF8-MAC. [ruby-core:48745] [Bug #7267]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-20 18:11:23 +00:00
akr 847fe27e31 * dir.c (dir_set_pos): Fix a compilation error when seekdir() is not
exist.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-26 09:16:14 +00:00
nobu a4188556d3 dir.c: not skip dot directories if matching
* dir.c (glob_helper): should skip dot directories only for recursion,
  but should not if matching to the given pattern.  [ruby-core:54387]
  [Bug #8283]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-18 07:20:53 +00:00
eregon 37a350dbb6 * dir.c (File.fnmatch): fix typo in documentation
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-14 22:38:26 +00:00
zzak 9ef4e13459 * array.c: Document synonymous methods, by windwiny [GH-277]
* bignum.c: ditto
* complex.c: ditto
* dir.c: ditto
* encoding.c: ditto
* enumerator.c: ditto
* numeric.c: ditto
* proc.c: ditto
* re.c: ditto
* string.c: ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-12 02:59:07 +00:00
hsbt 91d5cda26d Fix return value in example by @rkh [fix GH-284]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-11 09:32:42 +00:00
knu 43c93dbdd9 * dir.c: Fix a typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-11 02:12:15 +00:00
zzak 0daf538ab4 * dir.c (file_s_fnmatch): Document File::FNM_EXTGLOB flag.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40223 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-11 00:27:39 +00:00
nobu 29dc980e65 compose HFS file names
* dir.c (glob_helper): compose HFS file names from UTF8-MAC.
  [ruby-core:48745] [Bug #7267]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-19 08:06:53 +00:00
nobu 353cd01e2f * dir.c (join_path): move length of path to an argument.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-19 08:04:26 +00:00
nobu 0d3d9eff4d file.c: rb_sys_fail_path_with_func
* file.c (rb_sys_fail_path_with_func): share same function, and path
  may be nil.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-15 05:51:37 +00:00
nobu 3331d6774f dir.c: encoding check
* dir.c (file_s_fnmatch, fnmatch_brace): encoding-incompatible pattern
  and string do not match, instead of exception.  [ruby-dev:47069]
  [Bug #7911]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-23 00:48:44 +00:00
usa 9848f0d0ca * win32/{dir.h,win32.c} (rb_w32_readdir): removed old rb_w32_readdir()
and renamed from rb_w32_readdir_with_enc().
  [ruby-core:24864] [Feature #1927]

* dir.c (READDIR): follow above change.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-21 13:06:17 +00:00
nobu 0f37c95134 dir.c: use NAMLEN
* dir.c (glob_helper): use NAMLEN() to tell the length of d_name
  instead of strlen(), which can access beyond the boundary.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01 06:05:33 +00:00
nobu e59d5667c7 dir.c: FNM_EXTGLOB
* dir.c (file_s_fnmatch): match with expanding braces if FNM_EXTGLOB
  is set.  [ruby-core:40037] [Feature #5422]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-04 01:19:11 +00:00
zzak c420f8449e * dir.c (Dir#glob):
Documentation for pattern section, backslash subsection
  Patch by Eric Bouchut
  [ruby-core#48528] [Bug #7230]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-03 04:47:49 +00:00
nobu 83185f9181 dir.c: fix recursion
* dir.c (glob_make_pattern): names under recursive need to be single
  basenames to match for each name.  [ruby-core:47418] [Bug #6977]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-05 04:30:10 +00:00
nobu f65e683ccc dir.c: not recurse dot files
* dir.c (glob_helper): skip dot files early on recursive match.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-05 01:44:36 +00:00
nobu 65a61792a9 dir.c: enumm answer
* dir.c (enumm answer): remap NO and YES to false and true,
  respectively.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-05 01:44:20 +00:00
kosaki 9021777282 * dir.c (dir_initialize): get rid of "unused return: argc = rb_scan_args()"
warning.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-19 21:49:27 +00:00
nobu 406a9fc5cf documentation for Dir.exist?
* dir.c (rb_file_directory_p): move documentation for Dir.exist? from
  file.c so that the proper description will be shown instead of the
  documentation of File.directory?.  [ruby-core:45685]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-17 13:23:56 +00:00
yugui 76bc2d1ed7 Imports Ruby's port to NativeClient (a.k.a NaCl).
Patch by Google Inc. [ruby-core:45073].

* configure.in (RUBY_NACL): New M4 func to configure variables for
  NaCl.
  (RUBY_NACL_CHECK_PEPPER_TYPES): New M4 func to check the old names
  of Pepper interface types.
  (BTESTRUBY): New variable to specify which ruby should be run on
  "make btest". NaCl can run the built binary by sel_ldr, but it need
  rbconfig.rb. So this variable is distinguished from $MINIRUBY.
  
* thread_pthread.c: Disabled some features on NaCl.

* io.c: ditto.

* process.c: ditto.

* signal.c: ditto.

* file.c: ditto.

* missing/flock.c: ditto.

* nacl/pepper_main.c: An example implementation of Pepper application
  that embeds Ruby.

* nacl/example.html: An example of web page that uses the Pepper
  application.

* nacl/nacl-config.rb: Detects variants of NaCl SDK.

* nacl/GNUmakefile.in: Makefile template for NaCl specific build
  process.

* nacl/package.rb: script for packaging a NaCl-Ruby embedding
  application. 

* nacl/reate_nmf.rb: Wrapper script of create_nmf.py

* dln.c (dln_load): Added a hack to call on NaCl.

* util.c (ruby_getcwd): Path to the current directort is not available
  on NaCl.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-17 02:48:59 +00:00
nobu 57fb219905 * reduce UNREACHABLE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-15 00:06:13 +00:00
drbrain e95f7ea80d * variable.c (trace_ev): Removed "not reached" comment as this line is
reached.
* variable.c (rb_obj_remove_instance_variable):  Replaced "not reached"
  comment with the UNREACHABLE macro.
* variable.c (rb_mod_const_missing):  ditto.
* variable.c (rb_mod_remove_cvar):  ditto.
* enum.c (first_i):  ditto.
* string.c (rb_str_aref):  ditto.
* string.c (str_byte_aref):  ditto.
* string.c (rb_to_id):  ditto.
* io.c (rb_io_fmode_modestr):  ditto.
* io.c (rb_io_oflags_modestr):  ditto.
* pack.c (num2i32):  ditto.
* vm_eval.c (rb_method_missing):  ditto.
* vm_eval.c (rb_f_throw):  ditto.
* dir.c (dir_read):  ditto.
* win32/win32.c (child_result):  ditto.
* struct.c (rb_struct_getmember):  ditto.
* struct.c (rb_struct_set):  ditto.
* struct.c (rb_struct_aref_id):  ditto.
* eval.c (rb_f_raise):  ditto.
* process.c (rb_f_exit_bang):  ditto.
* process.c (rb_f_exit):  ditto.
* process.c (rb_f_abort):  ditto.
* ext/-test-/iter/break.c (iter_break_value):  ditto.
* ext/pty/pty.c (pty_check):  ditto.
* ext/openssl/ossl_pkey.c (ossl_pkey_new):  ditto.
* ext/readline/readline.c (rb_remove_history):  ditto.
* ext/stringio/stringio.c (strio_unimpl):  ditto.
* numeric.c (num_sadded):  ditto.
* numeric.c (num_init_copy):  ditto.
* numeric.c (rb_num2ll):  ditto.
* numeric.c (rb_num2ull):  ditto.
* vm_insnhelper.c (call_cfunc):  ditto.
* ruby.c (opt_W_getter):  ditto.
* bignum.c (rb_big_coerce):  ditto.
* file.c (rb_f_test):  ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-14 00:36:26 +00:00
nobu eec0b2d88a * dir.c (dir_inspect), io.c (rb_io_inspect): keep encoding of path.
[Bug #6072]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-24 22:53:51 +00:00
nobu 85738261a5 * dir.c (dir_initialize): keep path in original encoding.
* error.c (syserr_initialize): prefer the encoding of message over
  locale.  [ruby-dev:45279][Bug #6071]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-24 22:53:42 +00:00
nobu adcb7e9e7b * dir.c, file.c, io.c (rb_sys_fail_path): use rb_sys_fail_str.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-24 07:48:34 +00:00
nobu 9acf2091e1 * dir.c, file.c, io.c: use rb_sys_fail_path.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-24 07:37:48 +00:00
naruse c13d0b0c9c * dir.c (fnmatch): The * needs to be escaped to avoid formatting in
fnmatch comment.
  patched by @dalton. https://github.com/ruby/ruby/pull/91

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-10 21:12:44 +00:00
nobu ed469831e4 * file.c (rb_enc_path_next, rb_enc_path_skip_prefix)
(rb_enc_path_last_separator, rb_enc_path_end)
  (ruby_enc_find_basename, ruby_enc_find_extname): encoding-aware
  path handling functions.
* file.c (rb_home_dir, file_expand_path, rb_realpath_internal)
  (rb_file_s_basename, rb_file_dirname, rb_file_s_extname)
  (rb_file_join): should respect the encodings of arguments than
  file system encoding.  [ruby-dev:45145] [Bug #5919]
* dir.c (check_dirname, ruby_glob0): ditto.
* ext/pathname/pathname.c (path_sub_ext): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-25 02:32:06 +00:00
nobu c3d6f8d74f * dir.c (dir_chdir, check_dirname): get rid of optimization-out.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-21 02:43:48 +00:00
nobu b526738c3b * bignum.c (big_rshift), compile.c (validate_label,
iseq_build_from_ary_exception), cont.c (cont_capture), dir.c
  (dir_open_dir), gc.c (objspace_each_objects), io.c (pipe_open)
  (rb_io_advise), parse.y (parser_compile_string)
  (rb_parser_compile_file), proc.c (binding_free), process.c
  (rb_proc_exec_n, rb_seteuid_core, proc_setegid, rb_setegid_core)
  (p_uid_exchange, p_gid_exchange), regparse.c (strdup_with_null),
  signal.c (sig_dfl), vm.c (rb_iseq_eval, rb_iseq_eval_main),
  vm_insnhelper.c (vm_expandarray): suppress
  unused-but-set-variable warnings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-05 09:57:00 +00:00
kosaki 20ae79b0c2 * include/ruby/defines.h: remove NextStep, OpenStep, Rhapsody
support. Last activity of their OSs are 7 years ago.
* configure.in: ditto.
* dir.c: ditto.
* ext/tk/extconf.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-26 00:19:03 +00:00
ayumin 35551be602 * dir.c: Two small documentation fixes. [Bug #5302]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-10 04:43:12 +00:00
marcandre 1f2478a7e6 * dir.c: Make RDoc more precise about order of Dir.glob
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-27 23:38:31 +00:00
akr e7996eb3cc * internal.h: declare internal functions here.
* node.h: declare NODE dependent internal functions here.

* iseq.h: declare rb_iseq_t dependent internal functions here.

* vm_core.h: declare rb_thread_t dependent internal functions here.

* bignum.c, class.c, compile.c, complex.c, cont.c, dir.c, encoding.c,
  enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c, io.c,
  iseq.c, load.c, marshal.c, math.c, numeric.c, object.c, parse.y,
  proc.c, process.c, range.c, rational.c, re.c, ruby.c, string.c,
  thread.c, time.c, transcode.c, variable.c, vm.c,
  tool/compile_prelude.rb: don't declare internal functions declared
  in above headers.  include above headers if required.

  Note that rb_thread_mark() was declared as
  void rb_thread_mark(rb_thread_t *th) in cont.c but defined as
  void rb_thread_mark(void *ptr) in vm.c.  Now it is declared as
  the later in internal.h.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-17 22:43:38 +00:00
usa 22d5cf9226 * win32/{win32.c,dir.h} (rb_w32_uopendir): new API to pass UTF-8 path.
* win32/win32.c (opendir_internal, rb_w32_opendir): extract and merge
  common part of rb_w32_opendir() and rb_w32_uopendir().

* dir.c (do_opendir, glob_helper): encoding.

* dir.c (dir_initialize, do_opendir): convert path to UTF-8 and call
  rb_w32_uopendir() instead of rb_w32_opendir() on Windows.
  fixes #4491, reported by Joey Zhou.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-28 07:22:18 +00:00
akr 6ac9fea36f update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-13 11:58:20 +00:00
akr fad7d95a18 * dir.c: parenthesize macro arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-08 11:38:29 +00:00
nobu 125b4b7020 * dir.c (dir_initialize): remove useless intermediate variable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-21 14:47:13 +00:00
nobu 89130aa8e1 * dir.c (bracket): get rid of scanning at the end of the pattern
string, not to raise an exception while globbing command line.
  [ruby-core:32478]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-20 14:23:16 +00:00
knu 82abe79b9f * class.c (rb_scan_args): Add support for optional keyword
argument hash.

* README.EXT, README.EXT.ja: Update documentation accordingly.

* dir.c (dir_initialize): Make use of the new rb_scan_args()
  feature.

* io.c (rb_io_s_popen, rb_scan_open_args, rb_io_initialize)
  (rb_io_s_pipe, open_key_args, io_s_foreach, io_s_readlines)
  (rb_io_s_read, rb_io_set_encoding): Ditto.

* transcode.c (str_transcode, econv_args)
  (econv_primitive_convert): Ditto.

* ext/zlib/zlib.c (rb_gzreader_initialize): Ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-10 07:51:58 +00:00
nobu 8d92ac23d1 * dir.c (sys_warning_1): show error message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-08 21:53:02 +00:00
nobu 36992251c3 * dir.c (glob_make_pattern): fold continuous PLAINs to get rid of
snail at too deep path.  [ruby-dev:41871]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-05 07:57:26 +00:00
naruse 7175a9073e * class.c, compile.c, dir.c, file.c, iseq.c, parse.y, random.c:
clean unused-value warnings.

* cont.c, process.c, vm_exec.h: clean cast warnings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-27 07:13:43 +00:00
nobu 25b9eb5e57 * include/ruby/ruby.h (rb_data_type_t): restructured. [ruby-dev:41862]
add parent member.

* error.c (rb_typeddata_inherited_p): new function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-18 07:31:54 +00:00
drbrain 79aac05474 Clarification of what '*' matches. Patch by John Wells <john.wells at greatworx.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-04 21:22:47 +00:00
marcandre 7729de4d91 * array.c: Documentation: change => in call-seq to ->.
Harmonize "#=>" in examples. [ruby-core:30206]

* bignum.c: ditto

* class.c: ditto

* compar.c: ditto

* cont.c: ditto

* dir.c: ditto

* encoding.c: ditto

* enum.c: ditto

* enumerator.c: ditto

* error.c: ditto

* eval.c: ditto

* file.c: ditto

* gc.c: ditto

* io.c: ditto

* load.c: ditto

* marshal.c: ditto

* math.c: ditto

* numeric.c: ditto

* object.c: ditto

* pack.c: ditto

* proc.c: ditto

* process.c: ditto

* random.c: ditto

* range.c: ditto

* re.c: ditto

* ruby.c: ditto

* signal.c: ditto

* sprintf.c: ditto

* string.c: ditto

* struct.c: ditto

* thread.c: ditto

* time.c: ditto

* transcode.c: ditto

* variable.c: ditto

* vm_eval.c: ditto

* vm_method.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:07:33 +00:00
marcandre 4afa9ed041 * array.c: Harmonize documentation, in particular regarding:
- methods returning enumerators
    - array methods and argument naming (array -> ary, an_array -> new_ary)
    - minor improvements, typo fixed and styling issues

  Other documentation errors fixed:
    - return value was self instead of a new array (or vice-versa) for
      Array#{pop,shift,permutation,repeated_permutation,keep_if}
    - Array#rindex was missing the form with a block.

* dir.c: ditto.

* enum.c: ditto. Modified Enumerable#reverse_each' documentation to clarify
  that #each will be finish before any element is yielded.

* error.c: ditto.

* gc.c: ditto.

* hash.c: ditto.

* io.c: ditto. IO#{codepoints,each_codepoint} fixed as per [ruby-core:23948]

* numeric.c: ditto.

* range.c: ditto.

* string.c: ditto.

* struct.c: ditto.

* vm_eval.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-13 05:49:55 +00:00
usa 6c28f99d88 * merge some patches from win32-uncode-test branch.
see #1685.

* file.c, include/ruby/intern.h (rb_str_encode_ospath): new function
  to convert encoding for pathname.

* win32.c, include/ruby/win32.h (rb_w32_ulink, rb_w32_urename,
  rb_w32_ustati64, rb_w32_uopen, rb_w32_uutime, rb_w32_uchdir,
  rb_w32_umkdir, rb_w32_urmdir, rb_w32_uunlink): new functions to
  accept UTF-8 path.

* win32/win32.c (rb_w32_opendir, link, rb_w32_stati64, rb_w32_utime,
  rb_w32_unlink): use WCHAR path internally.

* file.c (rb_stat, eaccess, access_internal, rb_file_s_ftype,
  chmod_internal, rb_file_chmod, rb_file_chown, utime_internal,
  rb_file_s_link, unlink_internal, rb_file_s_rename): use UTF-8 version
  functions on Win32.

* file.c (apply2files, rb_stat, rb_file_s_lstat, rb_file_symlink_p,
  rb_file_readable_p, rb_file_writable_p, rb_file_executable_p,
  check3rdbyte, rb_file_identical_p, rb_file_chmod, rb_file_chown,
  rb_file_s_link, rb_file_s_symlink, rb_file_s_rename): call
  rb_str_encode_ospath() before passing the path to system.

* io.c (rb_sysopen): ditto.

* dir.c (dir_chdir, dir_s_mkdir, dir_s_rmdir): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-30 17:56:23 +00:00
mame 1f2def7dd8 * dir.c (push_glob): clear up the previous commit (RB_GC_GUARD can
precede the last reference).  [ruby-dev:40942]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-09 11:32:52 +00:00
mame 5dd8daaa27 * dir.c (push_glob): add RB_GC_GUARD to prevent str being free'ed.
a patch from Masaya TARUI in [ruby-dev:40939].  [ruby-dev:40514]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-09 11:08:06 +00:00
nobu cb9da52cde * dir.c (dir_s_glob): get rid of comment starter.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-23 20:47:23 +00:00
naruse 155e42c50e * dir.c (dir_s_glob): add rdoc by Roger Pack. [ruby-core:27669]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-23 14:28:38 +00:00
akr 853dd6cabe * prelude.rb (require_relative): use File.realpath. [ruby-dev:40040]
* include/ruby/intern.h: declare rb_dir_getwd.

* dir.c (rb_dir_getwd): copied from dir_s_getwd to export.
  (dir_s_getwd): use rb_dir_getwd.

* file.c (rb_file_s_realpath): new method File.realpath.
  (rb_file_s_realdirpath): new method File.realdirpath.

* lib/pathname.rb (Pathname#realpath): use File.realpath.
  (Pathname#realdirpath): use File.realdirpath.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-12 00:32:22 +00:00
nobu 252168ed1b * dir.c (dir_check): moved other checks from GetDIR.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-03 23:26:02 +00:00
nobu 22ec8c664a * dir.c (GetDIR): fixed a variable name.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-03 23:21:02 +00:00
nobu a1485dbea0 * dir.c (GlobPathValue), file.c (rb_get_path_check): path names
must be ASCII compatible.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-19 08:33:01 +00:00
nobu 06e52ba57b * dir.c (GlobPathValue): adjust return types. based on a patch
from Naohisa Goto at [ruby-dev:39350].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-18 14:59:29 +00:00
nobu 6200f424a7 * dir.c (GlobPathValue): glob allows null bytes as separators.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-18 07:06:29 +00:00
nobu 12fc299a84 * dir.c (push_glob): str should be a string always.
* dir.c (rb_push_glob, dir_globs): use #to_path to convert non-
  string values.  cf. [ruby-dev:39345]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-17 21:47:14 +00:00
nobu 44110c88e7 * dir.c (dir_data_type): typed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-09 02:28:21 +00:00
matz 7a426e029a * dir.c (Init_Dir): alias Dir#path to Dir#to_path. [ruby-core:25326]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-03 23:07:13 +00:00
matz 529f149bfe * dir.c (DEFINE_STRUCT_DIRENT): use union to allocate sufficient
memory space for Solaris.  a patch from Naohisa GOTO
  <ngoto at gen-info.osaka-u.ac.jp> in [ruby-dev:39132].
  [ruby-dev:39062]

* configure.in (SIZEOF_STRUCT_DIRENT_TOO_SMALL): Solaris dirent
  check.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-19 16:10:06 +00:00
nobu e07cb859cc * suppressed shorten-64-to-32 warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-18 08:05:32 +00:00
ko1 0e03a296e6 * dir.c (push_glob): re-fix GC problem.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-15 23:57:33 +00:00
ko1 d3cbda6e8d * dir.c (push_glob): fix GC problem.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-15 14:46:44 +00:00
akr fc64028291 * io.c: remove __CHECKER__ test.
* dir.c: ditto.

* dln.c: ditto.

* file.c: ditto.

* process.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-22 12:23:06 +00:00
usa a610b0a959 * dir.c (dir_s_getwd): directory path's encoding should be filesystem's
one.

	* lib/tmpdir.rb: ditto (but not finished yet.)



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-10 09:15:55 +00:00
nobu d1dd871707 * dir.c (dir_s_glob): fixed rdoc. a patch from Joseph Pecoraro at
[ruby-core:23767].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23657 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-09 06:13:16 +00:00
nobu 11fd9224f7 * dir.c (sys_warning): get rid of type-punning function cast.
* dir.c (ruby_glob0): get rid of possible overflow.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-09 06:11:10 +00:00
usa 8da932fe46 * dir.c (glob_helper): C99(gcc)-ism.
* time.c (find_time_t): GUESS macro needs the variable named ``result''
	  always.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-22 01:40:09 +00:00
nobu 143846ad36 * dir.c (dir_path, dir_each, glob_helper): use readdir_r() if
available.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23241 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-21 00:25:43 +00:00
akr 8e8ae2a9c5 * node.h (rb_notimplement_body_p): declared.
* vm_method.c (Init_eval_method): suppress a warning.

* io.c (rb_io_fsync): use rb_f_notimplement if not implemented.
  (rb_io_close_on_exec_p): ditto.
  (rb_io_set_close_on_exec): ditto.
  (rb_io_fcntl): ditto.
  (rb_f_syscall): ditto.

* dir.c (dir_tell): ditto.
  (dir_seek): ditto.
  (dir_s_chroot): ditto.

* process.c (proc_getpgrp): ditto.
  (proc_setpgrp): ditto.
  (proc_getpgid): ditto.
  (proc_setpgid): ditto.
  (proc_setsid): ditto.
  (proc_getpriority): ditto.
  (proc_setpriority): ditto.
  (proc_getrlimit): ditto.
  (proc_setrlimit): ditto.
  (p_sys_setuid): ditto.
  (p_sys_setruid): ditto.
  (p_sys_seteuid): ditto.
  (p_sys_setreuid): ditto.
  (p_sys_setresuid): ditto.
  (p_sys_setgid): ditto.
  (p_sys_setrgid): ditto.
  (p_sys_setegid): ditto.
  (p_sys_setregid): ditto.
  (p_sys_setreuid): ditto.
  (p_sys_setresgid): ditto.
  (p_sys_issetugid): ditto.
  (proc_getgroups): ditto.
  (proc_setgroups): ditto.
  (proc_initgroups): ditto.
  (proc_daemon): ditto.
  (rb_proc_times): ditto.

* file.c (rb_file_s_lchown): ditto.
  (rb_file_s_link): ditto.
  (rb_file_s_symlink): ditto.
  (rb_file_s_readlink): ditto.
  (rb_file_s_truncate): ditto.
  (rb_file_truncate): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-16 16:58:06 +00:00
mame 1b71f8f816 * dir.c (bracket): fix escape handling for range character in bracket
of fnmatch pattern.  e.g., '[a\-c]' should not match 'b'.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-16 15:48:25 +00:00
naruse 31c1883a54 * dir.c (fnmatch_helper): use rb_enc_precise_mbclen and
fail if bytes are invalid. [ruby-dev:38307]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-15 03:00:31 +00:00
nobu 205c4b490c * dir.c (bracket): if same in bytes, path is matching.
[ruby-dev:38305]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-14 09:11:29 +00:00
nobu 207becd942 * dir.c (bracket, fnmatch_helper): compare bytewise first, to get
rid of invalid byte sequence.  [ruby-dev:38303]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-12 10:54:59 +00:00
nobu 22cde7b682 * dir.c, dln.c, parse.y, re.c, ruby.c, sprintf.c, strftime.c,
string.c, util.c, variable.c: use strlcpy, memcpy and snprintf
  instead of strcpy, strncpy and sprintf.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-17 01:29:17 +00:00
nobu fd0a91b5ab * dir.c (dir_seek): use long for seekdir().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-11 16:18:10 +00:00
akr 0c0f987376 * dir.c (dir_read): don't disable rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-06 19:04:44 +00:00
usa 6343c99a2e * win32/{dir.h, win32.c} (rb_w32_readdir_with_enc): new function to
read entry with specified enc.

	* win32/win32.c (readdir_internal): extract from rb_w32_opendir().

	* win32/win32.c (opendir_internal): extract from rb_w32_readdir().

	* dir.c (dir_read, dir_each): use new READDIR macro instead of readdir()
	  to pass enc for special version of readdir, such as above.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-06 08:23:00 +00:00
nobu 043f665274 * dir.c (dir_s_home): new method. [ruby-core:21454]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-02 07:33:08 +00:00
nobu 0506348ef5 * dir.c (join_path): use strlcat() to force link.
* dir.c (glob_helper): no strcpy() is needed since len is known.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-25 00:08:06 +00:00
matz ec280ecbe6 * dir.c (dir_globs): need taint check. reported by steve
<oksteev at gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-31 04:40:34 +00:00
matz 3f0ec8887f * string.c (rb_external_str_new): a new function to convert from
external encoding to internal encoding.  if something went
  wrong, it returns a string with the external encoding.

* string.c (rb_external_str_new_with_enc): same as above besides
  you can specify the source encoding.

* ruby.c (ruby_set_argv): use rb_external_str_new()

* ruby.c (set_arg0, ruby_script): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-18 10:36:20 +00:00
naruse d51b061565 * include/ruby/oniguruma.h (OnigCodePoint): unsigned long to unsigned int.
* include/ruby/encoding.h (rb_enc_codepoint): ditto.

* encoding.c (rb_enc_codepoint): signed int to unsigned int.

* encoding.c (rb_enc_ascget): ditto.

* string.c (rb_str_casecmp): ditto.

* string.c (enc_succ_alnum_char): ditto.

* string.c (rb_str_inspect): ditto.

* string.c (rb_str_upcase_bang): ditto.

* string.c (rb_str_downcase_bang): ditto.

* string.c (rb_str_capitalize_bang): ditto.

* string.c (rb_str_swapcase_bang): ditto.

* string.c (struct tr): ditto.

* string.c (trnext): ditto.

* string.c (tr_trans): ditto.

* string.c (tr_setup_table): ditto.

* string.c (tr_find): ditto.

* string.c (rb_str_delete_bang): ditto.

* string.c (rb_str_squeeze_bang): ditto.

* string.c (rb_str_count): ditto.

* string.c (rb_str_split_m): ditto.

* string.c (rb_str_each_line): ditto.

* string.c (rb_str_lstrip_bang): ditto.

* string.c (rb_str_rstrip_bang): ditto.

* string.c (rb_str_intern): ditto.

* dir.c (char_casecmp): ditto.

* sprintf.c (rb_str_format): ditto.

* enc/emacs_mule.c (mbc_to_code): to be 32bit clean.

* enc/emacs_mule.c (code_to_mbc): ditto.

* enc/gb18030.c (mbc_to_code): ditto.

* enc/gb18030.c (code_to_mbc): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-11 10:34:59 +00:00
naruse be2fc605fc * dir.c (dir_initialize): rename option name of Dir.open
from :external_encoding to :encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-08 13:32:53 +00:00
naruse 3337c792e6 * dir.c (dir_enc_str_new): set US-ASCII to the path
when the path is 7bit string and encoding is ASCII compatible.

* dir.c (push_glob): set file system encoding when argument encoding
  is US-ASCII.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-22 03:32:13 +00:00
naruse cc17cad920 * dir.c (dir_enc_str_new): renamed from dir_enc_str.
* dir.c (dir_read): use dir_enc_str_new.

* dir.c (dir_each): ditto.

* dir.c (push_pattern): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-22 02:32:44 +00:00
akr d46728ec0e * encoding.c (rb_filesystem_encoding): use default external encoding
for Unix.

* dir.c (dir_initialize): don't cache fs_encoding.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-14 12:11:14 +00:00
shugo f433d710d0 * object.c (rb_obj_untrusted): new method Object#untrusted?.
(rb_obj_untrust): new method Object#untrust.
  (rb_obj_trust): new method Object#trust.
* array.c, debug.c, time.c, include/ruby/ruby.h, re.c, variable.c,
  string.c, io.c, dir.c, vm_method.c, struct.c, class.c, hash.c,
  ruby.c, marshal.c: fixes for Object#untrusted?.
* test/ruby/test_module.rb, test/ruby/test_array.rb,
  test/ruby/test_object.rb, test/ruby/test_string.rb,
  test/ruby/test_marshal.rb, test/ruby/test_hash.rb: added tests for
  Object#untrusted?.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-13 07:25:05 +00:00