aboutsummaryrefslogtreecommitdiffstats
path: root/dir.c
Commit message (Collapse)AuthorAgeFilesLines
* dir.c: paths as UTF-8nobu2016-02-201-3/+3
| | | | | | | | * 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
* dir.c: Dir.empty?nobu2016-02-161-0/+91
| | | | | | | * 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
* * compile.c: fix typos.hsbt2015-12-141-1/+1
| | | | | | | | | | | | | [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
* dir.c, io.c: use rb_id_encodingnobu2015-12-091-1/+1
| | | | | | | | | * 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
* * *.c (*_memsize): do not check ptr.ko12015-12-091-1/+1
| | | | | | | | | | 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
* use rb_gc_for_fd for more callersnormal2015-11-231-2/+1
| | | | | | | | | | | | | | | | * 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
* * dir.c (dir_fileno, dirfd): support of Dir#fileno on Solaris 10.ngoto2015-11-061-0/+13
| | | | | | | | | | | | 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
* revert r52336 (commit miss)ko12015-10-291-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (gc_mark_ptr): remove debug code for #11244.ko12015-10-291-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* dir.c: glob brace expansion [Fix GH-1061]nobu2015-10-221-1/+1
| | | | | | | | | * 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
* dir.c: make ASCII-8BITnobu2015-10-041-1/+3
| | | | | | | * 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
* dir.c: normalize cwdnobu2015-10-041-0/+5
| | | | | | * 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
* dir.c: give pathlen from callersnobu2015-09-301-6/+8
| | | | | | | * 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
* * dir.c (glob_helper): check pathtype once again by lstat(2) ifkosaki2015-09-161-4/+7
| | | | | | 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
* dir.c: fundamental_encoding_pnobu2015-09-151-9/+19
| | | | | | | * 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
* win32.c: support known reparse points onlynobu2015-08-191-0/+5
| | | | | | | | * 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
* dir.c: get attributes by fdnobu2015-07-101-3/+1
| | | | | | | * 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
* dir.c: set errnonobu2015-07-021-2/+7
| | | | | | | * 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
* dir.c: show warningsnobu2015-07-021-4/+9
| | | | | | | * 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
* dir.c: update path typenobu2015-07-021-26/+43
| | | | | | | * 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
* ensure paths NUL-terminatednobu2015-06-301-0/+1
| | | | | | | | * 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
* dir.c (check_dirname): avoid volatile, use return valuenormal2015-06-231-7/+7
| | | | | | | | | | | | | | | | 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
* * include/ruby/ruby.h: $SAFE=2 is now obsolete.hsbt2015-06-181-2/+0
| | | | | | | | | | * 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
* dir.c: FNM_SHORTNAMEnobu2015-06-031-1/+13
| | | | | | | | * 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
* dir.c: getattrlist on OSX 10.5nobu2015-04-101-5/+15
| | | | | | | * 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
* dir.c: expand ruby_brace_glob0nobu2015-04-011-11/+4
| | | | | | | | * 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
* dir.c: reduce indirect argumentsnobu2015-04-011-6/+21
| | | | | | | * 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
* dir.c: don't raise after closenobu2015-03-231-4/+10
| | | | | | | * 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
* win32.c: w32_lstati64nobu2015-03-231-0/+2
| | | | | | | | * 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
* dir.c: fix DT_UNKNOWN recursionnobu2015-03-171-26/+38
| | | | | | | | | * 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
* dir.c: DT_UNKNOWNnobu2015-03-161-1/+3
| | | | | | * 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
* dir.h: direct::d_typenobu2015-03-141-2/+2
| | | | | | | | | | * 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
* dir.c: glob short namesnobu2015-03-081-1/+13
| | | | | | | | | * 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
* * dir.c (replace_real_basename): need to check the return value ofusa2015-03-051-6/+18
| | | | | | | | GLOB_REALLOC(). [ruby-core:68430] [Bug #10941] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * dir.c (replace_real_basename): shouldn't create Ruby object beforeusa2015-03-051-5/+15
| | | | | | | | 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
* dir.c: same encoding to the patternnobu2015-02-251-7/+15
| | | | | | | * 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
* dir.c: use packed structsnobu2015-02-241-4/+11
| | | | | | | | * 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
* use rb_funcallvnobu2015-02-161-1/+1
| | | | | | | * 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
* dir.c: long path name on Windowsnobu2015-02-071-19/+13
| | | | | | | | | * 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
* dir.c: fix a typonobu2015-02-071-1/+1
| | | | | | * 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
* dir.c: use USE_NAME_ON_FSnobu2015-02-071-2/+2
| | | | | | | * 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
* dir.c: fix escaping multibyte charnobu2015-02-071-3/+3
| | | | | | | * 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
* dir.c: preserve encodingnobu2015-02-061-12/+40
| | | | | | | * 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
* remove duplication in warningnobu2015-02-031-1/+1
| | | | | | | * 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
* dir.c: glob legacy short namenobu2015-02-031-7/+68
| | | | | | | | * 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
* dir.c: GC guardnobu2015-02-031-1/+4
| | | | | | | * 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
* dir.c: OSX case-foldingnobu2015-01-081-1/+22
| | | | | | | | * 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
* dir.c: use macrosnobu2015-01-071-2/+2
| | | | | | | * 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
* dir.c: cifs symlinkd on OSXnobu2015-01-071-0/+9
| | | | | | | * 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
* dir.c: GC guardnobu2015-01-071-2/+5
| | | | | | | * 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