summaryrefslogtreecommitdiff
path: root/dir.c
AgeCommit message (Collapse)Author
2024-03-14[Feature #20244] Issue a single `Warning.warn` callNobuyoshi Nakada
Make the entire series of message lines a multiline string so that the `Warning.warn` hook can receive them in a single call.
2024-03-14[Feature #20244] Register global variable for another threadNobuyoshi Nakada
Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
2024-03-14[Feature #20244] Show the conflicting another chdir blockNobuyoshi Nakada
2024-03-14[Feature #20244] Extract `chdir_lock` and its stuffsNobuyoshi Nakada
2024-01-24Define `IO_WITHOUT_GVL` macroNobuyoshi Nakada
2024-01-12s/SafeStringValue/StringValue/Xavier Noria
The macro SafeStringValue() became just StringValue() in c5c05460ac2, and it is deprecated nowadays. This patch replaces remaining macro usage. Some occurrences are left in ext/stringio and ext/win32ole, they should be fixed upstream. The macro itself is not deleted, because it may be used in extensions.
2023-12-18[DOC] Add links from `File::Constants` in dir.c to `File` constantsNobuyoshi Nakada
Due to the bug ruby/rdoc#1067, `rb_file_const` needs `Document-const` directives.
2023-12-14[DOC] Adjust some new features wording/examples. (#9183)Victor Shepelev
* Reword Range#overlap? docs last paragraph. * Docs: add explanation about Queue#freeze * Docs: Add :rescue event docs for TracePoint * Docs: Enhance Module#set_temporary_name documentation * Docs: Slightly expand Process::Status deprecations * Fix MatchData#named_captures rendering glitch * Improve Dir.fchdir examples * Adjust Refinement#target docs
2023-12-11Make Dir#chdir never yield args, and return block return valueJeremy Evans
If no block is given, return 0 instead of nil for consistency with Dir.chdir and Dir.fchdir.
2023-12-09[DOC] Small fixes for documentation renderingVictor Shepelev
Mostly just fixing RDoc's incorrect treatment of `+`
2023-11-30Add `RUBY_REFERENCES`Nobuyoshi Nakada
Instead of `RUBY_REFERENCES_START` and `RUBY_REFERENCES_END`, so that auto-indent works well.
2023-11-30Prefix `REF_EDGE` and `REFS_LIST_PTR` with `RUBY_`Nobuyoshi Nakada
Also move `struct` so that `typedef`-ed names can be used.
2023-11-22Implement dir on VWAPeter Zhu
2023-11-14[DOC] Link Dir.exist? to File.directory?Nobuyoshi Nakada
2023-11-14[DOC] Describe Dir.homeNobuyoshi Nakada
2023-10-12M:N thread scheduler for RactorsKoichi Sasada
This patch introduce M:N thread scheduler for Ractor system. In general, M:N thread scheduler employs N native threads (OS threads) to manage M user-level threads (Ruby threads in this case). On the Ruby interpreter, 1 native thread is provided for 1 Ractor and all Ruby threads are managed by the native thread. From Ruby 1.9, the interpreter uses 1:1 thread scheduler which means 1 Ruby thread has 1 native thread. M:N scheduler change this strategy. Because of compatibility issue (and stableness issue of the implementation) main Ractor doesn't use M:N scheduler on default. On the other words, threads on the main Ractor will be managed with 1:1 thread scheduler. There are additional settings by environment variables: `RUBY_MN_THREADS=1` enables M:N thread scheduler on the main ractor. Note that non-main ractors use the M:N scheduler without this configuration. With this configuration, single ractor applications run threads on M:1 thread scheduler (green threads, user-level threads). `RUBY_MAX_CPU=n` specifies maximum number of native threads for M:N scheduler (default: 8). This patch will be reverted soon if non-easy issues are found. [Bug #19842]
2023-09-27[DOC] Missing comment markersNobuyoshi Nakada
2023-07-23[DOC] RDoc for File::Constants (#8103)Burdette Lamar
Notes: Merged-By: peterzhu2118 <peter@peterzhu.ca>
2023-07-18[ruby/irb] Declare rdoc as dependencyStan Lo
(https://github.com/ruby/irb/pull/648) IRB already has several features that rely on rdoc, such as: - Autocompletion's document dialog - Autocompletion's `PerfectMatchedProc` - The `show_doc` command - Easter egg And we could use its pager more in the future too. So it makes sense to declare rdoc as a dependency instead of relying on the one bundled with Ruby. https://github.com/ruby/irb/commit/4dffbb1dd3
2023-07-07[DOC] RDoc for dir.c (#8037)Burdette Lamar
Notes: Merged-By: peterzhu2118 <peter@peterzhu.ca>
2023-07-05[DOC] RDoc for some of dir.c (#8026)Burdette Lamar
Notes: Merged-By: peterzhu2118 <peter@peterzhu.ca>
2023-05-12Return `errno` as the result instead of the global variableNobuyoshi Nakada
2023-04-04Suppress `-Wdiscarded-qualifiers` warning where `fchdir` is unusableNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7649
2023-03-24Fix Dir.for_fd call-seqJeremy Evans
2023-03-24Add Dir.for_fdJeremy Evans
This returns a Dir instance for the given directory file descriptor. If fdopendir is not supported, this raises NotImplementedError. Implements [Feature #19347] Notes: Merged: https://github.com/ruby/ruby/pull/7135
2023-03-24Add Dir#chdirJeremy Evans
This uses Dir.fchdir if supported, or Dir.chdir otherwise. Implements [Feature #19347] Notes: Merged: https://github.com/ruby/ruby/pull/7135
2023-03-24Add Dir.fchdirJeremy Evans
This is useful for passing directory file descriptors over UNIX sockets or to child processes to avoid TOCTOU vulnerabilities. The implementation follows the Dir.chdir code. This will raise NotImplementedError on platforms not supporting both fchdir and dirfd. Implements [Feature #19347] Notes: Merged: https://github.com/ruby/ruby/pull/7135
2023-03-17Implement declarative references for dir_data_typeMatt Valentine-House
Notes: Merged: https://github.com/ruby/ruby/pull/7153
2022-12-02Reuse NIL_OR_UNDEF_P macroS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/6787
2022-11-16Using UNDEF_P macroS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/6721
2022-10-18[Bug #19042] Fix Dir.glob brace with '/'Hiroshi Shirosaki
Dir.glob brace pattern with '/' after '**' does not match paths in recursive expansion process. We expand braces with '/' before expanding a recursive. Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
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-20Allow to just warn as bool expected, without an exceptionNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6039
2022-04-03dir.c: refresh pathtype when emulating `IFTODT` in `glob_helper`Yuta Saito
When using `IFTODT` defined in libc, `dirent.d_type` oriented pathtype is compatible with `IFTODT(stat.st_mode)`. However they are not compatible when emulating `IFTODT`, so `glob_helper` has to stat instead of reusing dirent result by passing unknown pathtype to `glob_helper`. This is a follow-up fix of 0c90ca4dd0abbd28d7bb34b9241d93995ab9cfb7 Notes: Merged: https://github.com/ruby/ruby/pull/5680
2022-03-02dir.c: use self-made IFTODT in rb_pathtype_t if availableYuta Saito
dir.c defines IFTODT if the system doesn't have it. The macro is used when comparing with rb_pathtype_t's cases. rb_pathtype_t's cases are defined by DT_XXX macro if they are available, or defined using IFTODT. Most POSIX-compatible platforms have both IFTODT and DT_XXX and most of other platforms like MinGW have neither of them. On those platforms, DT_XXX-oriented rb_pathtype_t is always compared with values converted by system's IFTODT, and emulated-IFTODT-oriented rb_pathtype_t is always compared with values converted by emulated-IFTODT. However, when IFTODT is *not defined* and DT_XXX is *defined*, like on wasi-libc, DT_XXX-oriented rb_pathtype_t was compared with values converted by emulated-IFTODT, and they are not guaranteed to be compatible. This patch fixes such a situation by using emulated-IFTODT to define rb_pathtype_t when either IFTODT or DT_XXX is not available. Notes: Merged: https://github.com/ruby/ruby/pull/5614
2022-01-19dir.c: ignore ENOTCAPABLE while glob similar to EACCESYuta Saito
Notes: Merged: https://github.com/ruby/ruby/pull/5407
2022-01-01Negative RBOOL usageNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/5385
2021-12-28Removed deprecated Dir.exists? and File.exists?Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/5352
2021-11-18Expect bool as `sort:` option at glob [Feature #18287]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/5084 Merged-By: nobu <nobu@ruby-lang.org>
2021-10-03Using NIL_P macro instead of `== Qnil`S.H
Notes: Merged: https://github.com/ruby/ruby/pull/4925 Merged-By: nobu <nobu@ruby-lang.org>
2021-09-05Replace RBOOL macroS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/4791
2021-06-24Actually ignore FNM_CASEFOLD flag in Dir.globJeremy Evans
This was already documented as being ignored, but it wasn't being ignored, causing an issue in a particular case where a UTF-8 pattern was provided and a filename was tested that wasn't valid UTF-8. Fixes [Bug #14456] Notes: Merged: https://github.com/ruby/ruby/pull/4583
2021-06-07dir.rb: moved class rdoc from dir.cNobuyoshi Nakada
2021-05-21[DOC] Moved `File.fnmatch?` to dir.rbNobuyoshi Nakada
So that no longer disturbed by C comment delimiters. Notes: Merged: https://github.com/ruby/ruby/pull/4514
2021-05-07What's Here for class Dir (#4472)Burdette Lamar
What's Here for class Dir Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2021-05-04Fix -Wundef warnings for patterns `#if HAVE`Benoit Daloze
* See [Feature #17752] * Using this to detect them: git grep -P 'if\s+HAVE' | grep -Pv 'HAVE_LONG_LONG|/ChangeLog|HAVE_TYPEOF' Notes: Merged: https://github.com/ruby/ruby/pull/4428
2021-05-04Fix trivial -Wundef warningsBenoit Daloze
* See [Feature #17752] Co-authored-by: xtkoba (Tee KOBAYASHI) <xtkoba+ruby@gmail.com> Notes: Merged: https://github.com/ruby/ruby/pull/4428
2021-04-11[DOC] Adjusted spacing [ci skip]Nobuyoshi Nakada
2021-01-13Check stack overflow in recursive glob_helper [Bug #17162]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4053