简体   繁体   English

目录上的Windows权限:Mercurial - hg merge - “abort:access is denied”

[英]Windows permissions on a directory: Mercurial - hg merge - “abort: access is denied”

Background: this is running on a Windows 2008 Server. 背景:这是在Windows 2008 Server上运行的。

https://www.mercurial-scm.org/wiki/Workflows#Feature_separation_through_named_branches https://www.mercurial-scm.org/wiki/Workflows#Feature_separation_through_named_branches

I'm a Mercurial newbie, and am trying to follow the advice above where it says to "Merge default into your feature as often as possible" -- and I've done this a couple of times previously today, already, with other files. 我是一个Mercurial新手,我正在尝试按照上面的建议说“尽可能经常将默认合并到您的功能中” - 而且我已经在今天做了几次,已经和其他文件一样了。

However, this newest change just won't merge. 但是,这个最新的变化不会合并。

When I do the 'hg merge default' I get the error "abort: Access is denied". 当我执行'hg merge default'时,我收到错误“abort:Access is denied”。 After googling around, I see that some people reported actually having permissions problems on the files in question. 谷歌搜索后,我看到有些人报告实际上有问题的文件有权限问题。 There's nothing special about the permissions on the file in question, at least not that I can see. 关于该文件的权限没有什么特别之处,至少不是我能看到的。 I'm a Linux person by training, not a Windows person, so fundamentally I don't really understand Windows file permissions. 我是一名受过培训的Linux人员,而不是Windows用户,因此从根本上说我并不了解Windows文件权限。 Cygwin claims that the file in question is 644 (ie, I can write to the file), which is the same set of permissions as every other file that has previously been successfully touched by the hg merge process in the past. Cygwin声称有问题的文件是644(即,我可以写入文件),这是与以前hg合并过程成功触及的每个其他文件相同的权限集。

I took a look at the DOS 'attrib' command and it doesn't show a 'read-only' flag next the file in question, either. 我查看了DOS'attrib'命令,它也没有显示相关文件旁边的'只读'标志。

If this is less a Mercurial question than it is a Windows permissions question, I'm happy to modify the tags further as well. 如果这不是一个Mercurial问题,而是一个Windows权限问题,我很乐意进一步修改标签。

I'm assuming that this "abort: Access is denied" error refers to the file in the changeset that needs to be merged, and not to one of the .hg/ files, but it's a very cryptic error message -- it doesn't say which file has an access issue (and there is only one single file in the changeset that was changed -- I purposely tried to be VERY simple with this test). 我假设这个“中止:访问被拒绝”错误是指变更集中需要合并的文件,而不是其中一个.hg /文件,但它是一个非常神秘的错误消息 - 它没有' t说哪个文件有访问权限问题(变更集中只有一个文件被更改了 - 我故意试着用这个测试非常简单)。

UPDATE: 更新:

Did an 'hg rollback' and tried the same test of commands in the same order, leaving the files open, only with a completely different file (lib/blort.html instead of blah/foo.html). 做了'hg rollback',并以相同的顺序尝试了相同的命令测试,保持文件打开,只有一个完全不同的文件(lib / blort.html而不是blah / foo.html)。

The 'hg merge' worked just fine. 'hg merge'工作得很好。

So there's probably something particularly hinky about the permissions on the specific file I started with (foo.html), or the directory that is its parent. 因此,对于我开始使用的特定文件(foo.html)或其父目录的权限,可能会有一些特别的暗示。

Another Edit 另一个编辑

Definitely something off about the parent directory, as I had the same problem w/ another file in the directory, but the problem does not manifest elsewhere in the directory structure, only in this one directory. 肯定是关于父目录的事情,因为我和目录中的另一个文件有同样的问题,但问题不会在目录结构的其他地方显示,只在这一个目录中。

Just checked the permissions on lib/ versus blah/ and they both seem the same in Cygwin, but that's only a vague approximation of the Windows ACLs. 刚检查了lib / vs blah /的权限,它们在Cygwin中看起来都是一样的,但这只是Windows ACL的模糊近似。 When examining those by right-clicking each directory and examining the 'Properties' Security tabs, they again seem the same for both directories, but I think the crux of the problem is that I really don't quite grok ACLs. 通过右键单击每个目录并检查“属性”安全性选项卡来检查它们时,它们对于两个目录看起来都是一样的,但我认为问题的症结在于我真的不太熟悉ACL。

Is there some DOS command-line tool, like 'attrib' only more powerful, that, like 'ls' in linux, would give me more information than the confusing jumble of checkmarks I get in the 'Properties'? 是否有一些DOS命令行工具,比如'attrib'只是更强大,像linux中的'ls',会给我提供更多的信息,而不是我在'属性'中得到的混乱的勾选标记?

Hopefully the final edit 希望最后的编辑

How to diff Windows permissions 如何区分Windows权限

'iCacls' seems to be the correct tool for the job, and seems to have solved the problem, but I'd like to duplicate this before accepting/closing. 'iCacls'似乎是这项工作的正确工具,似乎已经解决了问题,但我想在接受/关闭之前复制它。

SUMMARY 摘要

  1. When in doubt, use --debug on your Mercurial commands. 如有疑问,请在Mercurial命令上使用--debug This is a little bit 'duh' now, but thanks to @lazy-badger for pointing it out. 现在这有点'呃',但感谢@ lazy-badger指出它。

  2. You can fix your Server 2008 permissions using a command like icacls path /grant domain\\user:(OI)(CI)F (see eg http://www.petri.co.il/forums/showthread.php?t=23207 ), but be sure to do this from an escalated CMD window ('Run As Adminstrator'). 您可以使用icacls path /grant domain\\user:(OI)(CI)F等命令修复Server 2008权限(请参阅http://www.petri.co.il/forums/showthread.php?t=23207) ),但一定要从升级的CMD窗口('Run As Adminstrator')执行此操作。 Again 'duh' to Windows people, not so obvious to a Linux person (instead I went googling around for some DOS equivalent to sudo ). 再次'呃'对Windows的人来说,对Linux人来说并不那么明显(相反,我去谷歌搜索一些相当于sudo DOS)。

You may get an access denied error on Windows if some other program has the file open. 如果某些其他程序打开该文件,您可能会在Windows上收到访问被拒绝错误。 You can try closing programs that might have any files in that tree open, or rebooting the computer (which would, of course, close all programs). 您可以尝试关闭可能打开该树中的任何文件的程序,或者重新启动计算机(当然,这将关闭所有程序)。

只是要注意合并上的“拒绝访问” 可以有两个不同的根:@emil提到的用户的错误或不存在的权限,在启动凭据hg的情况下,在$ TEMP文件夹中创建临时文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM