Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007912OCamlstandard librarypublic2019-02-06 16:072019-02-06 21:40
Reporterfrisch 
Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusnewResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0007912: Filename.dirname on Win32 UNC paths
Description
# let s = "\\\\foo" in Filename.(dirname s, basename s);;
- : string * string = ("\\", "foo")
# let s = "\\\\foo" in Filename.(concat (dirname s) (basename s));;
- : string = "\\foo"


Note that the initial double backslash has been transformed to a single-one, such changing the original path (an absolute one) to a path relative to the current drive. The doc claims that :

> If [name] is a valid file name, then [concat (dirname name) (basename name)]
> returns a file name which is equivalent to [name].

Technically, \\foo is not a valid file name, but it is a valid path.

Filename.dirname has some special logic under Win32 to extract the "drive" component. Shouldn't something similar be done for such UNC server component, which are also "roots"?
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0019584)
dbuenzli (reporter)
2019-02-06 21:25

I guess you already know that Windows paths are hairy. Here's a good reference about them:

https://docs.racket-lang.org/reference/windowspaths.html [^]

The `path_start` function here:

https://github.com/b0-system/b0/blob/df3115abe3269f799973c253b41340243df774c1/src-std/b0_std.ml#L2008-L2038 [^]

which I ported from the Fpath library should determine the start of a windows path using `String`'s functions but I didn't test it thoroughly for now. It should handle these various test cases:

https://github.com/dbuenzli/fpath/blob/f679f231ee994e30ca2f5f2b327b3750e9bdf82d/test/test_fpath.ml#L145-L160 [^]

- Issue History
Date Modified Username Field Change
2019-02-06 16:07 frisch New Issue
2019-02-06 16:08 frisch Description Updated View Revisions
2019-02-06 16:08 frisch Description Updated View Revisions
2019-02-06 16:08 frisch Description Updated View Revisions
2019-02-06 21:25 dbuenzli Note Added: 0019584


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker