summaryrefslogtreecommitdiff
path: root/dir.c
AgeCommit message (Collapse)Author
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
2021-01-12Remove "." and ".." from Dir.glob with FNM_DOTMATCH [Bug #17280]Nobuyoshi Nakada
Co-authored-by: Jeremy Evans <code@jeremyevans.net> Notes: Merged: https://github.com/ruby/ruby/pull/4052
2020-12-24dir.c: chdir conflict should raise only when called in different threadYusuke Endoh
... and keep it as a warning (like 2.7) when it is called in the same thread. [Bug #15661] Notes: Merged: https://github.com/ruby/ruby/pull/3990
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-28Switch conflicting chdir warning to RuntimeErrorJeremy Evans
The documentation already stated this was an error in one case (when it was previously a warning). Describe the other case, where chdir without block is called inside block passed to chdir. Fixes [Bug #15661] Notes: Merged: https://github.com/ruby/ruby/pull/3591
2020-08-15RARRAY_AREF: convert into an inline function卜部昌平
RARRAY_AREF has been a macro for reasons. We might not be able to change that for public APIs, but why not relax the situation internally to make it an inline function. Notes: Merged: https://github.com/ruby/ruby/pull/3419
2020-06-29glob_opendir: move cleanup codes at the end卜部昌平
Nobu likes this arrangement. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-29glob_opendir: 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-29glob_make_pattern: 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-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-05-11Added more NORETURN declarationsNobuyoshi Nakada
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-06Moved `Dir.[]` to dir.rbNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3006
2020-04-06Moved `Dir.glob` to dir.rbNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3006
2020-04-06Moved `Dir.open` and `Dir#initialize` to dir.rbNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3006
2020-04-06Use `rb_warn_deprecated` for `File.exists?` and `Dir.exists?`Nobuyoshi Nakada
2020-03-25Fixed crash when argument array is modifiedNobuyoshi Nakada
2020-02-07more on NULL versus functions.卜部昌平
Function pointers are not void*. See also ce4ea956d24eab5089a143bba38126f2b11b55b6 8427fca49bd85205f5a8766292dd893f003c0e48
2020-01-20Fixed double closedirNobuyoshi Nakada
In the case that shinking the entries buffer to the exact size failed, `dirp` is already closed. Found by mame with Coverity Scan.
2020-01-19Sort globbed results by default [Feature #8709]Nobuyoshi Nakada
Sort the results which matched single wildcard or character set in binary ascending order, unless `sort: false` is given. The order of an Array of pattern strings and braces are not affected. Notes: Merged: https://github.com/ruby/ruby/pull/2846
2020-01-18Made glob option keyword IDs staticNobuyoshi Nakada
2019-12-29Fix documentation of Dir#each_childSeiei Miyagi
Notes: Merged: https://github.com/ruby/ruby/pull/2785
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-04[DOC] Added File::FNM_SYSCASE example [Bug #16391] [ci skip]Nobuyoshi Nakada
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