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

614 Коммитов

Автор SHA1 Сообщение Дата
naruse 3bda122ab9 * file.c (rb_sys_fail_path0): add to append the name of called function
to ease debugging for example blow umask_spec failure.
  http://fbsd.rubyci.org/~chkbuild/ruby-trunk/log/20130309T010202Z.diff.html.gz

* file.c (rb_sys_fail_path): use rb_sys_fail_path0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-14 04:01:39 +00:00
naruse 6751ba4c7a Suppress warning: uninitialized value
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-01 16:37:31 +00:00
zzak c2204ca328 * array.c: Document #<=> return values and formatting
* bignum.c: ditto
* file.c: ditto
* object.c: ditto
* numeric.c: ditto
* rational.c: ditto
* string.c: ditto
* time.c: ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-23 03:35:38 +00:00
kosaki 8a9dc061f5 * file.c (rb_group_member): added an error check. SUS says,
getgroups(small_value) may return EINVAL.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39353 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-21 04:52:38 +00:00
kosaki e93a68abfa * file.c (RB_MAX_GROUPS): moved to
* internal.h (RB_MAX_GROUPS): here.

* file.c (rb_group_member): use RB_MAX_GROUPS instead of
  RUBY_GROUP_MAX. They are the same.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39352 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-21 04:41:39 +00:00
kosaki 1cda6e3968 * file.c (access_internal): removed.
* file.c (rb_file_readable_real): use access() instead of
  access_internal().
* file.c (rb_file_writable_real): ditto.
* file.c (rb_file_executable_real): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-21 04:41:23 +00:00
kosaki ba37db0453 * file.c (eaccess): use access() when not using setuid nor setgid.
This is minor optimization.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-21 04:41:11 +00:00
kosaki 7c465090fd * file.c (rb_group_member): get rid of NGROUPS dependency.
[Bug #7886] [ruby-core:52537]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-21 04:40:58 +00:00
kosaki a24f2d9915 * file.c (rb_file_flock): use rb_thread_wait_for() instead of
rb_thread_polling(). When getting EAGAIN, we need to wait a
  while even if no multi threading.
* thread.c (sleep_for_polling, rb_thread_polling) removed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-14 18:08:40 +00:00
usa 3432474c90 * file.c (rb_file_join): check encoding compatibility before joining
strings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-13 05:02:55 +00:00
kosaki b317bf06a4 * file.c (Init_File): null device definition uses rb_define_const
instead of rb_file_const.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-20 16:00:04 +00:00
nobu eabe74e034 file.c: fix rdoc
* file.c (rb_file_s_extname): fix rdoc for an edge case.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-20 12:34:45 +00:00
zzak b6161a3bad * file.c (File.extname): Documentation for extname on dotfiles and
files ending with a dot. Also, added example for this.
  [ruby-core:47852] [Bug #7112]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-20 06:37:53 +00:00
kosaki c8a3b2ba8b * io.c (Init_IO): removed all rb_file_const() into file.c.
* file.c (Init_File): replace with rb_file_const() with
  rb_define_const() because RDoc don't care rb_file_const.
  [Bug #5530]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-20 05:00:45 +00:00
zzak ca8f327522 * file.c (File::NULL): Document File::NULL constant
[ruby-core:49384] [Bug #7365]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-20 03:34:15 +00:00
shirosaki d33b9a8a72 Fix compatibility of cached expanded load path
* file.c (rb_get_path_check_to_string): extract from
  rb_get_path_check(). We change the spec not to call to_path of
  String object.

* file.c (rb_get_path_check_convert): extract from rb_get_path_check().

* file.c (rb_get_path_check): follow the above change.

* file.c (rb_file_expand_path_fast): remove check_expand_path_args().
  Instead we call it in load.c.

* file.c (rb_find_file_ext_safe): use rb_get_expanded_load_path() to
  reduce expand cost.

* file.c (rb_find_file_safe): ditto.

* internal.h (rb_get_expanded_load_path): add a declaration.

* internal.h (rb_get_path_check_to_string, rb_get_path_check_convert):
  add declarations.

* load.c (rb_construct_expanded_load_path): fix for compatibility.
  Same checks in rb_get_path_check() are added. We don't replace
  $LOAD_PATH and ensure that String object of $LOAD_PATH are frozen.
  We don't freeze non String object and expand it every times. We add
  arguments for expanding load path partially and checking if load path
  have relative paths or non String objects.

* load.c (load_path_getcwd): get current working directory for checking
  if it's changed when getting load path.

* load.c (rb_get_expanded_load_path): fix for rebuilding cache properly.
  We check if current working directory is changed and rebuild expanded
  load path cache. We expand paths which start with ~ (User HOME) and
  non String objects every times for compatibility. We make this
  accessible from other source files.

* load.c (rb_feature_provided): call rb_get_path() since we changed
  rb_file_expand_path_fast() not to call it.

* load.c (Init_load): initialize vm->load_path_check_cache.

* vm.c (rb_vm_mark): mark vm->load_path_check_cache for GC.

* vm_core.h (rb_vm_struct): add vm->load_path_check_cache to store data
  to check load path cache validity.

* test/ruby/test_require.rb (TestRequire): add tests for require
  compatibility related to cached expanded load path.
  [ruby-core:47970] [Bug #7158]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-05 15:27:08 +00:00
nobu 9af8102225 file.c: ASCII-compatible
* file.c (rb_file_join): need to check again after any conversion run.
  [ruby-core:48012] [Bug #7168]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-16 05:56:25 +00:00
nobu 37b8f7b84f file.c: hide result
* file.c (rb_file_join): hide the result under construction until
  return.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-16 02:30:20 +00:00
nobu a583f42062 file.c: ASCII-compatible
* file.c (rb_file_join): check nul-byte only for strings, since
  FilePathStringValue() does it.  [ruby-core:48012] [Bug #7168]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-16 02:27:07 +00:00
nobu 7b4f0c0d1d file.c: ASCII-compatible
* file.c (rb_file_join): path names must be ASCII-compatible.
  [ruby-core:48012] [Bug #7168]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-16 01:54:05 +00:00
nobu ad54de2aca file.c: check_path_encoding
* file.c (check_path_encoding): new function to ensure path name
  encoding to be ASCII-compatible.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-16 01:53:32 +00:00
nobu 872a47c1bf file.c: GC guard
* file.c (realpath_rec): prevent link from GC while link_names refers
  the content.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-12 18:01:56 +00:00
nobu 7085db45e4 file.c: poisoned NUL
* file.c (rb_get_path_check): path name must not contain NUL bytes.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-12 09:18:07 +00:00
nobu 315cbef835 file.c: reduce xmalloc
* file.c (rb_readlink): read symlink in the result string directly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-16 09:24:44 +00:00
nobu a1fa2695e1 file.c: no longer used functions
* file.c (getcwdofdrv, append_fspath): no longer used except for
  cygwin.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-05 05:29:37 +00:00
luislavena 86df08dac6 Improve require/File.expand_path performance on Windows
* configure.in (mingw): add shlwapi to the list of dependency
  libs for Windows.
* win32/Makefile.sub (EXTSOLIBS): ditto.

* internal.h: declare internal functions rb_w32_init_file,
  rb_file_expand_path_internal and rb_file_expand_path_fast.

* file.c (Init_File): invoke Windows initialization rb_w32_init_file

* win32/file.c (rb_file_load_path_internal): new function.
  Windows-specific implementation that replaces file_expand_path.
  [Bug #6836][ruby-core:46996]

* win32/file.c (rb_w32_init_file): new function. Initialize codepage
  cache for faster conversion encodings lookup.

* file.c (file_expand_path): rename to rb_file_expand_path_internal.
  Conditionally exclude from Windows.

* file.c (rb_file_expand_path_fast): new function. delegates to
  rb_file_expand_path_internal without performing a hit to the
  filesystem.

* file.c (file_expand_path_1): use rb_file_expand_path_internal without
  path expansion (used by require).
* file.c (rb_find_file_ext_safe): ditto.
* file.c (rb_find_file_safe): ditto.

* load.c (rb_get_expanded_load_path): use rb_file_expand_path_fast.
* load.c (rb_feature_provided): ditto.

* file.c (rb_file_expand_path): use rb_file_expand_path_internal with
  path expansion.
* file.c (rb_file_absolute_path): ditto.

* test/ruby/test_file_exhaustive.rb: new tests to exercise
  rb_file_expand_path_internal implementation and compliance with
  existing behaviors.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-24 03:44:56 +00:00
nobu c68d29960b load.c: keep encoding of feature name
* file.c (rb_find_file_ext_safe, rb_find_file_safe): default to
  US-ASCII for encdb and transdb.
* load.c (search_required): keep encoding of feature name.  set
  loading path to filesystem encoding.  [Bug #6377][ruby-core:44750]
* ruby.c (add_modules, require_libraries): assume default external
  encoding as well as ARGV.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-23 07:46:12 +00:00
usa 9d2711691e * win32/configure.bat, win32/setup.mak, win32/Makefile.sub: omit Win9x
support.  remove --enable/disable-win95 option.

* include/ruby/win32.h, file.c, win32/win32.c: ditto.

* win32/README.win32: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-09 08:25:06 +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
usa f927ec15c9 * file.c (rb_file_s_basename, rb_file_s_dirname): documentaion fix.
File.basename and File.dirname support File::ALT_SEPARATOR.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-14 07:01:08 +00:00
nobu 2073258a7d obj_init_copy
* object.c (rb_obj_init_copy): should check if trusted too.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05 11:13:18 +00:00
nobu 5212b7fb52 file.c: fix for UNC
* file.c (realpath_rec): UNC prefix does not end with path separator,
  so new separator is needed after it.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-26 07:26:36 +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 2bf3b20dbe * file.c (rb_file_s_basename): rb_enc_asciicompat() evaluates the argument multiple times.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-23 03:04:20 +00:00
nobu 36f6ce4083 * file.c (ruby_enc_find_basename): allow NULL as alllen.
[ruby-dev:45363][Bug #6146]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-15 06:03:02 +00:00
marcandre 7316302483 * include/ruby/intern.h: Add rb_check_arity, rb_error_arity [#6085]
* array.c: Use rb_check_arity / rb_error_arity

* class.c: ditto

* enumerator.c: ditto

* eval.c: ditto

* file.c: ditto

* hash.c: ditto

* numeric.c: ditto

* proc.c: ditto

* process.c: ditto

* random.c: ditto

* re.c: ditto

* signal.c: ditto

* string.c: ditto

* struct.c: ditto

* transcode.c: ditto

* vm_eval.c: ditto

* vm_insnhelper.c: ditto & implementation of rb_error_arity

* test/ruby/test_arity.rb: tests for above

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-14 21:10:34 +00:00
nobu ee98d58f1c * file.c (file_expand_path): use wcscasecmp().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-02 07:37:13 +00:00
shirosaki 4b1e9f0c47 * Makefile.in (PLATFORM_DIR): add a variable for `win32` directory.
* Makefile.in (clean-platform): add new target.
  It cleans `win32` directory.

* common.mk (clean): add a dependency for `win32` directory.
* common.mk (distclean): ditto.
* common.mk (distclean-platform): add new target.
  It cleans `win32` directory.
* common.mk ($(PLATFORM_D)): add new target to make `win32` directory.
* common.mk (win32/win32.$(OBJEXT)): move win32.o into `win32`
  directory.
* common.mk (win32/file.$(OBJEXT)): add new target for win32/file.c.

* configure.in: move win32.o into `win32` directory and add
  win32/file.o to MISSING.

* file.c (file_load_ok, rb_file_load_ok): replace static
  file_load_ok() with public rb_file_load_ok().
  It's to link Windows implementation in win32/file.c.
* file.c (rb_find_file_ext_safe): ditto.
* file.c (rb_find_file_safe): ditto.

* win32/file.c (rb_file_load_ok): new file. Add Windows specific
  optimized implementation of rb_file_load_ok(). We created a
  separated file to avoid too many #ifdef macro which is unreadable.

* win32/Makefile.sub (PLATFORM_DIR): add a variable for `win32`
  directory.
* win32/Makefile.sub (MISSING): move win32.obj into `win32`
  directory and add win32/file.obj to MISSING.
* win32/Makefile.sub (MAKEDIRS): replace MINIRUBY with BASERUBY.
  It's because miniruby doesn't exist when making `win32` directory.
* win32/Makefile.sub (clean-platform): add new target to clean `win32`
  directory.
* win32/Makefile.sub ({$(srcdir)}.c{}.obj): make it not match
  win32/file.c to build properly.
* win32/Makefile.sub (win32/win32.$(OBJEXT)): move win32.obj into
 `win32` directory.

  Patch created with Luis Lavena.
  [ruby-core:42480] [Feature #5999]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-28 15:51:25 +00:00
nobu cbd6a464ce * file.c (utime_internal): fix a variable missed to replace.
[ruby-core:42864] [Bug #6077]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-24 21:55:34 +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
drbrain 9dc0d6fe63 * file.c (rb_f_test): Fix formatting of Kernel#test rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-21 23:02:29 +00:00
usa bfaba73ebb * file.c (append_fspath): need to set the encoding to result always.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-30 03:31:58 +00:00
nobu 97f0b0f558 * file.c (rb_file_s_basename): ignore non-ascii extension in
different encoding, which cannot match.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-25 04:27:45 +00:00
nobu b094ab0948 * file.c (rmext): no extension to strip if empty string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-25 02:40:29 +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
naruse 0d8ad1a96b * file.c (rb_file_join): separator is appended by array length - 1
times. patched by Benoit Daloze [ruby-core:41901] [Bug #5841]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-05 03:18:18 +00:00
naruse 8e411664ab * file.c (file_path_convert): don't convert it when the path string is
ascii only. [ruby-core:41556] [Bug #5733]
  tests are contributed by nobu.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-09 06:01:41 +00:00
naruse c882b8e84d * file.c (file_expand_path): reset coderange after expanding path.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-01 08:17:59 +00:00
akr da74bc7552 * process.c (ruby_setsid): use rb_cloexec_open.
(rb_daemon): ditto.

* ruby.c (load_file_internal): ditto.

* file.c (rb_file_s_truncate): ditto.
  (file_load_ok): ditto.

* random.c (fill_random_seed): ditto.

* ext/pty/pty.c (chfunc): ditto.
  (get_device_once): ditto.

* ext/io/console/console.c (console_dev): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-29 04:01:54 +00:00
nobu cba2e89cdc * file.c (rb_file_join): honor input encodings than ASCII-8BIT.
[ruby-core:40338] [Bug #5483]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-26 06:24:29 +00:00
akr b574a4d4a1 * include/ruby/intern.h (rb_fd_set_cloexec): declared.
* io.c (rb_fd_set_cloexec): new function.
  (ruby_dup): call rb_fd_set_cloexec to set close-on-exec flag.
  (rb_sysopen_internal): ditto.
  (rb_pipe): ditto.
  (io_reopen): ditto.
  (io_cntl): ditto.

* process.c (rb_f_exec): change the default :close_others option to
  true.
  (rb_f_system): ditto.
  (move_fds_to_avoid_crash): call rb_fd_set_cloexec to set
  close-on-exec flag.
  (ruby_setsid): ditto.
  (rb_daemon): ditto.

* thread_pthread.c (rb_thread_create_timer_thread): call
  rb_fd_set_cloexec to set close-on-exec flag.

* ruby.c (load_file_internal): ditto.

* file.c (rb_file_s_truncate): ditto.
  (file_load_ok): ditto.

* random.c (fill_random_seed): ditto.

* ext/pty/pty.c (chfunc): ditto.
  (get_device_once): ditto.

* ext/openssl/ossl_bio.c (ossl_obj2bio): ditto.

* ext/socket/init.c (rsock_socket): ditto.
  (rsock_s_accept_nonblock): ditto.
  (rsock_s_accept): ditto.

* ext/socket/socket.c (rsock_sock_s_socketpair): ditto.

* ext/socket/ancdata.c (discard_cmsg): ditto.
  (make_io_for_unix_rights): ditto.

* ext/socket/unixsocket.c (unix_recv_io): ditto.

* ext/io/console/console.c (console_dev): ditto.

[ruby-core:38140] [Feature #5041]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-22 09:58:15 +00:00
akr b41ccc4a9c * include/ruby/intern.h (rb_update_max_fd): declaration moved from
internal.h.

* file.c: ditto.

* io.c: call rb_update_max_fd for each new fds.

* process.c: ditto.

* random.c: ditto.

* ruby.c: ditto.

* ext/io/console/console.c: ditto.

* ext/openssl/ossl_bio.c: ditto.

* ext/pty/pty.c: ditto.

* ext/socket/init.c: ditto.

* ext/socket/socket.c: ditto.

* ext/socket/ancdata.c: ditto.

* ext/socket/unixsocket.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-20 13:26:10 +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
nobu 685444569c * fix for build on solaris 10.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-16 00:12:55 +00:00
naruse c75c838e16 * file.c (rb_stat_rdev): use DEVT2NUM.
* file.c (rb_stat_rdev_major): ditto.

* file.c (rb_stat_rdev_minor): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-15 01:58:13 +00:00
nobu 4c7106c679 * file.c (rb_file_truncate): fix function.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31352 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-26 15:51:04 +00:00
kosaki 3b011d1a00 * file.c (rb_group_member): kill 256K of stack usage.
the patch was written by Eric Wong. [ruby-core:35699]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-11 12:18:32 +00:00
nobu 4ab39d2202 * file.c (rb_file_flock): use rb_thread_io_blocking_region for the
time being.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-20 07:22:57 +00:00
kosaki 18c11392af * file.c (w32_io_info): get rid of too huge alloca().
[Bug #4313] [ruby-core:34830]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-27 09:35:56 +00:00
nobu 1b00c45dc0 * file.c (file_expand_path): get rid of warnings caused by
-Wdeclaration-after-statement on cygwin.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30388 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-26 13:24:17 +00:00
akr 53360bd50a * file.c: parenthesize macro arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-13 03:01:12 +00:00
kazu 9208951d33 fix typos
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-06 10:01:48 +00:00
naruse 1346b84c19 NTFS's ctime is creation time! [ruby-core:33269]
Note that UFS2, HFS+, ZFS, and ext4 also have birth time.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-20 19:38:42 +00:00
nobu 41cae1744f * file.c (file_expand_path): use cygwin_conv_path on cygwin 1.7 or
later.
* ruby.c (push_include_cygwin): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-11 12:24:41 +00:00
nobu ba8dc58ebb * file.c (NUM2DEVT, DEVT2NUM, PRI_DEVT_PREFIX): fallback to
unsigned int.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-15 14:36:28 +00:00
nobu a45936d454 * configure.in (dev_t): use RUBY_REPLACE_TYPE.
* file.c (rb_stat_inspect): use PRI_DEVT_PREFIX.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-15 11:30:33 +00:00
naruse 694826d7e2 Refix for r29493; it is unsigned.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-14 00:09:07 +00:00
naruse 51427700cc * file.c (DEVT2NUM): added. Size of dev_t is depend on the
environment even if POSIX defines dev_t as unsigned integer.
  For example, OpenVMS, 64bit Solaris 9, and NetBSD 6 defines
  dev_t as 64bit unsigned integer.

* file.c (rb_stat_dev): use DEVT2NUM.

* file.c (rb_stat_dev_major): dev_t is not long. major(3)'s return
  value is int.

* file.c (rb_stat_dev_minor): dev_t is not long. minor(3)'s return
  value is int.

* configure.in: check size of dev_t.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-13 23:09:56 +00:00
nobu 0fd37b09ee * file.c (rb_file_s_readlink): symlink target should be in
filesystem encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-04 14:48:55 +00:00
nobu d2da9597c3 * file.c (rb_get_path_check): clarify error message for
ASCII-incompatible path name.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-29 14:25:23 +00:00
nobu 909477ec1d * file.c (null_device): move from io.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-27 06:26:41 +00:00
nobu 8aa6059dbf * file.c (realpath_rec): rb_str_modify depends on the length, so
resize instead.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-06 09:59:31 +00:00
akr a2ebc53ec4 * file.c (realpath_rec): call rb_str_modify before rb_str_set_len.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-04 21:44:20 +00:00
usa 49e259ec58 * file.c (file_expand_path): wrong condition. [ruby-core:31591]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-02 03:25:12 +00:00
nobu 47fd9eb6e1 * file.c (file_expand_path): suppress a warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-30 07:06:51 +00:00
nobu 6d56e80ad1 * file.c (file_expand_path): home directory must be absolute.
[ruby-core:31537]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-29 23:51:53 +00:00
nobu a99de84663 * file.c (file_expand_path): should check if could find user.
[ruby-core:31538]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-29 23:33:21 +00:00
nobu b67ecc80df * file.c (rb_file_s_basename): pass baselen to rmext.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-28 20:52:16 +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
usa 09e1383bcf * file.c (ruby_find_basename): set correct baselen.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-07 04:22:30 +00:00
usa 2520f3f79c * file.c (ruby_find_basename): should initialize f.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-07 03:03:19 +00:00
usa 09ee12bb20 * io.c (argf_inplace_mode_set): prohibits an assignment of a tainted
value.

* file.c (ruby_find_basename, ruby_find_extname): split from
  rb_file_s_basename() and rb_file_s_extname().

* util.c (ruby_add_suffix): support arbitrary length of the suffix
  to get rid of the potential buffer overflow.
  reported by tarui.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-02 14:31:26 +00:00
usa e2f4729d42 * file.c (rb_realpath_internal, realpath_rec): skip UNC share root
on DOSISH platforms.
  http://pc12.2ch.net/test/read.cgi/tech/1272248179/600


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-29 05:20:06 +00:00
usa 4df965f4ed * file.c (rb_str_encode_ospath): when the encoding of the parameter
is ASCII-8BIT, should recognize as filesystem encoding, and convert
  to UTF-8 on Windows.

* file.c (realpath_rec): should convert to ospath encoding before
  calling lstat().

* file.c (rb_realpath_internal): resolved string should take over
  the encoding of base string.

* transcode.c (rb_str_encode): should return new string always.
  fixed #3444.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-17 09:46:30 +00:00
nobu 45815f9c9d * file.c (rb_f_test): 'W' should test writable by real uid/git,
not world writable.   [ruby-core:30587]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-04 23:30:48 +00:00
naruse 455554b64c * file.c (file_expand_path): Refix r28102: this breaks
r28039. test for [ruby-dev:41429] is added. [ruby-core:30516]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-31 08:47:08 +00:00
nobu b5cd43c998 * file.c (file_expand_path): check if expanded dname encoding is
compatible with fname, not just copying.  [ruby-core:30516]

* test/ruby/test_beginendblock.rb (test_endblockwarn): needs
  encoding comment.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-30 19:03:47 +00:00
mame 59c74fab79 * file.c (rb_file_directory_p): update rdoc. a patch from Ilkka
Laukkanen.  [ruby-core:30016]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28088 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-30 08:10:04 +00:00
nobu 45f6fbf339 * removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-29 18:51:39 +00:00
naruse 97c175fa19 * file.c (rb_home_dir): set filesystem encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-27 14:47:29 +00:00
naruse 84abef0fc0 * file.c (file_expand_path): set encoding as the same of fname
when _result_ is not filesystem encoding. [ruby-dev:41429]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-27 14:47:23 +00:00
naruse ac8346c4c3 * file.c (file_expand_path): use rb_enc_associate_index and
rb_filesystem_encindex. Strings related FileSystem should
  have filesystem_encoding.

* file.c (SET_EXTERNAL_ENCODING): removed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-27 14:47:20 +00:00
usa fd8a1c725b * file.c (file_expand_path): revert a part of r22392. it's commit miss.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-26 11:04:43 +00:00
marcandre c5b5ab0935 * enum.c: Documentation: small fixes
* file.c: ditto

* io.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:51:01 +00:00
marcandre c1ecff1b1e * hash.c: Documentation: change => in call-seq to ->.
* enum.c: Documentation: whitespace fix for r27865

* error.c: ditto

* file.c: ditto

* io.c: ditto

* load.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:31:22 +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
usa 54062a76e7 * file.c (rb_stat): use STAT macro instead of calling stat() directly.
reported by Bill Kelly.  [ruby-core:30012]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-05 06:55:45 +00:00
nobu 21c5ffc535 * file.c (rb_str_encode_ospath): unused variable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-03 01:46:28 +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
akr c41dc085d0 * file.c (file_expand_path): call rb_str_set_len before BUFCHECK to
prevent rb_str_resize in BUFCHECK discard the content.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-30 03:06:43 +00:00
marcandre 478c3e080b * eval.c (make_exception, rb_obj_extend): Fix error messages in case of wrong
number of arguments

* file.c (rb_f_test, rb_file_s_umask): ditto

* numeric.c (int_chr, num_step): ditto

* process.c (rb_f_sleep): ditto

* re.c (rb_reg_initialize_m): ditto

* signal.c (rb_f_kill, sig_trap): ditto

* string.c (rb_str_aref_m, rb_str_aset_m, rb_str_count, rb_str_delete_bang,
  rb_str_slice_bang, rb_str_sub_bang, str_gsub): ditto

* proc.c (curry): rdoc fix

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-30 02:40:57 +00:00
nobu cb508fe739 * file.c (rb_file_s_extname): skip last directory separators.
[ruby-core:29627]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-19 15:43:05 +00:00
nobu 38af94c6ab * file.c (rb_file_dirname): split from rb_file_s_dirname.
* load.c (rb_f_require_relative): use absolute path instead of
  expanded path.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-30 09:26:09 +00:00
mame e70499732a * file.c (rb_get_path_check): prefer #to_path over #to_str. a patch
originally written by me, and modified by Nobuyoshi Nakada.
  [ruby-core:24257]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-25 14:22:41 +00:00
naruse 152934a300 * file.c (file_expand_path): set length of string before calling
rb_enc_check because rb_enc_check scans its content.
  This prevents warnings by valgrind.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-24 01:25:02 +00:00
mame 6ff75042db * compile.c, iseq.c, ruby.c, vm.c, vm_core.h, vm_eval.c: add absolute
path field into rb_iseq_t.  The field contains a string representing
  a path to corresponding source file. or nil when the iseq is created
  from -e, stdin, eval, etc.  This field is used for require_relative.
  [ruby-dev:40004]

* load.c (rb_f_require_relative): add C implementation of
  require_relative.

* prelude.rb (require_relative): get rid of Ruby implementation of
  require_relative.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-16 17:40:00 +00:00
nobu b215b9742e * file.c (file_expand_path): ignore dname if it has different
drive letter or UNC.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-16 02:23:51 +00:00
nobu ae0224673e * file.c (Init_File): do not define File::ALT_SEPARATOR on cygwin.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26932 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-14 22:51:08 +00:00
nobu 71f4f96249 * file.c (realpath_rec): use same cache.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-14 22:41:04 +00:00
nobu b24c8e4dd6 * file.c (file_alt_separator): commit miss.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-14 22:33:09 +00:00
nobu 980a954f11 * file.c (FILE_ALT_SEPARATOR): separated condition.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-14 22:16:12 +00:00
matz 5cff0face3 * file.c (EXPAND_PATH_BUFFER): make it back to usascii, to prevent
infinite loop on some platform. [ruby-dev:40629]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-13 22:23:02 +00:00
matz dc6075844d * file.c (file_expand_path): should not just copy the encoding
from fname.  [ruby-core:28635]

* file.c (EXPAND_PATH_BUFFER): set filesystem_encoding, not
  usascii for path buffer.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-13 14:50:26 +00:00
shugo d9fe7ef492 * load.c (rb_get_expanded_load_path): does not expand paths if all
the items in $: are absolute paths.  [ruby-core:28113]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-13 01:34:38 +00:00
nobu 0884036a0a * file.c (rb_file_s_basename): check encoding of suffix.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-12 15:44:24 +00:00
akr 785b31bed4 * file.c: add optional basedir argument for realpath/realdirpath.
(realpath_internal): handle basedir.
  (rb_file_s_realpath): extract basedir from argument list.
  (rb_file_s_realdirpath): extract basedir from argument list.

* lib/pathname.rb (realpath): pass basedir.
  (realdirpath): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-07 04:55:34 +00:00
naruse 8a144fdedc * encoding.c (enc_set_filesystem_encoding):
filesystem encoding on Mac OS X is now
  default external encoding. so Mac OS X is now
  treated as one of Unix. [ruby-dev:40439]

* file.c (file_path_convert): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-06 17:11:28 +00:00
nobu 9c45868b41 * file.c (rb_find_file_ext_safe, rb_find_file_safe): skip argument
checks in file_expand_path().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-02 05:29:27 +00:00
akr 792b3efa62 * file.c (rb_group_member): renamed from group_member.
don't use group_member() in glibc because it's not valgrind clean.
  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=570047


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-16 12:00:24 +00:00
akr 688ca71c13 * file.c (realpath_rec): rb_path_last_separator may return NULL.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-03 11:08:44 +00:00
nobu 54e45b30cc * file.c (be_chown, be_fchown, eaccess): suppressed warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-25 09:47:11 +00:00
naruse d5b0c4b1f3 * dln.c, file.c, io.c, signal.c: add __HAIKU__.
patched by Alexander von Gluck [ruby-core:27767]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-25 03:06:06 +00:00
akr f6f3d1bc0e * string.c (rb_str_set_len): call rb_str_modify.
* file.c (realpath_rec): don't call rb_str_modify before
  rb_str_set_len.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-12 12:56:15 +00:00
akr d60d63ef80 * file.c (realpath_internal): call rb_secure.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-12 11:47:03 +00:00
usa 37ce3f6e0d * file.c (realpath_rec): trace symbolic link only when supporting
readline().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-12 04:35:53 +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
akr 3512a38d3b * file.c (rb_f_test): use string form in unknown command error
message.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-07 18:51:42 +00:00
naruse c796b348c6 * file.c (file_path_convert): fix fs_encoding is not assign.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-24 01:20:18 +00:00
naruse 07ae16d18c * file.c (file_path_convert): delay getting UTF8-MAC encoding
while really needed. [ruby-core:26807]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-21 05:45:48 +00:00
usa 4bfd133993 * file.c (file_path_convert): delay getting filesystem encoding
while really needed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-18 06:28:19 +00:00
naruse 6c2373ea67 * io.c (rb_scan_open_args): move path encoding conversion
for filesystem encoding of Mac OS X.

* file.c (file_path_convert): added for convert encoding
  of file path.

* file.c (rb_get_path_check): add file_path_convert.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-18 02:41:25 +00:00
marcandre 705c567194 * string.c: rdoc for <=>, casecmp
* bignum.c: rdoc for <=>

* file.c: ditto

* time.c: ditto

* compar.c: rdoc

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-28 04:50:09 +00:00
nobu 89afd642aa * file.c (path_check_0): prevent from GC.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-10 14:57:46 +00:00
usa d70e9a5568 * win32/win32.c, include/ruby/win32.h (rb_w32_access): new function to
replace MSVCRT's access().
  [ruby-core:25761]

* file.c (eaccess): workaround for recent MSVCRT is no longer needed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-25 07:04:25 +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 23c95ef6c7 * file.c (stat_data_type): typed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-09 03:01:37 +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
nobu ca93e00559 * file.c (rb_file_s_basename): returns new string instead of
shared string from FilePathStringValue().  [ruby-core:24199]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-08 07:47:09 +00:00
nobu ae72efc541 * file.c (BUFCHECK): use common bdiff.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-29 08:16:19 +00:00
nobu b861b2a6b2 * file.c (file_expand_path): should copy original encoding.
[ruby-dev:38612]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-29 08:14:39 +00:00
nobu 8b920b4ac8 * file.c (rb_get_path_check): check with given safe level.
* file.c (rb_find_file_ext_safe, rb_find_file_safe): ditto.

* safe.c (rb_insecure_operation): function to raise security error.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-23 12:28:16 +00:00
nobu ff1b8b7593 * file.c (rb_find_file_ext, rb_find_file): no needs to expand
paths with tilde twice.

* load.c (rb_f_load): load the given path directly if not found in
  load_path.

* load.c (search_required): search file in specified safe level.

* load.c (rb_require_safe): path to load is already searched in
  search_required().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23828 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-23 07:05:04 +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
nobu 7785612a38 * file.c (file_expand_path): drive letter is ascii only.
[ruby-dev:38612]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-17 16:29:22 +00:00
nobu 439ad47eb8 * file.c (rb_find_file_ext, rb_find_file): canonicalize absolute
paths.  [ruby-core:23845]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-14 01:49:23 +00:00
nobu 122018e802 * file.c (rb_file_size): added rdoc. a patch from Run Paint Run
Run at [ruby-core:23839].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-14 01:23:21 +00:00