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

232 Коммитов

Автор SHA1 Сообщение Дата
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
akr 84769be727 * dir.c (struct dir_data): change path field char * to VALUE.
(mark_dir): new function for mark path field.
  (free_dir): follow the path field change.
  (dir_s_alloc): ditto.
  (dir_initialize): ditto.
  (dir_s_open): ditto.
  (dir_inspect): ditto.
  (dir_path): return (duplicate of) the path field to preserve
  encoding.  [ruby-dev:35685]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-30 13:13:57 +00:00
naruse 7e5be7e131 * dir.c (char_casecmp): fix: return 0 if either of characters is NUL.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-29 10:31:31 +00:00
akr 2f1908b1cf * dir.c (struct dir_data): intenc field removed.
(dir_s_alloc): intenc initialization removed.
  (dir_initialize): :internal_encoding option removed.  dirname code
  conversion removed.
  (dir_enc_str): code conversion removed.
  [ruby-dev:35661]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-28 17:12:51 +00:00
nobu 0acca9a826 * compile.c (insn_data_to_s_detail), file.c (rb_stat_inspect),
iseq.c (ruby_iseq_disasm_insn, ruby_iseq_disasm),
  process.c (pst_message), re.c (match_inspect): use rb_str_catf.

* dir.c (dir_inspect), iseq.c (iseq_inspect, insn_operand_intern): use
  rb_sprintf.

* error.c (rb_name_error, rb_raise, rb_loaderror, rb_fatal): use
  rb_vsprintf.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-22 08:53:34 +00:00
akr 1b16c560e4 * dir.c (dir_initialize): use rb_convert_type instead of
rb_check_convert_type to prevent SEGV by Dir.new(".", true).
  (dir_initialize): use FilePathValue before rb_enc_get(dirname) to
  prevent SEGV by Dir.new(0).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-20 19:57:56 +00:00
nobu 8dfc2f81c0 * dir.c (struct glob_args, rb_glob_caller, rb_glob2, push_pattern),
(glob_brace): make consistent prototypes.

* dir.c (push_glob): set enc in the caller of rb_glob_caller as well
  as rb_glob2.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-09 02:11:21 +00:00
usa 2db158667a * dir.c: shoudn't use ruby object in globbing, because glob service
routines are called before initializing ruby on some platforms (ex.
	  windows).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-08 02:44:12 +00:00
naruse 933d553de0 * dir.c (Next): use rb_enc_mbclen. [ruby-dev:35390]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-08 01:52:11 +00:00
naruse 64cfcd7c63 * dir.c (Next): use rb_enc_precise_mbclen.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-07 23:00:58 +00:00
naruse 0ad460dde8 * dir.c: preserve encoding of strings in glob and fnmatch.
* include/ruby/ruby.h: related changes.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-07 17:29:44 +00:00