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

os: Stat fails on NTFS volumes with Deduplication enabled #10935

Closed
NTmatter opened this issue May 22, 2015 · 8 comments
Closed

os: Stat fails on NTFS volumes with Deduplication enabled #10935

NTmatter opened this issue May 22, 2015 · 8 comments

Comments

@NTmatter
Copy link

  • Go Version: go1.4.2 windows/amd64
  • OS and Arch: Windows 8.1 Pro 64-bit.
  • Action: os.Stat("Path\to\deduped.file")
  • Expected Result: successfully returns (FileInfo, nil)
  • Actual Result: err := "readlink Path\to\deduped.file: The system cannot find the file specified."

From a bit of digging, the issue is caused by NTFS Dedupe using reparse points for deduplicated files. The Windows implementation of fileStat.Mode() treats all reparse points as symlinks, however there are several other cases to consider, including Deduplication and Mount Points, neither of which are symlinks.

The Windows implementation of os.Readlink() already performs a sanity check to ensure that it is handling a symlink. Ideally a similar inspection could be performed in Mode(), checking for IO_REPARSE_TAG_DEDUP == 0x80000013 and stripping the Symlink flag, allowing the file to be treated as Regular.

@mikioh mikioh changed the title Stat() fails on NTFS volumes with Deduplication enabled os: Stat() fails on NTFS volumes with Deduplication enabled May 23, 2015
@alexbrainman
Copy link
Member

@NTmatter would you like to send a fix for this? You seems to know all about these file types. See http://golang.org/doc/contribute.html for details. If not, I will fix it myself.

Alex

@NTmatter
Copy link
Author

NTmatter commented Jun 2, 2015

I can take a stab at it if you don't have enough bandwidth. It'll probably be a few days before I can get a proper dev and test environment together, depending on my workload.

@ianlancetaylor ianlancetaylor added this to the Go1.5Maybe milestone Jun 3, 2015
@alexbrainman
Copy link
Member

Please try to fix this. I don't know much about any of this and don't really want to learn. But happy to review your code. I can test your code if you don't have appropriate environment setup. Good new test will make our task much easier, considering I know little about the subject. Test that breaks with current tip, but PASSes once your changes are applied.

No pressure. I will do it myself, if you cannot do it. Thank you.

Alex

@NTmatter
Copy link
Author

NTmatter commented Jun 3, 2015

I've got a basic dev environment running now. Should be possible to start looking at it in the next day or two :)

@NTmatter
Copy link
Author

Took a bit longer than expected, but a small change set is up for review at https://go-review.googlesource.com/11330/

@gopherbot
Copy link

CL https://golang.org/cl/11330 mentions this issue.

@rsc rsc modified the milestones: Go1.6Early, Go1.5Maybe Jul 21, 2015
@rsc rsc changed the title os: Stat() fails on NTFS volumes with Deduplication enabled os: Stat fails on NTFS volumes with Deduplication enabled Jul 21, 2015
@ianlancetaylor ianlancetaylor modified the milestones: Go1.6, Go1.6Early Dec 11, 2015
@rsc rsc modified the milestones: Unplanned, Go1.6 Jan 7, 2016
@gopherbot
Copy link

CL https://golang.org/cl/41504 mentions this issue.

@gopherbot
Copy link

CL https://golang.org/cl/41834 mentions this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants