Issue #14643 has been updated by nobu (Nobuyoshi Nakada).


```diff
diff --git a/dir.c b/dir.c
index 6d2bedf557..432db031e9 100644
--- a/dir.c
+++ b/dir.c
@@ -2536,6 +2536,7 @@ rb_push_glob(VALUE str, VALUE base, int flags) /* '\0' is delimiter */
     long offset = 0;
     long len;
     VALUE ary;
+    int warned = FALSE;
 
     /* can contain null bytes as separators */
     if (!RB_TYPE_P((str), T_STRING)) {
@@ -2553,6 +2554,9 @@ rb_push_glob(VALUE str, VALUE base, int flags) /* '\0' is delimiter */
         const char *pbeg = RSTRING_PTR(str), *p = pbeg + offset;
         const char *pend = memchr(p, '\0', rest);
         if (pend) {
+            if (!warned) {
+                rb_warn("use Array of glob patterns instead of nul-separated patterns");
+            }
             rest = ++pend - p;
             offset = pend - pbeg;
         }
```

----------------------------------------
Feature #14643: Remove problematic separator '\0' of Dir.glob and Dir.[]
https://bugs.ruby-lang.org/issues/14643#change-71334

* Author: usa (Usaku NAKAMURA)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
`Dir.glob` and `Dir.[]` accepts `'\0'` separated string as the parameter,
but this feature is very problematic.
Shouldn't we remove this feature for Ruby3 ?



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>