summaryrefslogtreecommitdiff
path: root/dir.c
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Fixed double closedirNobuyoshi Nakada2020-01-201-2/+4
| | | | | | In the case that shinking the entries buffer to the exact size failed, `dirp` is already closed. Found by mame with Coverity Scan.
* Sort globbed results by default [Feature #8709]Nobuyoshi Nakada2020-01-191-27/+215
| | | | | | 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.
* Made glob option keyword IDs staticNobuyoshi Nakada2020-01-181-3/+5
|
* Fix documentation of Dir#each_childSeiei Miyagi2019-12-291-1/+1
|
* decouple internal.h headers卜部昌平2019-12-261-36/+44
| | | | | | | | | | | | | | | | | | 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).
* [DOC] Added File::FNM_SYSCASE example [Bug #16391] [ci skip]Nobuyoshi Nakada2019-12-041-0/+1
|
* Deprecate taint/trust and related methods, and make the methods no-opsJeremy Evans2019-11-181-3/+1
| | | | | | 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.
* Warn on access/modify of $SAFE, and remove effects of modifying $SAFEJeremy Evans2019-11-181-1/+0
| | | | | | | | | | | | | | | | | 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.
* dir.c (join_path_from_pattern): check NULL from mallocYusuke Endoh2019-10-131-2/+4
| | | | | Coverity Scan points out that all the return values of GLOB_ALLOC_N are NULL-checked except this call.
* avoid overflow in integer multiplication卜部昌平2019-10-091-1/+13
| | | | | | | This changeset basically replaces `ruby_xmalloc(x * y)` into `ruby_xmalloc2(x, y)`. Some convenient functions are also provided for instance `rb_xmalloc_mul_add(x, y, z)` which allocates x * y + z byes.