summaryrefslogtreecommitdiff
path: root/dir.c
Commit message (Collapse)AuthorAgeFilesLines
* Return `errno` as the result instead of the global variableNobuyoshi Nakada2023-05-121-4/+3
|
* Suppress `-Wdiscarded-qualifiers` warning where `fchdir` is unusableNobuyoshi Nakada2023-04-041-3/+2
|
* Fix Dir.for_fd call-seqJeremy Evans2023-03-241-1/+1
|
* Add Dir.for_fdJeremy Evans2023-03-241-0/+39
| | | | | | | This returns a Dir instance for the given directory file descriptor. If fdopendir is not supported, this raises NotImplementedError. Implements [Feature #19347]
* Add Dir#chdirJeremy Evans2023-03-241-3/+28
| | | | | | This uses Dir.fchdir if supported, or Dir.chdir otherwise. Implements [Feature #19347]
* Add Dir.fchdirJeremy Evans2023-03-241-0/+130
| | | | | | | | | | | | 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]
* Implement declarative references for dir_data_typeMatt Valentine-House2023-03-171-9/+6
|
* Reuse NIL_OR_UNDEF_P macroS-H-GAMELINKS2022-12-021-1/+1
|
* Using UNDEF_P macroS-H-GAMELINKS2022-11-161-2/+2
|
* [Bug #19042] Fix Dir.glob brace with '/'Hiroshi Shirosaki2022-10-181-1/+1
| | | | | | | | 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>
* Expand tabs [ci skip]Takashi Kokubun2022-07-211-873/+873
| | | | [Misc #18891]
* Rename ENCINDEX_ASCII to ENCINDEX_ASCII_8BITJean Boussier2022-07-191-3/+3
| | | | Otherwise it's way too easy to confuse it with US_ASCII.
* Allow to just warn as bool expected, without an exceptionNobuyoshi Nakada2022-06-201-1/+1
|
* dir.c: refresh pathtype when emulating `IFTODT` in `glob_helper`Yuta Saito2022-04-031-2/+2
| | | | | | | | | 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
* dir.c: use self-made IFTODT in rb_pathtype_t if availableYuta Saito2022-03-021-2/+8
| | | | | | | | | | | | | | | | | | | 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.
* dir.c: ignore ENOTCAPABLE while glob similar to EACCESYuta Saito2022-01-191-1/+5
|
* Negative RBOOL usageNobuyoshi Nakada2022-01-011-1/+1
|
* Removed deprecated Dir.exists? and File.exists?Nobuyoshi Nakada2021-12-281-9/+0
|
* Expect bool as `sort:` option at glob [Feature #18287]Nobuyoshi Nakada2021-11-181-1/+2
|
* Using NIL_P macro instead of `== Qnil`S.H2021-10-031-1/+1
|
* Replace RBOOL macroS-H-GAMELINKS2021-09-051-2/+2
|
* Actually ignore FNM_CASEFOLD flag in Dir.globJeremy Evans2021-06-241-1/+1
| | | | | | | | | 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]
* dir.rb: moved class rdoc from dir.cNobuyoshi Nakada2021-06-071-79/+0
|
* [DOC] Moved `File.fnmatch?` to dir.rbNobuyoshi Nakada2021-05-211-94/+1
| | | | So that no longer disturbed by C comment delimiters.
* What's Here for class Dir (#4472)Burdette Lamar2021-05-071-0/+69
| | | | What's Here for class Dir
* Fix -Wundef warnings for patterns `#if HAVE`Benoit Daloze2021-05-041-3/+3
| | | | | | * See [Feature #17752] * Using this to detect them: git grep -P 'if\s+HAVE' | grep -Pv 'HAVE_LONG_LONG|/ChangeLog|HAVE_TYPEOF'
* Fix trivial -Wundef warningsBenoit Daloze2021-05-041-1/+1
| | | | | | * See [Feature #17752] Co-authored-by: xtkoba (Tee KOBAYASHI) <xtkoba+ruby@gmail.com>
* [DOC] Adjusted spacing [ci skip]Nobuyoshi Nakada2021-04-111-1/+1
|
* Check stack overflow in recursive glob_helper [Bug #17162]Nobuyoshi Nakada2021-01-131-0/+2
|
* Remove "." and ".." from Dir.glob with FNM_DOTMATCH [Bug #17280]Nobuyoshi Nakada2021-01-121-2/+8
| | | | Co-authored-by: Jeremy Evans <code@jeremyevans.net>
* dir.c: chdir conflict should raise only when called in different threadYusuke Endoh2020-12-241-1/+3
| | | | | ... and keep it as a warning (like 2.7) when it is called in the same thread. [Bug #15661]
* Revert "Removed deprecated Dir.exists? and File.exists?"Nobuyoshi Nakada2020-12-021-0/+9
| | | | This reverts commit 1a5205536f0c0d6021450b11722919211847df86.
* Removed deprecated Dir.exists? and File.exists?Nobuyoshi Nakada2020-12-021-9/+0
|
* Switch conflicting chdir warning to RuntimeErrorJeremy Evans2020-09-281-2/+3
| | | | | | | | 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]
* RARRAY_AREF: convert into an inline function卜部昌平2020-08-151-0/+1
| | | | | | 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.
* glob_opendir: move cleanup codes at the end卜部昌平2020-06-291-5/+5
| | | | Nobu likes this arrangement.
* glob_opendir: do not goto into a branch卜部昌平2020-06-291-5/+8
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* glob_make_pattern: do not goto into a branch卜部昌平2020-06-291-4/+6
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* sed -i 's|ruby/impl|ruby/internal|'卜部昌平2020-05-111-1/+1
| | | | To fix build failures.
* sed -i s|ruby/3|ruby/impl|g卜部昌平2020-05-111-1/+1
| | | | This shall fix compile errors.
* Added more NORETURN declarationsNobuyoshi Nakada2020-05-111-1/+3
|
* Merge pull request #2991 from shyouhei/ruby.h卜部昌平2020-04-081-1/+1
| | | Split ruby.h
* Show the deprecated name in the warningNobuyoshi Nakada2020-04-071-1/+1
| | | | Fixed up a58bbd6a512d95ca010d8bebae4fe590400c1413.
* [DOC] Removed RDoc of deprecated methods [ci skip]Nobuyoshi Nakada2020-04-061-6/+1
|
* Moved `Dir.[]` to dir.rbNobuyoshi Nakada2020-04-061-39/+11
|
* Moved `Dir.glob` to dir.rbNobuyoshi Nakada2020-04-061-119/+27
|
* Moved `Dir.open` and `Dir#initialize` to dir.rbNobuyoshi Nakada2020-04-061-52/+14
|
* Use `rb_warn_deprecated` for `File.exists?` and `Dir.exists?`Nobuyoshi Nakada2020-04-061-1/+1
|
* Fixed crash when argument array is modifiedNobuyoshi Nakada2020-03-251-1/+1
|
* more on NULL versus functions.卜部昌平2020-02-071-2/+2
| | | | | | Function pointers are not void*. See also ce4ea956d24eab5089a143bba38126f2b11b55b6 8427fca49bd85205f5a8766292dd893f003c0e48