summaryrefslogtreecommitdiff
path: root/dir.c
AgeCommit message (Collapse)Author
2014-12-01use 0 for reservednobu
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-11-15* internal.h: Include ruby.h and ruby/encoding.h to beakr
includable without prior inclusion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-08dir.c: fix rdoc [ci skip]nobu
* 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-09-30protoize no-arguments functionsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-04* configure.in (dirfd): Check function.akr
* 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* dir.c (glob_helper): use #ifdef instead of #if.ko1
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-08-11dir.c: Dir.exists? is deprecatednobu
* 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-07-28add some documents [ci skip]nobu
* 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-06-02encoding.h: constify rb_encodingnobu
* 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-05-17dir.c: try match PLAINnobu
* 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-17dir.c: set PLAIN for non-magicalnobu
* 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-17dir.c: fix conditions for ALPHAnobu
* 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-16dir.c: reduce matchingnobu
* 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-16dir.c: match plain names as-isnobu
* 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-16dir.c: check boundarynobu
* 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-10dir.c: match in UTF-8nobu
* 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-02-16dir.c (dir_s_glob): RB_GC_GUARD instead of volatilenormal
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-05dir.c: fallback to ASCII-8BITnobu
* 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-04dir.c: glob cases on case-insensitive systemnobu
* 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-04dir.c: glob cases on case-insensitive systemnobu
* 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-04Revert "dir.c: glob cases on case-insensitive system"naruse
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-03dir.c: glob cases on case-insensitive systemnobu
* 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-01-21* dir.c: Add example for Dir.pwd in Dir.getwd doc by @jasonrclark [fix GH-504]hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-06vm_insnhelper.c: rb_get_kwargsnobu
* 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-11-30dir.c: check unknown keywordsnobu
* 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-08* dir.c, pack.c, ruby.c, struct.c, vm_eval.c: use RARRAY_CONST_PTR().glass
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-29* add RUBY_TYPED_FREE_IMMEDIATELY to data types which only useko1
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-22dir.c: DOTMATCH to current directorynobu
* 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-21dir.c: warn Dir.exists?nobu
* 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-09-13* dir.c (dir_s_glob): [DOC] Improve wording and layout.drbrain
* 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-08-31dir.c: reduce string objectnobu
* 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-10dir.c: normalizationnobu
* 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* file.c (rb_str_normalize_ospath):naruse
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-08file.c: rb_str_normalize_ospathnobu
* 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-07-25fix typonaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-25file.c: split rb_home_dirnobu
* 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-19* dir.c: [DOC] add docs for :encoding option.ktsj
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-03dir.c: get rid of FindFirstFile bugnobu
* 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-03dir.c: do_lstat aliasnobu
* 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-02dir.c: use built-in encoding indexesnobu
* 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-06-12* safe.c (rb_set_safe_level, safe_setter): raise an ArgumentErrorshugo
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-03dir.c: use fd to fstatfsnobu
* 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-02* configure.in: removes AC_CHECK_FUNCS(readdir_r). readdir_r()kosaki
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-05-25* dir.c (bracket): fix copy-paste error. When the first and lastmame
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-20dir.c: compose HFS file namesnobu
* 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-04-26* dir.c (dir_set_pos): Fix a compilation error when seekdir() is notakr
exist. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-18dir.c: not skip dot directories if matchingnobu
* 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-14* dir.c (File.fnmatch): fix typo in documentationeregon
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-12* array.c: Document synonymous methods, by windwiny [GH-277]zzak
* 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-11Fix return value in example by @rkh [fix GH-284]hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e