Web lists-archives.com

Re: [Mingw-msys] libgen.h (dirname, basename) and realpath implementation

    We recently switched from a very old set of UnixUtils to MSYS to get
Unix/Linux style command line tools like bash, make, awk, install, etc.
We use these tools as part of our software/firmware development and
release process. The process is controlled by a set of Makefiles which
call a mixture of native Windows binaries, shell scripts and MSYS
utilities. We use this process as Makefiles provide a very powerful
means of automating build processes. It also allows us to build on
native Linux with the same scripts.

    Here however is where the problems started. After installing MSYS we
noticed some very odd file permission problems after building on Windows
under MSYS and native Linux.

    All builds are performed on a Windows 2003 hosted file system. This
is accessed via MSYS by whatever direct mechanism it uses and from Linux
using NFS. The Windows 2003 server is running Unix Utils for Windows to
provide the NFS and also NIS user/group mappings. Therefore under Linux
you get to see the Windows username and primary group from an "ls -al".
The report from "id" also reflects the correct Windows defined username
and groups created within Active Directories.

    The build I am performing is partly run under Windows to get MS
VC.NET to build the Windows DLL libraries and partly under Linux to
build the Linux shared object libraries. All builds are through
Makefiles using MSYS make with a "make" shell of "bash", again from
MSYS. For Windows side builds the make process is started from a CMD
window rather than an MSYS "bash" shell.

    Individually the build work fine and files are created with
reasonable permissions. However when we come to perform the install it
all goes wrong. The install is generally run on Linux first. This uses
"install" to create directories (-d -m 0755) and also install files (-m
0644). If we do this and view the results from Linux you see the Windows
file permissions as defined by the install mode. If I then run the
Windows side install, which deposits additional files under the tree
already built under Windows, the files and directories created all come
out with permissions 0700.

    If however I run the MSYS Windows side install first and then the
Linux install, all files get the correct permissions. Sadly I cannot do
it this way around in the final build.

    To summarise, if I individually create files or directories under
MSYS Windows or Linux the permissions look OK. Under Windows MSYS the
permissions seem to be an exact inherited copy from the parent
directory. Under Linux however the permissions are now an exact
inherited copy of the Windows permissions but have the appropriate
primary group and other group. If I create a directory first in Linux
and then a file/directory under MSYS within the Linux created directory
the file permissions are trashed to 0700. It would seem therefore that
MSYS is not able to copy through the permissions from the Linux created

    On a slightly related but possibly bogus thread, the result of "id"
within MSYS is completely different to the Linux view. How or where does
MSYS get its user ID and group ID information from? Could this be the
source of my problems?

    Hope this all makes some sense.



David Bilsby

Senior Engineer
TEK Microsystems Ltd.
Unit A, Malvern View, Willow End Park,
Blackmore Park Road, Malvern, Worcs. WR13 6NN.
Email: dbilsby@xxxxxxxxxxxxxx
Tel: +44 1684 311113
WWW: www.tekmicro.com
fn:David Bilsby
org:TEK MicroSystems Ltd
adr:Willow End Park, Blackmore Park Road,;;Unit A, Malvern View,;Malvern;Worcs;WR13 6NN;ENGLAND
title:Senior Engineer
tel;work:+44 1684 311113

SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
Mingw-msys mailing list