aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
Commit message (Collapse)AuthorAgeFilesLines
* file.c: home dir fall backnobu2016-05-081-5/+13
| | | | | | | | | * 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
* * win32/win32.c, include/ruby/win32.h (rb_w32_utruncate): implements newusa2016-05-021-0/+2
| | | | | | | | | | 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
* * file.c, win32/file.c: Removed obsoleted safe level checks.hsbt2016-04-221-1/+1
| | | | | | [fix GH-1327] Patch by @cremno git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* file.c: File.empty?nobu2016-04-131-0/+1
| | | | | | | * 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
* file.c: prefer rb_check_aritynobu2016-04-101-21/+12
| | | | | | | | | | | | * 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
* file.c: apply2files returns Fixnumnobu2016-04-101-21/+9
| | | | | | | * 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
* file.c: apply to argvnobu2016-04-101-31/+28
| | | | | | | * 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
* no argument conversions in rb_realpath_internalnobu2016-04-101-1/+2
| | | | | | | | | * 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
* file.c: simplify rb_file_s_splitnobu2016-03-181-1/+1
| | | | | | | * 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
* ruby.c: reduce fstatnobu2016-03-141-1/+2
| | | | | | | | | * 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
* file.c: fix documentationheadius2016-01-191-1/+1
| | | | | | * 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
* prefer rb_syserr_failnobu2015-12-231-19/+28
| | | | | | | | * 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
* * *.c (*_memsize): do not check ptr.ko12015-12-091-1/+1
| | | | | | | | | | 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
* file.c: call get_stat only oncenobu2015-12-081-4/+6
| | | | | | | | * 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
* Drop support for BeOSnobu2015-11-241-27/+0
| | | | | | | * 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
* Add missing punctuation to File docs [ci skip]nobu2015-11-241-1/+1
| | | | | | | * 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
* Haiku now best effort supportnobu2015-11-231-2/+2
| | | | | | | | | | * 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
* * file.c: Add O_TMPFILE.glass2015-11-081-0/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * file.c: fix indent style. [fix GH-977]hsbt2015-10-231-1/+1
| | | | | | | * 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
* file.c: fix typosnobu2015-10-191-2/+2
| | | | | | | * 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
* * file.c (rb_file_identical_p): not necessary to compare the paths afterusa2015-10-181-7/+2
| | | | | | | 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
* file.c: fix compile errornobu2015-10-181-1/+0
| | | | | | | * 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
* * file.c (rb_file_identical_p): simplify ifdefskosaki2015-10-181-13/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ChangeLog: Good-bye OS/2.kosaki2015-10-181-2/+0
| | | | | | | | | | | | | | | | | | | | * 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
* * file.c (ruby_is_fd_loadable): this should be fail if st_mode iskosaki2015-10-181-3/+7
| | | | | | not regular file nor FIFO. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* file.c: set errnonobu2015-10-171-1/+2
| | | | | | * 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
* * ruby.c (open_load_file): reset O_NONBLOCK after open.kosaki2015-10-171-8/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* string.c: rb_str_cat_conv_enc_optsnobu2015-10-171-7/+9
| | | | | | | | | | * 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
* file.c: prefer encoding index as possiblenobu2015-10-171-22/+27
| | | | | | | | | * 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
* file.c: non-blocking opennobu2015-10-161-11/+9
| | | | | | | | | | * 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
* file.c: get rid of intermediate objectsnobu2015-10-041-10/+11
| | | | | | | | * 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
* file.c: same timespecnobu2015-09-241-1/+4
| | | | | | | * 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
* file.c: File.mkfifonobu2015-09-181-0/+39
| | | | | | | * 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
* encindex.h: ENCINDEXnobu2015-09-151-0/+1
| | | | | | * 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
* * file.c: access()/eaccess() wrapping methods check more than just uid.hsbt2015-09-121-6/+6
| | | | | | [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
* internal.h: move rb_readlink declarationnobu2015-09-051-2/+0
| | | | | | | | | * 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
* file.c: use filesystem encodingnobu2015-09-021-6/+16
| | | | | | | | * 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
* file.c: syserr_fail2_innobu2015-08-281-9/+11
| | | | | | * 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
* win32.c: fchmodnobu2015-08-271-4/+10
| | | | | | | * 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
* file.c: fix messagesnobu2015-08-271-2/+11
| | | | | | | * 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
* win32.c: fake lchownnobu2015-08-261-0/+3
| | | | | | * 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
* win32.c: symlinknobu2015-08-241-0/+2
| | | | | | * win32/win32.c (w32_symlink): implement symlink(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add tests for `File.extname`nobu2015-07-241-0/+1
| | | | | | | | | | | * 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
* file.c: skip invalid bytenobu2015-07-071-0/+2
| | | | | | | | * 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
* * include/ruby/ruby.h: $SAFE=2 is now obsolete.hsbt2015-06-181-33/+0
| | | | | | | | | | * 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
* file.c: open without gvlnobu2015-06-141-1/+10
| | | | | | | * 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
* * file.c (rb_stat_ino): get inode from the interval of struct st.naruse2015-06-131-1/+12
| | | | | | | | | | | | | * 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
* * file.c (File::SHARE_DELETE): new flag to be able to delete opened fileusa2015-06-121-0/+5
| | | | | | | | | | | | | | 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
* wrapper object before allocnobu2015-05-161-1/+3
| | | | | | | | | | * 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
* * file.c (rb_f_test): Consider nsec for "=", "<" and ">" for "test"akr2015-04-111-3/+9
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e