summaryrefslogtreecommitdiff
path: root/file.c
AgeCommit message (Collapse)Author
2013-11-08file.c: remove unnecessary declarationnobu
* file.c (GetLastError): already defined in windows.h on nowadays cygwin, and caused the confliction with the system provided definition on cygwin64. by @kou1okada [Fixes GH-433]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-29* add RUBY_TYPED_FREE_IMMEDIATELY to data types which only useko1
safe functions during garbage collection such as xfree(). On default, T_DATA objects are freed at same points as fianlizers. This approach protects issues such as reported by [ruby-dev:35578]. However, freeing T_DATA objects immediately helps heap usage. Most of T_DATA (in other words, most of dfree functions) are safe. However, we turned off RUBY_TYPED_FREE_IMMEDIATELY by default for safety. * cont.c: ditto. * dir.c: ditto. * encoding.c: ditto. * enumerator.c: ditto. * error.c: ditto. * file.c: ditto. * gc.c: ditto. * io.c: ditto. * iseq.c: ditto. * marshal.c: ditto. * parse.y: ditto. * proc.c: ditto. * process.c: ditto. * random.c: ditto. * thread.c: ditto. * time.c: ditto. * transcode.c: ditto. * variable.c: ditto. * vm.c: ditto. * vm_backtrace.c: ditto. * vm_trace.c: ditto. * ext/bigdecimal/bigdecimal.c: ditto. * ext/objspace/objspace.c: ditto. * ext/stringio/stringio.c: ditto. * ext/strscan/strscan.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-23* file.c: [DOC] fix rdoc format of File#expand_path from r43386zzak
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-22* file.c (File#expand_path): [DOC] improve documentation of File#expand_path.eregon
Based on patch by Prathamesh Sonpatki. [ruby-core:57734] [Bug #9002] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43386 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-21dir.c: warn Dir.exists?nobu
* dir.c (rb_dir_exists_p): warn deprecated name. [Bug #9041] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-21* file.c (rb_file_exists_p): maybe FileTest.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-21file.c: warn File.exists?nobu
* file.c (rb_file_exists_p): warn deprecated name. [Bug #9041] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-19encoding.c: defer code page tablenobu
* encoding.c (rb_locale_encindex): defer initialization of win32 code page table until encoding db loaded. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-01file.c: export rb_stat_newnobu
* file.c (stat_new_0): constify. * file.c (rb_stat_new): constify and export. based on a patch by Hanmac (Hans Mackowiak) at [ruby-core:53225]. [Feature #8050] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-13* dir.c (dir_s_glob): [DOC] Improve wording and layout.drbrain
* dir.c (file_s_fnmatch): ditto. * dir.c (Init_Dir): [DOC] Document File::Constants::FNM_XXX constants. (These won't show up in RDoc until a new RDoc is imported.) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-18* error.c, file.c, gc.c, hash.c, thread.c, variable.c, vm_eval.c, bin/erb:ktsj
$SAFE=4 is obsolete. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-16* file.c (rb_file_size, rb_file_flock): improve parformance of Winodws.usa
* file.c (rb_file_truncate): removed unnecessary #ifdef. * test/test_file.rb (TestFile#test_truncate_size): added an assertion for File#size. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-15* io.c, internal.h (rb_io_flush_raw): new function to select callingusa
fsync() (on Windows). * io.c (rb_io_flush_raw): use above function. * file.c (rb_file_truncate): use above function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-11file.c: OSX path encodingnobu
* file.c (rb_str_encode_ospath): OS path encoding on Mac OS X is also fixed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-11file.c: internal functionnobu
* file.c (rb_str_normalize_ospath0): make the internal function static. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-11* file.c (rb_str_normalize_ospath): fix mixed code and declaration warningcharliesome
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-10* file.c (rb_str_normalize_ospath):naruse
HFS Plus (Mac OS Extended) uses a variant of Normal Form D in which U+2000 through U+2FFF, U+F900 through U+FAFF, and U+2F800 through U+2FAFF are not decomposed (this avoids problems with round trip conversions from old Mac text encodings). http://developer.apple.com/library/mac/qa/qa1173/_index.html Therefore fix r42457 to exclude the range. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-09file.c: normalize Form Cnobu
* file.c (rb_str_normalize_ospath): normalize to Normalization Form C using CFString. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-08file.c: rb_str_normalize_ospathnobu
* file.c (rb_str_normalize_ospath): extract and move from dir.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-26file.c: use rb_str_conv_encnobu
* file.c (rb_str_encode_ospath): simplify using rb_str_conv_enc(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-25* file.c (rb_file_expand_path_internal): fix r42160; skip '~'.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-25file.c: clear coderange for user namenobu
* file.c (rb_file_expand_path_internal): should clear coderange after copying user name as binary data. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-25file.c: split rb_home_dirnobu
* dir.c (dir_s_home): use rb_home_dir_of and rb_default_home_dir. * file.c (rb_home_dir_of): split from rb_home_dir() for the home directry of the given user, and the user name is a VALUE, not a bare pointer. should raise if the user does not exist. * file.c (rb_default_home_dir): split from rb_home_dir() for the home directry of the current user. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-24file.c: exception message encodingnobu
* file.c (rb_file_expand_path_internal): preserve the file name encoding in an exception message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12* safe.c (rb_set_safe_level, safe_setter): raise an ArgumentErrorshugo
when $SAFE is set to 4. $SAFE=4 is now obsolete. [ruby-core:55222] [Feature #8468] * object.c (rb_obj_untrusted, rb_obj_untrust, rb_obj_trust): Kernel#untrusted?, untrust, and trust are now deprecated. Their behavior is same as tainted?, taint, and untaint, respectively. * include/ruby/ruby.h (OBJ_UNTRUSTED, OBJ_UNTRUST): OBJ_UNTRUSTED() and OBJ_UNTRUST() are aliases of OBJ_TAINTED() and OBJ_TAINT(), respectively. * array.c, class.c, debug.c, dir.c, encoding.c, error.c, eval.c, ext/curses/curses.c, ext/dbm/dbm.c, ext/dl/cfunc.c, ext/dl/cptr.c, ext/dl/dl.c, ext/etc/etc.c, ext/fiddle/fiddle.c, ext/fiddle/pointer.c, ext/gdbm/gdbm.c, ext/readline/readline.c, ext/sdbm/init.c, ext/socket/ancdata.c, ext/socket/basicsocket.c, ext/socket/socket.c, ext/socket/udpsocket.c, ext/stringio/stringio.c, ext/syslog/syslog.c, ext/tk/tcltklib.c, ext/win32ole/win32ole.c, file.c, gc.c, hash.c, io.c, iseq.c, load.c, marshal.c, object.c, proc.c, process.c, random.c, re.c, safe.c, string.c, thread.c, transcode.c, variable.c, vm_insnhelper.c, vm_method.c, vm_trace.c: remove code for $SAFE=4. * test/dl/test_dl2.rb, test/erb/test_erb.rb, test/readline/test_readline.rb, test/readline/test_readline_history.rb, test/ruby/test_alias.rb, test/ruby/test_array.rb, test/ruby/test_dir.rb, test/ruby/test_encoding.rb, test/ruby/test_env.rb, test/ruby/test_eval.rb, test/ruby/test_exception.rb, test/ruby/test_file_exhaustive.rb, test/ruby/test_hash.rb, test/ruby/test_io.rb, test/ruby/test_method.rb, test/ruby/test_module.rb, test/ruby/test_object.rb, test/ruby/test_pack.rb, test/ruby/test_rand.rb, test/ruby/test_regexp.rb, test/ruby/test_settracefunc.rb, test/ruby/test_struct.rb, test/ruby/test_thread.rb, test/ruby/test_time.rb: remove tests for $SAFE=4. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-02fill rdocsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-19fix typos. Patch by k_takata.ktsj
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* include/ruby/ruby.h: constify RBasic::klass and addko1
RBASIC_CLASS(obj) macro which returns a class of `obj'. This change is a part of RGENGC branch [ruby-trunk - Feature #8339]. * object.c: add new function rb_obj_reveal(). This function reveal interal (hidden) object by rb_obj_hide(). Note that do not change class before and after hiding. Only permitted example is: klass = RBASIC_CLASS(obj); rb_obj_hide(obj); .... rb_obj_reveal(obj, klass); TODO: API design. rb_obj_reveal() should be replaced with others. TODO: modify constified variables using cast may be harmful for compiler's analysis and optimizaton. Any idea to prohibt inserting RBasic::klass directly? If rename RBasic::klass and force to use RBASIC_CLASS(obj), then all codes such as `RBASIC(obj)->klass' will be compilation error. Is it acceptable? (We have similar experience at Ruby 1.9, for example "RARRAY(ary)->ptr" to "RARRAY_PTR(ary)". * internal.h: add some macros. * RBASIC_CLEAR_CLASS(obj) clear RBasic::klass to make it internal object. * RBASIC_SET_CLASS(obj, cls) set RBasic::klass. * RBASIC_SET_CLASS_RAW(obj, cls) same as RBASIC_SET_CLASS without write barrier (planned). * RCLASS_SET_SUPER(a, b) set super class of a. * array.c, class.c, compile.c, encoding.c, enum.c, error.c, eval.c, file.c, gc.c, hash.c, io.c, iseq.c, marshal.c, object.c, parse.y, proc.c, process.c, random.c, ruby.c, sprintf.c, string.c, thread.c, transcode.c, vm.c, vm_eval.c, win32/file.c: Use above macros and functions to access RBasic::klass. * ext/coverage/coverage.c, ext/readline/readline.c, ext/socket/ancdata.c, ext/socket/init.c, * ext/zlib/zlib.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* *.c, parse.y, insns.def: use RARRAY_AREF/ASET macroko1
instead of using RARRAY_PTR(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-12* file.c (rb_file_s_truncate): use correct type. chsize takeskosaki
a long. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-12* configure.in: removes AC_CHECK_FUNC(ftruncate64).kosaki
* configure.in: adds RUBY_REPLACE_TYPE(off_t) for creating NUM2OFFT. * file.c (rb_file_truncate): use correct type. chsize() take a long. * include/ruby/ruby.h (NUM2OFFT): use a definition created by a configure script by default. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-09* file.c, ext/etc/etc.c, ext/socket/unixsocket.c,akr
ext/openssl/ossl.h, ext/openssl/openssl_missing.c: Use HAVE_AGGREGATE_MEMBER instead of HAVE_ST_MEMBER. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-24update doc.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-24update doc.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-31documentation by @phiggins [GH fixes #263]hsbt
* file.c: Alias File #path and #to_path. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-16* configure.in: check struct timeval exist or not.kosaki
* include/ruby/missing.h (struct timeval): check HAVE_STRUCT_TIMEVAL properly. and don't include sys/time.h if struct timeval exist. * file.c: include sys/time.h explicitly. * random.c: ditto. * thread_pthread.c: ditto. * time.c: ditto. * ext/date/date_strftime.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-15error.c: rb_sys_fail_path_innobu
* error.c (syserr_initialize): add optional function name. * error.c (rb_sys_fail_path_in): rename and move from file.c, and pass func_name to SystemCallError#initialize. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-15file.c: rb_sys_fail_path_with_funcnobu
* file.c (rb_sys_fail_path_with_func): share same function, and path may be nil. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-14file.c: insert separatornobu
* file.c (rb_sys_fail_path0): insert separator between function name and path name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-14configure.in, file.c: RUBY_FUNCTION_NAME_STRINGnobu
* configure.in (rb_cv_function_name_string): macro for function name string predefined identifier, __func__ in C99, or __FUNCTION__ in gcc. * file.c (rb_sys_fail_path): use RUBY_FUNCTION_NAME_STRING. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-14* file.c (rb_sys_fail_path): use rb_sys_fail_path0 only on GCC.naruse
__func__ is C99 feature. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-14* file.c (rb_sys_fail_path0): add to append the name of called functionnaruse
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-01Suppress warning: uninitialized valuenaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-23* array.c: Document #<=> return values and formattingzzak
* 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-21* file.c (rb_group_member): added an error check. SUS says,kosaki
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* file.c (RB_MAX_GROUPS): moved tokosaki
* 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* file.c (access_internal): removed.kosaki
* 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* file.c (eaccess): use access() when not using setuid nor setgid.kosaki
This is minor optimization. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-21* file.c (rb_group_member): get rid of NGROUPS dependency.kosaki
[Bug #7886] [ruby-core:52537] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-14* file.c (rb_file_flock): use rb_thread_wait_for() instead ofkosaki
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