[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-devel] Updated Issue 99 - mtn:execute attr sometimes initializ
From: |
code |
Subject: |
[Monotone-devel] Updated Issue 99 - mtn:execute attr sometimes initialized wrong on Cygwin and MinGW (monotone) |
Date: |
Thu, 28 Oct 2010 12:34:28 GMT |
Hello,
The following issue has been updated:
99 - mtn:execute attr sometimes initialized wrong on Cygwin and MinGW
Project: monotone
Status: New
Reported by: Stephen Leake
URL: http://code.monotone.ca/p/monotone/issues/99/
Labels:
Type:Defect
Priority:Medium
Comments (last first):
# By Stephen Leake, Oct 28, 2010:
Lapo Luchini writes on monotone-devel:
Cygwin *has* the executable bit, and it is mapped on the "can be executed"
standard Windows ACL, which more or less all files gets by default.
So, if you create a text file with notepad.exe, Cygwin see it as executable. If
you create one with Cygwin's nano, it is not.
The same is true of mtn MinGW; it uses the standard Windows file create API,
which sets the "can be executed" ACL. So non-executable files checked out by
the MinGW mtn are seen by the Cygwin mtn as executable. That explains the
symptoms reported above.
A partial fix would be to have the MinGW mtn set the ACL correctly, and
document the bizarre Windows behavior for non-mtn non-cygwin tools.
# By Stephen Leake, Oct 28, 2010:
For example, see the diff_on_missing_trailing_newline_at_end_of_file test;
file1 and file2 both have the mtn:execute attr set when using the
attr_init_function in std_hooks.lua
mtn version 0.47 and after
There are conflicting requirements for attr_init_functions["mtn:execute"]. On
one hand, if a project is multi-platform, it must produce the same answer for
the same file on all platforms, so revids are invariant across platforms.
On the other hand, if a project is single platform, it would be reasonable to
have use the same algorithm as the platform to mark executable files.
Since single platform projects are more common, it makes sense for the mtn
default to be appropriate for the current platform; projects with other needs
must override the hook.
This was discussed in issue 97. Adapting what Richard wrote:
Looking at the source, I'd say that the problem lies in the lua routine called
is_executable(), in unix/process.cc and win32/process.cc. win32/process.cc
does nothing (it just returns false), while unix/process.cc does what's
sensible for Unix.
Further analysis shows that (since mtn 0.47), Cygwin is regarded as unix by
configure.ac. This is probably normally a good thing, since it tries to
emulate unix... but when it comes to is_executable, maybe
that's not the best idea.
So we have a choice. Either add *-pc-cygwin in the case that catches Win32
platforms in configure.ac, or make is_executable in unix/process.cc a special
case for Cygwin.
(end adapt Richard)
Note that the default value for Win32 is also wrong; it should compare the file
extension to the PATHEXT environment variable, as the DOS shell does.
The problem on Cygwin is compounded by the fact that 'mtn checkout' marks some
files as executable even when they do not have the mtn:execute attr; for
example, file1 in diff_on_missing_trailing_newline_at_end_of_file.
--
Issue: http://code.monotone.ca/p/monotone/issues/99/