Opened 6 years ago

Closed 5 years ago

#8342 closed bug (fixed)

System.Directory.getPermissions does not work well on Windows 7

Reported by: freizl Owned by: leroux
Priority: normal Milestone:
Component: Core Libraries Version: 7.4.1
Keywords: Cc: core-libraries-committee@…
Operating System: Windows Architecture: x86_64 (amd64)
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

It works well for following code

System.Directory.getPermissions "/path/to/somewhere"

However getting error with this:

System.Directory.getPermissions "/path/to/somewhere/"
*** Exception: getPermissions: does not exist (No such file or directory)

The only difference is the path name. It gets error when having extra trailing slash. It looks wired.

Thanks your help.

Change History (12)

comment:1 Changed 6 years ago by leroux

A quick, hacky fix would be to remove any trailing slashes...

comment:2 in reply to:  1 ; Changed 6 years ago by freizl

Replying to leroux:

A quick, hacky fix would be to remove any trailing slashes...

Yes, I did that in my project. However I'm wondering the reason and hopefully there will be a fix. ;) Thanks.

comment:3 in reply to:  2 Changed 6 years ago by leroux

Owner: set to leroux

Replying to freizl:

Yes, I did that in my project. However I'm wondering the reason and hopefully there will be a fix. ;) Thanks.

I'll try to take a look tonight. Luckily, I have a windows box I can test on.

I'm thinking that this is mainly just a problem how windows handles paths.

https://github.com/ghc/packages-directory/blob/master/System/Directory.hs#L194

comment:4 Changed 6 years ago by leroux

It seems like keeping a trailing slash is an user error (in terms of Windows). Someone let me know if I'm wrong.

comment:5 Changed 5 years ago by thoughtpolice

Component: libraries/directoryCore Libraries

Moving over to new owning component 'Core Libraries'.

comment:6 Changed 5 years ago by gintas

Cc: core-libraries-committee@… added

How about being strict and always disallowing slashes at the end?

comment:7 Changed 5 years ago by freizl

I think library user just like it works well without error or meaningful error. "Does not exists" make little sense IMHO.

Being strict is good idea and I suppose core library would do either of below when has slash at the end

  • Fixed it auto hence getPermissions show result correctly.
  • Display errors like "shall no have slash at the end"

Suggestions/comments?

Thanks.

comment:8 Changed 5 years ago by hvr

If this turns out to be an issue in directory, please file an issue at upstream https://github.com/haskell/directory/issues and change this ticket's state to "Upstream"

comment:9 Changed 5 years ago by ekmett

I'd think we'd want directory to just do the right thing and normalize before handing it off to the OS on windows.

All the other platforms deal gracefully with trailing slashes.

comment:10 Changed 5 years ago by freizl

Status: newupstream

comment:11 Changed 5 years ago by freizl

Open new ticket to "directory" lib.

https://github.com/haskell/directory/issues/9

comment:12 Changed 5 years ago by Rufflewind

Resolution: fixed
Status: upstreamclosed

Fixed upstream.

Note: See TracTickets for help on using tickets.