Environment to run tests in, changing file permissions on Cygwin

Matt Mackall mpm at selenic.com
Fri Jan 29 13:04:43 CST 2016


On Fri, 2016-01-29 at 11:55 +0100, Dr Rainer Woitok wrote:
> Matt,
> 
> On Friday, 2016-01-29 11:05:22 +0100, I myself wrote:
> 
> > ...
> > On Thursday, 2016-01-28 13:08:52 -0600, you wrote:
> > > ...
> > > What does "hg debugfs" say?
> > 
> > $ /bin/hg debugfs
> > exec: no
> > ...
> > $
> 
> What precisely  does that mean?   What does Python  think is  wrong with
> Cygwin's  (or Windows')  execution bits?

Exec bits are not a concept native to Windows. When Mercurial is run in an
environment where Python thinks it's Windows, it turns off support for exec bits
on the filesystem.

In particular, if os.name == 'nt', then we import windows.py, which defines
checkexec() to return False.

So, what does this say for you:

$ python -c "import os; print os.name"

(Make sure you test both the Python hg i thats configured to use and whatever
one you use to run run-tests.py)

If it says "posix", exec bit support is checked with this code:

https://www.selenic.com/hg/file/tip/mercurial/posix.py#l150

Basically:

- create a temp file
- flip the exec bit
- check if the exec bit changed

There's an analogous version of this code in the test suite's hghave.py that's
apparently returning True even though the one in Mercurial proper is returning
False.

This primarily exists to support operating systems that have an native exec bit
(Unix) but support mounting filesystems that don't (eg vfat). 

It's unclear whether Mercurial supporting exec bits under any circumstances on
Windows is "a good thing". It will almost certainly lead to confusing, awful bug
reports as people try to use THG and Cygwin hg against repos on the same disk.

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial mailing list