summaryrefslogtreecommitdiff
path: root/file.c
AgeCommit message (Collapse)Author
2015-11-08* file.c: Add O_TMPFILE.glass
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-23* file.c: fix indent style. [fix GH-977]hsbt
* test/ruby/test_string.rb: indent. [fix GH-975] [ci skip] These patches are contributed from @yui-knk git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-19file.c: fix typosnobu
* file.c (rb_file_expand_path_internal): fix typos. [ruby-core:71111] [Bug #11601] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18* file.c (rb_file_identical_p): not necessary to compare the paths afterusa
comparing the file indexes on Windows. designate by kosaki. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18file.c: fix compile errornobu
* file.c (rb_file_s_rename): remove unmatched endif not removed at r52161. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18* file.c (rb_file_identical_p): simplify ifdefskosaki
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18* ChangeLog: Good-bye OS/2.kosaki
* common.mk: ditto. * configure.in: ditto. * dln_find.c: ditto. * ext/Setup.emx: ditto. * ext/extmk.rb: ditto. * ext/socket/extconf.rb: ditto. * ext/zlib/extconf.rb: ditto. * file.c: ditto. * include/ruby/defines.h: ditto. * io.c: ditto. * lib/mkmf.rb: ditto. * missing/os2.c: ditto. * process.c: ditto. * ruby.c: ditto. * NEWS: announce OS/2 is no longer supported. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18* file.c (ruby_is_fd_loadable): this should be fail if st_mode iskosaki
not regular file nor FIFO. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-17file.c: set errnonobu
* file.c (ruby_is_fd_loadable): set proper errno. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-17* ruby.c (open_load_file): reset O_NONBLOCK after open.kosaki
Even if S_ISREG() is true, the file may be file on FUSE filesystem or something. We can't assume O_NONBLOCK is safe. Moreover, we should wait if the path is point to FIFO. That's FIFO semantics. GVL should be transparent from ruby script. Thus, just reopen without O_NONBLOCK for filling the requirements. [Bug #11060][Bug #11559] * ruby.c (loadopen_func): new for the above. * file.c (ruby_is_fd_loadable): new. for checks loadable file type of not. * file.c (rb_file_load_ok): use ruby_is_fd_loadble() * internal.h: add ruby_is_fd_loadble() * common.mk: now, ruby.o depend on thread.h. * test/ruby/test_require.rb (TestRequire#test_loading_fifo_threading_success): new test. This test successful case that loading from FIFO. * test/ruby/test_require.rb (TestRequire#test_loading_fifo_threading_raise): rename from test_loading_fifo_threading. You souldn't rescue an exception if you test raise or not. Moreover, this case should be caught IOError because load(FIFO) should be blocked until given any input. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-17string.c: rb_str_cat_conv_enc_optsnobu
* file.c (rb_file_expand_path_internal): concatenate converted string to the result instead of making converted string and append it. * string.c (rb_str_cat_conv_enc_opts): from rb_str_conv_enc_opts, separate function to concatenate with transcoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-17file.c: prefer encoding index as possiblenobu
* file.c (rb_str_encode_ospath): prefer encoding index as possible until rb_encoding is needed. * file.c (rb_file_expand_path_internal): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-16file.c: non-blocking opennobu
* file.c (rb_file_load_ok): open in non-blocking mode withoout releasing GVL. don't care about others than regular files and directories. [ruby-dev:49272] [Bug #11559] * ruby.c (load_file_internal): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-04file.c: get rid of intermediate objectsnobu
* file.c (rb_str_normalize_ospath): place normalized strings to the result string directly, to get rid of intermediate objects and copying. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-24file.c: same timespecnobu
* file.c (rb_file_s_utime): same timespec for same time object. assume time objects are static. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-18file.c: File.mkfifonobu
* file.c (rb_file_s_mkfifo): implement File.mkfifo. [Feature #11536] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-15encindex.h: ENCINDEXnobu
* encindex.h: separate encoding index constants from internal.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-12* file.c: access()/eaccess() wrapping methods check more than just uid.hsbt
[fix GH-1007][ci skip] Patch by @eam git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-05internal.h: move rb_readlink declarationnobu
* internal.h (rb_readlink): move the declaration. * ruby.c (dladdr_path): rb_readlink now requires the result encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-02file.c: use filesystem encodingnobu
* 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-08-28file.c: syserr_fail2_innobu
* 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-27win32.c: fchmodnobu
* 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-27file.c: fix messagesnobu
* 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-26win32.c: fake lchownnobu
* 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-24win32.c: symlinknobu
* 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-07-24Add tests for `File.extname`nobu
* 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-07file.c: skip invalid bytenobu
* 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-06-18* include/ruby/ruby.h: $SAFE=2 is now obsolete.hsbt
* 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-14file.c: open without gvlnobu
* 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-13* file.c (rb_stat_ino): get inode from the interval of struct st.naruse
* 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-12* file.c (File::SHARE_DELETE): new flag to be able to delete opened fileusa
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-05-16wrapper object before allocnobu
* 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-04-11* file.c (rb_f_test): Consider nsec for "=", "<" and ">" for "test"akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-23file.c: move rb_readlink on Windowsnobu
* 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-23win32.c: w32_lstati64nobu
* 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-02-20file.c: fix handle leaknobu
* 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-01-24ruby.c: replace with real pathnobu
* 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-21* file.c: Document other cases of missing birthtime on OS with patchzzak
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-19* file.c: NotImplementedError is raised if birthtime is unavailable.zzak
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
2014-12-25file.c: drop ignored charsnobu
* 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-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-28file.c: unnecessary #undefnobu
* 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-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-21Enable nacl_io in pepper-ruby.yugui
* 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-11* file.c: include sys/time.h only if HAVE_SYS_TIME_Hyugui
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-11file.c: fix compile error on Linuxnobu
* 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* remove trailing spaces.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-11* file.c (HAVE_UTIMENSAT): disabled for NativeClient.yugui
Fixes build error. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-11Fixes build failures on Portable Native Client.yugui
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-11Merges a patch form naclports.yugui
* 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: * https://chromium.googlesource.com/external/naclports.git/+/873ca4910a5f9d4206306aacb4ed79c587c6a5f3/ports/ruby/nacl.patch git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e