Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
syscall: use Windows FILE_FLAG_BACKUP_SEMANTICS in remaining places (Open) #23312
I would like to request that
As well as fixing the inconsistency, this would allow Go users to open files on disk, in those cases where their permission to do so comes via
What version of Go are you using (
We only use FILE_FLAG_BACKUP_SEMANTICS to open directories and symlinks. There is no way to open them without FILE_FLAG_BACKUP_SEMANTICS flag. We do not use FILE_FLAG_BACKUP_SEMANTICS to open files, because everything we do with files work just fine without FILE_FLAG_BACKUP_SEMANTICS.
Why? What is broken if we don't do that?
I did not understand this explanation. Please try again.
A backup program should be able to back up all files on the system.
But, a backup program must run as a certain Windows user, and it's possible that there are some files that the backup user account does not have permission to access, according to the normal ACL permission system.
Windows has a solution for it: You can open a file if either (A) you have normal ACL permissions to do so, or (B) your user account has
Passing this flag does not change behaviour in the normal case. It only increases the functionality. So, I don't think there's any harm in passing this flag unconditionally.
Right now, it's difficult to write backup programs in Go that take advantage of
Thank for explaining.
I am not security expert, so I would not know if there is a downside to
You can call syscall.CreateFile directly. Not many people write backup programs, so people who do, would have to jump through the hoops that Microsoft creates. Sorry.