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

628 Коммитов

Автор SHA1 Сообщение Дата
nobu f9ac2106bf file.c: use filesystem encoding
* file.c (rb_realpath_internal): use filesystem encoding if the
  argument is in ASCII encodings.
* win32/file.c (rb_readlink): needs the result encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-02 07:58:24 +00:00
nobu 754b3342fe file.c: syserr_fail2_in
* file.c (syserr_fail2_in): pass errno from callers.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-28 11:48:45 +00:00
nobu 262b10210f win32.c: fchmod
* win32/win32.c (fchmod): implement by using
  SetFileInformationByHandle.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-27 04:01:37 +00:00
nobu dc05dfd496 file.c: fix messages
* file.c (sys_fail2): show method function names but not
  "sys_fail2".

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-27 01:03:55 +00:00
nobu 597da7b2d0 win32.c: fake lchown
* win32/win32.c (lchown, rb_w32_ulchown): fake lchown.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-26 05:21:41 +00:00
nobu 2e5c105ff2 win32.c: symlink
* win32/win32.c (w32_symlink): implement symlink().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-24 21:34:45 +00:00
nobu 4e58f21f79 Add tests for `File.extname`
* file.c (rb_file_s_extname): [DOC] add an example.
* test/ruby/test_path.rb (test_extname): add tests.  [Fix GH-978]
  * path starts with dot ('.a.rb')
  * path includes dir name ('a/b/d/test.rb')
  * path includes dir name and dir name starts with dot
    ('.a/b/d/test.rb')

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-24 07:35:38 +00:00
nobu 8a0ab36db1 file.c: skip invalid byte
* file.c (rb_str_normalize_ospath): skip invalid byte sequence not
  to loop infinitely.  this case usually does not happen as the
  input name should come from real file systems.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-07 06:02:21 +00:00
hsbt 5d6ca9e950 * include/ruby/ruby.h: $SAFE=2 is now obsolete.
* dir.c, ext/fiddle/handle.c, ext/socket/basicsocket.c, file.c
  gc.c, io.c, process.c, safe.c, signal.c, win32/file.c:
  removed code for $SAFE=2
* test/erb/test_erb.rb, test/fiddle/test_handle.rb
  test/ruby/test_env.rb: removed tests for $SAFE=2.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-18 14:21:03 +00:00
nobu 0b3ef899f2 file.c: open without gvl
* file.c (rb_file_load_ok): try opening file without gvl not to
  lock entire process.  [Bug #11060]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-14 08:20:43 +00:00
naruse 4ff07119e9 * file.c (rb_stat_ino): get inode from the interval of struct st.
* win32/win32.c (stati64_set_inode): get nFilIndexHigh/Low, and set it
  to the interval of struct st as inode.

* win32/win32.c (stati64_set_inode_handle): call stati64_set_inode.

* win32/win32.c (rb_w32_fstati64): call stati64_set_inode_handle.

* win32/win32.c (stati64_handle): call stati64_set_inode.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-13 11:46:38 +00:00
usa 2bc2802096 * file.c (File::SHARE_DELETE): new flag to be able to delete opened file
on Windows.

* include/win32/win32.c (O_SHARE_DELETE): new pseudo file mode flag.

* win32/win32.c (rb_w32_{w,}open): support above flag.  [EXPERIMENTAL]

* NEWS: mention about this feature.
  [Feature #11218] [ruby-dev:49022]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-12 12:14:06 +00:00
nobu cb54008be6 wrapper object before alloc
* error.c (rb_name_err_mesg_new): new wrapper object before
  allocate data area and get rid of potential memory leak.
  GC guards are no longer needed.

* file.c (stat_new_0): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-16 12:56:29 +00:00
akr 28ca0b0f20 * file.c (rb_f_test): Consider nsec for "=", "<" and ">" for "test"
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-11 14:34:26 +00:00
nobu 2ffb87995a file.c: move rb_readlink on Windows
* win32/file.c (rb_readlink): move from file.c for better buffer
  allocation and the result encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-23 12:22:10 +00:00
nobu f5b96e594c win32.c: w32_lstati64
* win32/win32.c (winnt_stat): stat with following symbolic links.
* win32/win32.c (winnt_lstat): rename old winnt_stat, which does
  not follow symbolic links.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-23 05:40:48 +00:00
nobu 471457733e file.c: fix handle leak
* file.c (rb_file_identical_p): fix handle leak, ensure to close
  the handle of the first argument.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-20 08:27:14 +00:00
nobu c3ad34c7fa ruby.c: replace with real path
* ruby.c (dladdr_path): replace the executable path with symlinked
  real path.  dladdr(3) on Linux returns the argv[0] as dli_fname
  instead of the real path, for a symbol defined in the executable
  file itself.  [Bug #10776]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-24 12:24:27 +00:00
zzak 4908827022 * file.c: Document other cases of missing birthtime on OS with patch
provided by @sho-h similar to GH-817. [ci skip] [DOC]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-21 00:44:06 +00:00
zzak 857756ac6e * file.c: NotImplementedError is raised if birthtime is unavailable.
Patch by @y-yagi san and [Fixes GH-817] [ci skip] [DOC]

* ext/pathname/pathname.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-19 17:57:03 +00:00
nobu f0806c4863 file.c: drop ignored chars
* file.c (rb_file_expand_path_internal): drop characters ignored
  by filesystem on Mac OS X.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-25 07:01:22 +00:00
nobu e580a631be use 0 for reserved
use 0 for rb_data_type_t::reserved instead of NULL, since its type
may be changed in the future and possibly not a pointer type.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-01 06:38:04 +00:00
nobu 2b92335efd file.c: unnecessary #undef
* file.c (flock): remove unnecessary #undef flock, trace of green
  thread polling.  patched by Rohan Garg.  [Bug #10551]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-28 03:39:18 +00:00
akr 7cd76ab0c5 * internal.h: Include ruby.h and ruby/encoding.h to be
includable without prior inclusion.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15 11:49:06 +00:00
yugui 165221441c Enable nacl_io in pepper-ruby.
* configure.in (XCFLAGS): Add include path for NaCl libraries.
  (XLDFLAGS): ditto.
  (NACL_LIB_PATH): new stubstitution

* nacl/nacl-config.rb: support NACL_LIB_PATH

* nacl/package.rb: ditto.

* nacl/pepper_main.c: replace old implementations with nacl_io.

* nacl/GNUmakefile.in: link nacl_io to pepper_ruby

* ruby.c (rb_load_file): remove __attribute__((weak)) because the old
  override hack was replaced with nacl_io.

* file.c (rb_file_load_ok): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-21 15:23:21 +00:00
yugui 8980a9b47b * file.c: include sys/time.h only if HAVE_SYS_TIME_H
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-11 16:39:15 +00:00
nobu 0d43e14841 file.c: fix compile error on Linux
* file.c (sys/time.h): include after unistd.h to get rid of
  mismatch on struct stat and some system call functions on Linux.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-11 15:13:24 +00:00
svn 0d1b2755f5 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-11 13:33:36 +00:00
yugui 916fff3b61 * file.c (HAVE_UTIMENSAT): disabled for NativeClient.
Fixes build error.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-11 13:33:27 +00:00
yugui 57bc5eaf2f Fixes build failures on Portable Native Client.
Note: Some of the fixes are for newlib in general but not NaCl-specific.

* include/ruby/intern.h (rb_fd_select): declare struct timeval, or the
  struct gets local to the function in C99.

* file.c (#include): add nacl/stat.h for PNaCl.
  (utimes): added a declaration for PNaCl.
  (stat_atimespec): stat::st_atimensec is long long but
  timespec::tv_nsec is long in PNaCl.
  (stat_mtimespec, stat_ctimespec): ditto.
  (rb_group_member): disable getgroups unless HAVE_GETGROUPS.
  (eaccess): unify the fallback to generic defined(USE_GETEUID).

* io.c: include sys/time.h for struct timeval.
  (rb_close_before_exec): nothing we can do if F_GETFD is not
  available.
  (ioctl): pnacl newlib actually doesn't have ioctl.

* process.c (maxgroups): it is used iff
   defined(_SC_NGROUPS_MAX) || defined(NGROUPS_MAX) but not
   defined(HAVE_GETGROUPS) || defined(HAVE_SETGROUPS).
  (obj2gid): fail unless the object is a Fixnum if getgrnam is not
  available.
  (disable_child_handler_fork_child): sigaction is not available in
  PNaCl newlib.

* configure.in (warnflags, strict_warnflags): avoid -ansi for strlcpy.
  (rb_cv_gcc_atomic_builtins): also check
  __atomic_or_etch because it is used in ruby_atomic.h.
  (rb_cv_gcc_sync_builtins): ditto.
  (HAVE_GETGRNAM): added.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-11 13:33:14 +00:00
yugui 69ac654c90 Merges a patch form naclports.
* configure.in (RUBY_NACL and others): Supports PNaCl.
* dln.c: replace the old hacky dynamic loading over HTTP with nacl_io.
* file.c: tenatively use access(2) instead of eaccess.
  (rb_file_load_ok): weaken with attribute but not by postprocess.
* io.c (socket.h): now NaCl has socket.h
  (flock): disable here instead of nacl/ioctl.h
* nacl/GNUmakefile.in (CC, LD, NM, AR, AS, RANLIB, OBJDUMP, OBJCOPY):
  respect path to them if they are absolute.
  This helps naclports to build ruby in their source tree.
  (PROGRAM_NMF, .SUFFIXES): support .pnexe for PNaCl.
  (ruby.o, file.o): move the hack to attributes in ruby.c and file.c
* nacl/ioctl.h: removed. move the hack to io.c.
* nacl/nacl-config.rb: support arm, pnacl and others.
* nacl/pepper_main.c: support build in a naclports tree.
* ruby.c (rb_load_file): weaken with attribute but not by postprocess.

The patch is by sbc@google.com and the Native Client Authors.
It is available at:
* 873ca4910a/ports/ruby/nacl.patch

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-11 02:11:53 +00:00
normal dfa336cd7d file.c: clear tmp buffer on failures
Reduces GC malloc pressure (MAXPATHLEN is 4096 on my system),
rb_find_file_safe hits this path at least twice every time
ruby starts.

* file.c (rb_find_file_ext_safe): clear tmp buffer on failure
  (rb_find_file_safe): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-21 03:26:47 +00:00
nobu aa3b506270 add some documents [ci skip]
* bignum.c (Init_Bignum): [DOC] Bignum::GMP_VERSION.

* complex.c (Init_Complex): [DOC] ignore an internal class.

* dir.c (Init_Dir): [DOC] File::FNM_SYSCASE.

* file.c (rb_file_exists_p): [DOC] File.exists? is deprecated.

* object.c (rb_mod_initialize_clone): [DOC] ignore implementation
  detail.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-28 11:28:55 +00:00
zzak 1fd840a063 * file.c: [DOC] Clarify how File.file? handles symbolic links. Also
cleaned up the rdoc style for this method, more to follow.
  Originally reported by Michael Renner [Bug #10067]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-27 20:23:45 +00:00
ktsj 9f051c80dc * file.c, ext/pathname/pathname.c: [DOC] correct position of method rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-06 12:45:27 +00:00
hsbt b5a000bf4c * file.c: [DOC] document File.join returns a string.
Contributed by @dapplebeforedawn. [fix GH-646]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-30 02:37:31 +00:00
nobu e99ee55abc constify parameters
* include/ruby/intern.h: constify `argv` parameters.

* include/ruby/ruby.h: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-18 06:16:39 +00:00
nobu e2890123ac file.c: shrink expanded path
* file.c (expand_path): shrink expanded path which no longer needs
  rooms to append.  [ruby-core:63114] [Bug #9934]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-12 04:09:41 +00:00
nobu f2980e3e20 encoding.h: constify rb_encoding
* include/ruby/encoding.h: constify `rb_encoding` itself, not only
  arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-02 20:23:47 +00:00
nobu 046831094b constify rb_encoding and OnigEncoding
* include/ruby/encoding.h: constify `rb_encoding` arguments.
* include/ruby/oniguruma.h: constify `OnigEncoding` arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-01 22:06:11 +00:00
nobu bfa4f32069 file.c: birthtime on Windows
* file.c (stat_birthtime): `ctime` is actually `created time` on Windows.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-22 14:34:54 +00:00
naruse 6b4f9210b0 * file.c (stat_birthtime): add birthtime support [Feature #9647]
* file.c (rb_stat_birthtime): add File::Stat.birthtime

* file.c (rb_file_s_birthtime): add File.birthtime

* file.c (rb_file_birthtime): add File#birthtime

* configure.in: check struct stat.st_birthtimespec.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-22 11:49:22 +00:00
naruse 210f863906 revert File::Statfs [Feature #9772]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-22 10:39:48 +00:00
tadf 08e0c31d14 * file.c (rb_f_test): removed meaningless "case 'a'".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-05 19:38:11 +00:00
ngoto 09f51c56d8 * file.c (HAVE_STRUCT_STATVFS_F_BASETYPE): File::Statfs#fstypename
is supported on AIX, HP-UX, and Solaris, by using the value of
  struct statvfs.f_basetype.
* configure.in (HAVE_STRUCT_STATVFS_F_BASETYPE): check struct
  statvfs.f_basetype which is available on AIX, HP-UX, and Solaris.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-02 15:24:04 +00:00
kazu a0a5836487 add indent
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-01 13:25:43 +00:00
kazu 2957f88f8f * file.c: Change AND condition to nested condition.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-01 13:25:40 +00:00
ngoto 793d9c14df * file.c (FSTATFS): check availability of struct statfs and
struct statvfs in addition to fstatfs(2) and fstatvfs(2).
  This fixes error in Solaris. [Bug #9788] [ruby-dev:48145]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-30 15:38:31 +00:00
kazu 7973883c3a new macros for statfs_t
* file.c (HAVE_STRUCT_STATFS_T_F_FSTYPENAME): Add new macro for
  statfs_t.
* file.c (HAVE_STRUCT_STATFS_T_F_TYPE): ditto.

* file.c (rb_io_statfs): check FSTATFS macro only instead of
  HAVE_FSTATFS and HAVE_FSTATVFS.

* file.c (statfs_type): use new macro.
* file.c (statfs_fstypename): ditto.
* file.c (statfs_inspect): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-28 19:35:42 +00:00
kazu c521d87f68 fix preprocessor condition
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-28 19:35:39 +00:00