Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filename.dirname on Win32 UNC paths #7912

Closed
vicuna opened this issue Feb 6, 2019 · 4 comments
Closed

Filename.dirname on Win32 UNC paths #7912

vicuna opened this issue Feb 6, 2019 · 4 comments

Comments

@vicuna
Copy link

vicuna commented Feb 6, 2019

Original bug ID: 7912
Reporter: @alainfrisch
Status: new
Resolution: open
Priority: normal
Severity: minor
Category: standard library
Monitored by: @nojb @dbuenzli

Bug 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"?

@vicuna
Copy link
Author

vicuna commented Feb 6, 2019

Comment author: @dbuenzli

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

@vicuna vicuna added the stdlib label Mar 14, 2019
@nojb nojb added the windows label Mar 15, 2019
@github-actions
Copy link

github-actions bot commented May 6, 2020

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

@github-actions github-actions bot added the Stale label May 6, 2020
@nojb nojb reopened this Jun 10, 2020
@nojb nojb removed the Stale label Jun 10, 2020
@github-actions
Copy link

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

@github-actions github-actions bot added the Stale label Jun 14, 2021
@damiendoligez damiendoligez added bug and removed Stale labels Jun 14, 2021
@github-actions
Copy link

github-actions bot commented Jul 1, 2022

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

@github-actions github-actions bot added the Stale label Jul 1, 2022
@github-actions github-actions bot closed this as completed Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants