summaryrefslogtreecommitdiff
path: root/file.c
AgeCommit message (Collapse)Author
2016-05-08file.c: home dir fall backnobu
* file.c (rb_home_dir_of): return the default home path if the user name is the current user name, on platforms where struct pwd is not supported. a temporary measure against [Bug #12226]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-02* win32/win32.c, include/ruby/win32.h (rb_w32_utruncate): implements newusa
truncate alternative which accepts UTF-8 path. * file.c (truncate): use above function. [Bug #12340] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-22* file.c, win32/file.c: Removed obsoleted safe level checks.hsbt
[fix GH-1327] Patch by @cremno git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-13file.c: File.empty?nobu
* file.c (Init_File): add alias File.empty? to File.zero?. [Feature #9969] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-10file.c: prefer rb_check_aritynobu
* file.c (rb_file_s_expand_path, rb_file_s_absolute_path): use rb_check_arity instead of rb_scan_args for a simple optional argument. * file.c (rb_file_s_realpath, rb_file_s_realdirpath): ditto. * file.c (rb_file_s_basename): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-10file.c: apply2files returns Fixnumnobu
* file.c (apply2files): return Fixnum so that callers can just return it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-10file.c: apply to argvnobu
* file.c (apply2files): apply to a VALUE vector instead of a temporary array. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-10no argument conversions in rb_realpath_internalnobu
* file.c (rb_realpath_internal): no argument conversions since this internal function does not need to_path and encoding conversions, not to be affected by the default internal encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-18file.c: simplify rb_file_s_splitnobu
* file.c (rb_file_s_split): use rb_file_dirname instead of rb_file_s_dirname with unused Qnil. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-14ruby.c: reduce fstatnobu
* file.c (ruby_is_fd_loadable): now return -1 if loadable but may block. * ruby.c (open_load_file): wait to read by the result of ruby_is_fd_loadable, without fstat. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-19file.c: fix documentationheadius
* file.c: mode is optional, defaults to 0666. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-23prefer rb_syserr_failnobu
* file.c, io.c, util.c: prefer rb_syserr_fail with saved errno over setting errno then call rb_sys_fail, not to be clobbered potentially and to reduce thread local errno accesses. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-09* *.c (*_memsize): do not check ptr.ko1
NULL checking is finished Before call of memsize functions. See r52979. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08file.c: call get_stat only oncenobu
* file.c (rb_stat_wr, rb_stat_ww): call get_stat only once and reduce checking struct. patch by Yuki Kurihara in [ruby-core:71949]. [Misc #11789] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-24Drop support for BeOSnobu
* beos: Drop support for BeOS now that Haiku is stable. [Fix GH-1112] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-24Add missing punctuation to File docs [ci skip]nobu
* file.c: [DOC] add a missing period to File docs, to terminate the sentence and separate from the next sentence. [Fix GH-1111] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-23Haiku now best effort supportnobu
* configure.in: remove obsolete workarounds for Haiku. * dln.c, file.c, io.c: remove obsolete Haiku workarounds. * thread_pthread.c: add stack bounds detection for Haiku. * signal.c: get stack pointer from signal context on Haiku. [ruby-core:67923] [Bug #10811] [Fix GH-1109] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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