summaryrefslogtreecommitdiff
path: root/file.c
AgeCommit message (Collapse)Author
2021-11-10size_t is not for file sizeNobuyoshi Nakada
2021-11-10IO::Buffer for scheduler interface.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/4621
2021-11-05[DOC] Fix indent as single paragraph [ci skip]Nobuyoshi Nakada
2021-10-14rb_encoding is already constU.Nakamura
- this change get rid of a warning of mswin build. see include/ruby/internal/encoding/encoding.h(116)
2021-10-14rb_group_member: SimplifyNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4963
2021-10-04Fix regression on Solaris after change to use realpath on loaded featuresJeremy Evans
After the change to use realpath on loaded features, Solaris CI started failing in test_no_curdir (which tests behavior for running ruby without a working directory). I was able to trace the problem to the following call chain: rb_call_inits->Init_Thread->Init_thread_sync->rb_provide-> get_loaded_features_index->rb_check_realpath->rb_dir_getwd_ospath-> ruby_getcwd This will throw an exception, but because Ruby hasn't been fully initialized at the point the exception is thrown, it just exits with a status of 1. The bug here is that rb_check_realpath should not raise an exception, it should return nil. This bug is hit on Solaris because Solaris uses the realpath emulation instead of native realpath, and the realpath emualation raised instead of returning nil if the mode was RB_REALPATH_CHECK. Use rb_rescue in the realpath emulation if the mode is RB_REALPATH_CHECK, and swallow any exceptions raised and return nil. Notes: Merged: https://github.com/ruby/ruby/pull/4935
2021-10-03Get rid of unused function warning for `_WIN32`xtkoba
Notes: Merged: https://github.com/ruby/ruby/pull/4482
2021-10-01Associate the encoding to the found pathNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4915
2021-09-15Refactor and Using RBOOL macroS.H
Notes: Merged: https://github.com/ruby/ruby/pull/4837 Merged-By: nobu <nobu@ruby-lang.org>
2021-09-05Replace RBOOL macroS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/4791
2021-08-24Add stat_time functionS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/4761
2021-08-17[DOC] Fix the rdoc for File::Stat#size? [ci skip]Akinori MUSHA
2021-08-02Using RBOOL macroS.H
Notes: Merged: https://github.com/ruby/ruby/pull/4695 Merged-By: nobu <nobu@ruby-lang.org>
2021-07-29Add RBOOL macro and use itS.H
Notes: Merged: https://github.com/ruby/ruby/pull/4677 Merged-By: nobu <nobu@ruby-lang.org>
2021-06-21What's Here for Numeric and ComparableBurdette Lamar
2021-05-07What's Here for class File (#4460)Burdette Lamar
What's Here for class File Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2021-04-12Support non-standard `struct stat` [Bug #17793]Nobuyoshi Nakada
On 32-bit Android: * `st_dev`/`st_rdev` are not `dev_t` * `st_mode` is not `mode_t`
2021-04-02Fill the ring-buffer with the fallback valueNobuyoshi Nakada
Fill with the pointer to the root position, instead of zero and comparing later. Also suppress a false warning by Visual C++. ``` file.c(4759): warning C4090: 'function': different 'const' qualifiers ``` Notes: Merged: https://github.com/ruby/ruby/pull/4348
2021-03-15File.dirname optional levelNobuyoshi Nakada
* file.c (rb_file_dirname_n): chomp N level of base names. [Feature #12194] Notes: Merged: https://github.com/ruby/ruby/pull/4111
2021-03-14Explicitly cast __s64 to time_t [Bug #17645]xtkoba (Tee KOBAYASHI)
A workaround of shorten-64-to-32 error where 32-bit linux.
2021-01-15Keep encoding in the result of File.expand_path [Bug #17517]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4061
2020-12-02Revert "Removed deprecated Dir.exists? and File.exists?"Nobuyoshi Nakada
This reverts commit 1a5205536f0c0d6021450b11722919211847df86.
2020-12-02Removed deprecated Dir.exists? and File.exists?Nobuyoshi Nakada
2020-09-23Removed rb_find_file_ext_safe and rb_find_file_safeHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/3537
2020-07-07Get rid of the redundant stat() in rb_check_realpath_internalJean Boussier
Notes: Merged: https://github.com/ruby/ruby/pull/3267
2020-06-29add UNREACHABLE_RETURN卜部昌平
Not every compilers understand that rb_raise does not return. When a function does not end with a return statement, such compilers can issue warnings. We would better tell them about reachabilities. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-29rb_f_stat: do not goto into a branch卜部昌平
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-23Removed execpath argument of path_check_0 as always TRUE nowNobuyoshi Nakada
2020-06-23Removed fpath_check, no longer used since taint flag was removedNobuyoshi Nakada
2020-05-23Allow Dir.home to work for non-login procs when $HOME not setAlan D. Salewski
Allow the 'Dir.home' method to reliably locate the user's home directory when all three of the following are true at the same time: 1. Ruby is running on a Unix-like OS 2. The $HOME environment variable is not set 3. The process is not a descendant of login(1) (or a work-alike) The prior behavior was that the lookup could only work for login-descended processes. This is accomplished by looking up the user's record in the password database by uid (getpwuid_r(3)) as a fallback to the lookup by name (getpwname_r(3)) which is still attempted first (based on the name, if any, returned by getlogin_r(3)). If getlogin_r(3), getpwnam_r(3), and/or getpwuid_r(3) is not available at compile time, will fallback on using their respective non-*_r() variants: getlogin(3), getpwnam(3), and/or getpwuid(3). The rationale for attempting to do the lookup by name prior to doing it by uid is to accommodate the possibility of multiple login names (each with its own record in the password database, so each with a potentially different home directory) being mapped to the same uid (as is explicitly allowed for by POSIX; see getlogin(3posix)). Preserves the existing behavior for login-descended processes, and adds the new capability of having Dir.home being able to find the user's home directory for non-login-descended processes. Fixes [Bug #16787] Related discussion: https://bugs.ruby-lang.org/issues/16787 https://github.com/ruby/ruby/pull/3034
2020-05-11sed -i 's|ruby/impl|ruby/internal|'卜部昌平
To fix build failures. Notes: Merged: https://github.com/ruby/ruby/pull/3079
2020-05-11sed -i s|ruby/3|ruby/impl|g卜部昌平
This shall fix compile errors. Notes: Merged: https://github.com/ruby/ruby/pull/3079
2020-04-08Merge pull request #2991 from shyouhei/ruby.h卜部昌平
Split ruby.h Notes: Merged-By: shyouhei <shyouhei@ruby-lang.org>
2020-04-07Show the deprecated name in the warningNobuyoshi Nakada
Fixed up a58bbd6a512d95ca010d8bebae4fe590400c1413.
2020-04-06[DOC] Removed RDoc of deprecated methods [ci skip]Nobuyoshi Nakada
2020-04-06Use `rb_warn_deprecated` for `File.exists?` and `Dir.exists?`Nobuyoshi Nakada
2019-12-26decouple internal.h headers卜部昌平
Saves comitters' daily life by avoid #include-ing everything from internal.h to make each file do so instead. This would significantly speed up incremental builds. We take the following inclusion order in this changeset: 1. "ruby/config.h", where _GNU_SOURCE is defined (must be the very first thing among everything). 2. RUBY_EXTCONF_H if any. 3. Standard C headers, sorted alphabetically. 4. Other system headers, maybe guarded by #ifdef 5. Everything else, sorted alphabetically. Exceptions are those win32-related headers, which tend not be self- containing (headers have inclusion order dependencies). Notes: Merged: https://github.com/ruby/ruby/pull/2711
2019-12-23Revert "Should return "." for File.extname("file.") also on Windows"NAKAMURA Usaku
We want to introduce consistency and better compatibility with unixen, but the Windows APIs doues not have consistency fundamentally and we can not found any logical way... This reverts commit 61aff0cd189e67fa6f2565639ad0128fa33b88fc.
2019-12-22Should return "." for File.extname("file.") also on WindowsNAKAMURA Usaku
But not changes another cases, such as "file.rb." [Bug #15267]
2019-12-16Get rid of infinite recursion at loading transcoderNobuyoshi Nakada
Disable encoding US-ASCII path to filesystem on Windows too. [Bug #16392] Notes: Merged: https://github.com/ruby/ruby/pull/2755
2019-12-03Fixed stack overflow [Bug #16382]Nobuyoshi Nakada
Get rid of infinite recursion in expanding a load path to the real path while loading a transcoder. Notes: Merged: https://github.com/ruby/ruby/pull/2714
2019-11-18Deprecate taint/trust and related methods, and make the methods no-opsJeremy Evans
This removes the related tests, and puts the related specs behind version guards. This affects all code in lib, including some libraries that may want to support older versions of Ruby. Notes: Merged: https://github.com/ruby/ruby/pull/2476
2019-11-18Warn on access/modify of $SAFE, and remove effects of modifying $SAFEJeremy Evans
This removes the security features added by $SAFE = 1, and warns for access or modification of $SAFE from Ruby-level, as well as warning when calling all public C functions related to $SAFE. This modifies some internal functions that took a safe level argument to no longer take the argument. rb_require_safe now warns, rb_require_string has been added as a version that takes a VALUE and does not warn. One public C function that still takes a safe level argument and that this doesn't warn for is rb_eval_cmd. We may want to consider adding an alternative method that does not take a safe level argument, and warn for rb_eval_cmd. Notes: Merged: https://github.com/ruby/ruby/pull/2476
2019-10-17[DOC] no change on Windows [Bug #15267] [ci skip]Nobuyoshi Nakada
2019-10-17Fixed File.extname at a name ending with a dotNobuyoshi Nakada
File.extname now returns a dot string at a name ending with a dot. [Bug #15267] Notes: Merged: https://github.com/ruby/ruby/pull/2565
2019-10-14Update documentation for File#{readable,writable,executable}{,_real}? [ci skip]Jeremy Evans
Some OS-level security features cause these methods to not return expected results. For example fs.protected_regular sysctl on Linux, or pledge(2)/unveil(2) on OpenBSD. Fixes [Bug #16002]
2019-09-27Adjusted spaces [ci skip]Nobuyoshi Nakada
2019-09-05Add `File.absolute_path?` (#2198)David Rodríguez
In order to check whether a path is absolute or not in a portable way. [Feature #15868]
2019-08-29drop-in type check for rb_define_singleton_method卜部昌平
We can check the function pointer passed to rb_define_singleton_method like how we do so in rb_define_method. Doing so revealed many arity mismatches.
2019-08-29drop-in type check for rb_define_global_function卜部昌平
We can check the function pointer passed to rb_define_global_function like we do so in rb_define_method. It turns out that almost anybody is misunderstanding the API.