[ruby-core:104576] [Ruby master Bug#12261] Windows: File.dirname with 2+ / or 2+ \\ will return // or \\\\
From:
nobu@...
Date:
2021-07-11 09:11:57 UTC
List:
ruby-core #104576
Issue #12261 has been updated by nobu (Nobuyoshi Nakada).
Status changed from Assigned to Closed
It is a different thing from single '/' on Windows, like drive letters.
----------------------------------------
Bug #12261: Windows: File.dirname with 2+ / or 2+ \\ will return // or \\\\
https://bugs.ruby-lang.org/issues/12261#change-92858
* Author: enebo (Thomas Enebo)
* Status: Closed
* Priority: Normal
* Assignee: usa (Usaku NAKAMURA)
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
I am working through some File.dirname issues on JRuby and I saw a ruby/spec covering this behavior on windows:
`File.dirname('/////').should == '//'`
Same result if backslashes are used. Is there a reason for this result? It does not seem useful to me but I am not much of a windows user. I would think in this case it would be '/' since I don't see how this is useful for UNC paths in Ruby? If someone could explain it then I will document this at least in JRuby source code :)
So far all versions of MRI seem to have this behavior.
--
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>