[#100689] [Ruby master Feature#17303] Make webrick to bundled gems or remove from stdlib — hsbt@...
Issue #17303 has been reported by hsbt (Hiroshi SHIBATA).
11 messages
2020/11/02
[#100852] [Ruby master Feature#17326] Add Kernel#must! to the standard library — zimmerman.jake@...
SXNzdWUgIzE3MzI2IGhhcyBiZWVuIHJlcG9ydGVkIGJ5IGpleiAoSmFrZSBaaW1tZXJtYW4pLg0K
24 messages
2020/11/14
[#100930] [Ruby master Feature#17333] Enumerable#many? — masafumi.o1988@...
Issue #17333 has been reported by okuramasafumi (Masafumi OKURA).
10 messages
2020/11/18
[#101071] [Ruby master Feature#17342] Hash#fetch_set — hunter_spawn@...
Issue #17342 has been reported by MaxLap (Maxime Lapointe).
26 messages
2020/11/25
[ruby-core:100945] [Ruby master Bug#17280] Dir.glob with FNM_DOTMATCH matches ".." and "." and results in duplicated entries
From:
eregontp@...
Date:
2020-11-19 12:58:38 UTC
List:
ruby-core #100945
Issue #17280 has been updated by Eregon (Benoit Daloze).
I wonder if we could simplify the logic to never include `..` for `Dir.glob`, and only include `.` for the initial directory and nowhere else.
Are there cases where `..` and `.` would ever be wanted, besides `Dir.glob(".") => ["."]`?
Not sure it's even a good idea to include `.` for `Dir.glob("*", File::FNM_DOTMATCH)`, the intention of `*` seems clearly to list all files/subdirs under this directory, not this directory itself, and certainly not the parent directory.
----------------------------------------
Bug #17280: Dir.glob with FNM_DOTMATCH matches ".." and "." and results in duplicated entries
https://bugs.ruby-lang.org/issues/17280#change-88600
* Author: Eregon (Benoit Daloze)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
```
% ruby -e 'p Dir.glob("**/*", File::FNM_DOTMATCH)'
[".", "bar", "bar/.", "bar/.baz", "bar/.baz/.", "bar/.baz/qux"]
% ruby -e 'p Dir.glob("**", File::FNM_DOTMATCH)'
[".", "..", "bar"]
% ruby -e 'p Dir.glob("*", File::FNM_DOTMATCH)'
[".", "..", "bar"]
```
I think `".."` was never intended by the user here, is it a bug?
Not sure about `"."`.
Note it also causes duplicated entries: `bar and bar/.baz` are twice in the Array!
I think `..` should always be ignored for glob purposes, it escapes the current directory.
And `.` seems useless and causing duplicates.
I think the intention of users of `File::FNM_DOTMATCH` is to match file/directories starting with a `.` like `.baz`.
Probably `Dir.glob("**/{*,.*}")` is a safer way to achieve that,
but still I think `FNM_DOTMATCH` should not produce such weird results.
From https://github.com/oracle/truffleruby/issues/2116
I could not figure out what was the intended semantics for FNM_DOTMATCH with regards to `.` and `..`.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>