summaryrefslogtreecommitdiff
path: root/file.c
AgeCommit message (Collapse)Author
2022-10-05[DOC] Remove unknown markup or macro [ci skip]Nobuyoshi Nakada
Also remove the ancient word "Windows NT".
2022-10-03Remove an unused macro [ci skip]Nobuyoshi Nakada
2022-10-03[Bug #19034] No runtime check for `utimensat` if unavailableNobuyoshi Nakada
2022-10-02[DOC] RDoc changes for IO (#6458)Burdette Lamar
Moves Expect library doc into io.c. Changes certain links to local sections, now pointing to sections in doc/io_streams.rdoc. Removes local sections now superseded by sections in doc/io_streams.rdoc. Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2022-09-26Initialize Objective-C classes before fork() for macOS 13Yuta Saito
Since macOS 13, CFString family API used in `rb_str_append_normalized_ospath` may internally use Objective-C classes (`NSTaggedPointerString` and `NSPlaceholderMutableString`) for small strings. On the other hand, Objective-C classes should not be used for the first time in a `fork()`'ed but not `exec()`'ed process. Violations for this rule can result deadlock during class initialization, so Objective-C runtime conservatively crashes on such cases by default. Therefore, we need to use CFString API to initialize Objective-C classes used internally *before* `fork()`. For more details, see https://bugs.ruby-lang.org/issues/18912 Notes: Merged: https://github.com/ruby/ruby/pull/6426
2022-09-21New page IO Streams (#6383)Burdette Lamar
This page provides an overview of IO streams. It's meant to be linked to from many other doc spots. In particular it will be linked to from many places in ARGF, File, IO, and StringIO. Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2022-09-21avoid ANYARGS卜部昌平
Use macro instead of a static functon. This isn't very amusing but doing this wihtout a macro (is possibe but) seems just too much. Notes: Merged: https://github.com/ruby/ruby/pull/6358
2022-09-10Using is_broken_string functionS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/6346
2022-09-08[Bug #5317] Use `rb_off_t` instead of `off_t`Nobuyoshi Nakada
Get rid of the conflict with system-provided small `off_t`. Notes: Merged: https://github.com/ruby/ruby/pull/6329
2022-09-08[Win32] Remove dead code using `chsize`Nobuyoshi Nakada
Already using `rb_w32_truncate` and `rb_w32_ftruncate`, and `HAVE_FTRUNCATE` has been added 14 years ago. Notes: Merged: https://github.com/ruby/ruby/pull/6329
2022-09-05Remove extra semicolons at the top level [ci skip]Nobuyoshi Nakada
2022-08-19Fixed by [Bug #18964]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6253
2022-08-18rb_str_resize: Only clear coderange on truncationJean Boussier
If we are expanding the string or only stripping extra capacity then coderange won't change, so clearing it is wasteful. Notes: Merged: https://github.com/ruby/ruby/pull/6178
2022-07-21Expand tabs [ci skip]Takashi Kokubun
[Misc #18891] Notes: Merged: https://github.com/ruby/ruby/pull/6094
2022-07-19Rename ENCINDEX_ASCII to ENCINDEX_ASCII_8BITJean Boussier
Otherwise it's way too easy to confuse it with US_ASCII. Notes: Merged: https://github.com/ruby/ruby/pull/6127
2022-06-29Remove no longer used label [ci skip]Nobuyoshi Nakada
2022-06-27Check availability of `utimensat` on macOSNobuyoshi Nakada
2022-06-17Using is_ascii_string to check encodingS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/5867
2022-05-06Fix missing paren [ci skip]Kazuhiro NISHIYAMA
2022-05-05File rdoc (#5888)Burdette Lamar
Treats: ::pipe? ::symlink? ::socket? ::blockdev? ::chardev? Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2022-04-26Enhanced RDoc for File (#5849)Burdette Lamar
Treats: #path ::stat ::lstat #lstat ::directory? Also adds section "Example Files" that explains assumptions about example files. I'm using t.txt already, and I'm pretty sure I'll need t.dat (binary data). I don't know whether I'll need t.rus (Russian text). Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2022-04-18[DOC] Use consistent terms [Bug #18680]Nobuyoshi Nakada
2022-04-15Return `false` where sticky-bit is not provided [Bug #18734]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/5804
2022-04-12Use an empty string when building File.expand_pathPeter Zhu
Allocating a string of length MAXPATHLEN and then shrinking the string is inefficient when the resulting path is short. Preallocating a large string is also a problem for Variable Width Allocation since we can't easily downsize the capacity. I ran the following benchmark: ```ruby Benchmark.ips do |x| { "empty" => "", "short" => "a/" * 10, "medium" => "a/" * 100, "long" => "a/" * 500 }.each do |name, path| x.report(name) do |times| i = 0 while i < times File.expand_path(path) i += 1 end end end end ``` On this commit: ``` empty 97.486k (± 0.7%) i/s - 492.915k in 5.056507s short 96.026k (± 2.4%) i/s - 486.489k in 5.068966s medium 86.304k (± 1.3%) i/s - 435.336k in 5.045112s long 59.395k (± 1.7%) i/s - 302.175k in 5.089026s ``` On master: ``` empty 94.138k (± 1.4%) i/s - 472.158k in 5.016590s short 92.043k (± 1.4%) i/s - 468.180k in 5.087496s medium 84.910k (± 2.3%) i/s - 425.750k in 5.017007s long 61.503k (± 2.7%) i/s - 309.723k in 5.039429s ``` Notes: Merged: https://github.com/ruby/ruby/pull/5789
2022-03-25Fix formatting of What's Here for File (#5717)Burdette Lamar
Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2022-02-07[DOC] Replace with IO@ModesPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/5530
2022-02-07[DOC] Use RDoc link style for links in the same class/modulePeter Zhu
I used this regex: (?<=\[)#(?:class|module)-([A-Za-z]+)-label-([A-Za-z0-9\-\+]+) And performed a global find & replace for this: rdoc-ref:$1@$2 Notes: Merged: https://github.com/ruby/ruby/pull/5530
2022-02-07[DOC] Use RDoc link style for links to other classes/modulesPeter Zhu
I used this regex: ([A-Za-z]+)\.html#(?:class|module)-[A-Za-z]+-label-([A-Za-z0-9\-\+]+) And performed a global find & replace for this: rdoc-ref:$1@$2 Notes: Merged: https://github.com/ruby/ruby/pull/5530
2022-02-07[DOC] Fix links in documentation for File and IOPeter Zhu
Fixes some typos and dead links. Notes: Merged: https://github.com/ruby/ruby/pull/5530
2022-01-13File rdoc (#5438)Burdette Lamar
Treats: File introduction File.open File.new Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2021-12-28Removed deprecated Dir.exists? and File.exists?Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/5352
2021-12-24Adjust styles [ci skip]Nobuyoshi Nakada
2021-12-21Improved exception usage/classes.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/5303
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`