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

元气小坏坏 提交于 2020-01-03 17:28:40

问题


Background: this is running on a Windows 2008 Server.

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.

However, this newest change just won't merge.

When I do the 'hg merge default' I get the error "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. Cygwin claims that the file in question is 644 (i.e., 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.

I took a look at the DOS 'attrib' command and it doesn't show a 'read-only' flag next the file in question, either.

If this is less a Mercurial question than it is a Windows permissions question, I'm happy to modify the tags further as well.

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).

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).

The 'hg merge' worked just fine.

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.

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. 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.

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'?

Hopefully the final edit

How to diff Windows permissions

'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.

SUMMARY

  1. When in doubt, use --debug on your Mercurial commands. This is a little bit 'duh' now, but thanks to @lazy-badger for pointing it out.

  2. You can fix your Server 2008 permissions using a command like icacls path /grant domain\user:(OI)(CI)F (see e.g. http://www.petri.co.il/forums/showthread.php?t=23207), but be sure to do this from an escalated CMD window ('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).


回答1:


Just to note "Access denied" on merge can have two different roots: mentioned by @emil and wrong or nonexistent rights for user, under which credentials hg was started, to create temporary files in $TEMP folder




回答2:


You may get an access denied error on Windows if some other program has the file open. 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).



来源:https://stackoverflow.com/questions/7771862/windows-permissions-on-a-directory-mercurial-hg-merge-abort-access-is-den

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!