RFC: Adding a check to the top level configure script for a binary-mounted cygwin-hosted build directory

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

RFC: Adding a check to the top level configure script for a binary-mounted cygwin-hosted build directory

Nick Clifton
Hi Paolo, Hi Alex,

  May I ask for your advice on a configure script matter ?

  The Binutils bug PR 4334 has pointed out the problems of trying to
  build a toolchain under Cygwin with a build directory mounted in
  text mode.  So, I think that it is agreed that toolchains should
  only be built on bin-mounted drives and I would like the configure
  script to make sure that this happens.

  I am attaching a provisional patch which I think will do what I
  want, but I would like to get your comments it.  I tested the
  patch under both Cygwin and Linux, and it does not appear to
  introduce any new problems, so I am reasonably confident that it
  works.  But I am not at all sure that I have used the best approach
  to the problem.  Your comments ?

Cheers
  Nick

ChangeLog
2007-05-23  Nick Clifton  <[hidden email]>

        * configure.ac: Call ACX_CHECK_CYGWIN_MOUNTED_BUILDDIR for
        Cygwin based hosts.
        * configure: Regenerate.

config/ChangeLog
2007-05-23  Nick Clifton  <[hidden email]>

        * acx.m4 (ACX_CHECK_CYGWIN_MOUNTED_BUILDDIR): Define.
Reply | Threaded
Open this post in threaded view
|

Re: RFC: Adding a check to the top level configure script for a binary-mounted cygwin-hosted build directory

Paolo Bonzini
Nick Clifton wrote:

> Hi Paolo, Hi Alex,
>
>   May I ask for your advice on a configure script matter ?
>
>   The Binutils bug PR 4334 has pointed out the problems of trying to
>   build a toolchain under Cygwin with a build directory mounted in
>   text mode.  So, I think that it is agreed that toolchains should
>   only be built on bin-mounted drives and I would like the configure
>   script to make sure that this happens.
>
>   I am attaching a provisional patch which I think will do what I
>   want, but I would like to get your comments it.  I tested the
>   patch under both Cygwin and Linux, and it does not appear to
>   introduce any new problems, so I am reasonably confident that it
>   works.  But I am not at all sure that I have used the best approach
>   to the problem.  Your comments ?

I haven't looked at the patch yet, but as an aside, I think this should
also go into the main autoconf distribution; there is no reason why
somebody should build under a text-mode mounted directory.

Paolo
Reply | Threaded
Open this post in threaded view
|

Re: RFC: Adding a check to the top level configure script for a binary-mounted cygwin-hosted build directory

Nick Clifton
Hi Paolo, Hi Alex,

> I haven't looked at the patch yet, but as an aside, I think this should
> also go into the main autoconf distribution; there is no reason why
> somebody should build under a text-mode mounted directory.

I agree, I think it would be very good to have this check available in
the main autoconf sources.

I am attaching an updated patch which fixes a couple of problems
uncovered in the first version:

   * I was not escaping the square brackets in the awk script.
   * The check for the "binmode" string needed to be stricter.

Cheers
   Nick



Index: configure.ac
===================================================================
RCS file: /cvs/src/src/configure.ac,v
retrieving revision 1.10
diff -c -3 -p -r1.10 configure.ac
*** configure.ac 21 Mar 2007 20:11:06 -0000 1.10
--- configure.ac 24 May 2007 09:45:14 -0000
*************** case "${host}" in
*** 965,970 ****
--- 965,971 ----
      host_makefile_frag="config/mh-djgpp"
      ;;
    *-cygwin*)
+     ACX_CHECK_CYGWIN_BINMOUNTED_BUILDDIR
      host_makefile_frag="config/mh-cygwin"
      ;;
    *-mingw32*)
Index: config/acx.m4
===================================================================
RCS file: /cvs/src/src/config/acx.m4,v
retrieving revision 1.25
diff -c -3 -p -r1.25 acx.m4
*** config/acx.m4 26 Mar 2007 15:38:25 -0000 1.25
--- config/acx.m4 24 May 2007 09:45:14 -0000
*************** AC_DEFUN([ACX_BUGURL],[
*** 597,599 ****
--- 597,618 ----
    AC_SUBST(REPORT_BUGS_TO)
    AC_SUBST(REPORT_BUGS_TEXI)
  ])
+
+ dnl ####
+ dnl # ACX_CHECK_CYGWIN_BINMOUNTED_BUILDDIR
+ dnl # On Cygwin hosts, check that the build directory is mounted in
+ dnl # binmode as builds will not work if it is mounted in textmode.
+ dnl # See binutils PR 4334 for more details about why textmode is a problem.
+ AC_DEFUN([ACX_CHECK_CYGWIN_BINMOUNTED_BUILDDIR],[
+ AC_MSG_CHECKING([build directory to see if it is mounted in binmode])
+ build_dir=`pwd`
+ build_dir_mount_point=`df ${build_dir} | awk '/[[0-9]]%/{print $NF;}'`
+ is_binmode=`mount | grep "${build_dir_mount_point} " | grep binmode`
+ if test $? == 0 ; then
+   AC_MSG_RESULT(yes)
+ else
+   AC_MSG_RESULT(no)
+   AC_MSG_ERROR([The build directory is not mounted in binmode])
+ fi
+ ])
+  
\ No newline at end of file
Reply | Threaded
Open this post in threaded view
|

Re: RFC: Adding a check to the top level configure script for a binary-mounted cygwin-hosted build directory

DJ Delorie-2

> I agree, I think it would be very good to have this check available in
> the main autoconf sources.

Except that it would penalize MinGW and DJGPP since they don't have a
"binmode" concept.  We've put a lot of work into keeping track of
binary vs text files, why give up on it now?
Reply | Threaded
Open this post in threaded view
|

Re: RFC: Adding a check to the top level configure script for a binary-mounted cygwin-hosted build directory

Nick Clifton
Hi DJ,

>> I agree, I think it would be very good to have this check available in
>> the main autoconf sources.
>
> Except that it would penalize MinGW and DJGPP since they don't have a
> "binmode" concept.  We've put a lot of work into keeping track of
> binary vs text files, why give up on it now?

Are the problems described in PR 4334 also present when building under
MinGW or DJGPP ?  If not, then we can keep this new autoconf test as a
Cygwin specific test.

If those problems are also present then I would agree with you that we
need to fix the binutils build process.

Cheers
   Nick

Reply | Threaded
Open this post in threaded view
|

Re: RFC: Adding a check to the top level configure script for a binary-mounted cygwin-hosted build directory

DJ Delorie-2

> Are the problems described in PR 4334 also present when building
> under MinGW or DJGPP ?  If not, then we can keep this new autoconf
> test as a Cygwin specific test.

I don't have a djgpp build tree at the moment, but djgpp is like
*always* having text mounts.  So, you can simulate it with a cygwin
install where everything is text mounted.  However, DJGPP's tools know
about CR/LF so it may not expose this "bug".

> If those problems are also present then I would agree with you that
> we need to fix the binutils build process.

IMHO the bug is that cygwin's bash isn't dealing with `` line endings
properly.  It's the responsibility of the shell to strip trailing line
endings (1003.2-1992 3.6.3, although it doesn't mention
platform-specific line endings) during command substitution.

Also, cygwin's bash should allow CR/LF pairs as word delimiters during
splitting, if it doesn't already.  Cygwin supports mixed mounts, it
needs to deal with the ramifications itself.
Reply | Threaded
Open this post in threaded view
|

Re: RFC: Adding a check to the top level configure script for a binary-mounted cygwin-hosted build directory

Eli Zaretskii
In reply to this post by Nick Clifton
> Date: Thu, 24 May 2007 16:26:27 +0100
> From: Nick Clifton <[hidden email]>
> CC: [hidden email], [hidden email], [hidden email],         [hidden email]
>
> >> I agree, I think it would be very good to have this check available in
> >> the main autoconf sources.
> >
> > Except that it would penalize MinGW and DJGPP since they don't have a
> > "binmode" concept.  We've put a lot of work into keeping track of
> > binary vs text files, why give up on it now?
>
> Are the problems described in PR 4334 also present when building under
> MinGW or DJGPP ?  If not, then we can keep this new autoconf test as a
> Cygwin specific test.

I think such problems cannot happen with DJGPP or MinGW, so this test
should be kept as Cygwin-specific one.

I agree with DJ that the Cygwin tools had better handle this EOL
problem no matter what's the mount mode, but if Cygwin folks don't
feel like going that way, and think it's okay to force binmode mounts
in this situation, I don't see why we should object.
Reply | Threaded
Open this post in threaded view
|

Re: RFC: Adding a check to the top level configure script for a binary-mounted cygwin-hosted build directory

Corinna Vinschen
In reply to this post by DJ Delorie-2
On May 24 11:42, DJ Delorie wrote:

>
> > Are the problems described in PR 4334 also present when building
> > under MinGW or DJGPP ?  If not, then we can keep this new autoconf
> > test as a Cygwin specific test.
>
> I don't have a djgpp build tree at the moment, but djgpp is like
> *always* having text mounts.  So, you can simulate it with a cygwin
> install where everything is text mounted.  However, DJGPP's tools know
> about CR/LF so it may not expose this "bug".
>
> > If those problems are also present then I would agree with you that
> > we need to fix the binutils build process.
>
> IMHO the bug is that cygwin's bash isn't dealing with `` line endings
> properly.  It's the responsibility of the shell to strip trailing line
> endings (1003.2-1992 3.6.3, although it doesn't mention
> platform-specific line endings) during command substitution.
>
> Also, cygwin's bash should allow CR/LF pairs as word delimiters during
> splitting, if it doesn't already.  Cygwin supports mixed mounts, it
> needs to deal with the ramifications itself.

Does that actually happen with the latest bash?  It should work fine
on textmode mounts.  See
http://cygwin.com/ml/cygwin-announce/2007-05/msg00003.html for more
details on the way bash works with different input files and mounty
modes.

Eric?  Can you confirm or deny this problem for the latest bash?


Corinna

--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat
Reply | Threaded
Open this post in threaded view
|

Re: RFC: Adding a check to the top level configure script for a binary-mounted cygwin-hosted build directory

Eric Blake
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Corinna Vinschen on 5/25/2007 3:47 AM:

>> IMHO the bug is that cygwin's bash isn't dealing with `` line endings
>> properly.  It's the responsibility of the shell to strip trailing line
>> endings (1003.2-1992 3.6.3, although it doesn't mention
>> platform-specific line endings) during command substitution.
>>
>> Also, cygwin's bash should allow CR/LF pairs as word delimiters during
>> splitting, if it doesn't already.  Cygwin supports mixed mounts, it
>> needs to deal with the ramifications itself.
>
> Does that actually happen with the latest bash?  It should work fine
> on textmode mounts.

Currently, the only way to get cygwin to ignore \r inside `` pairs
(regardless of text or binary mount, since the text from `` is not coming
from the file system, but from a pipe) is to use the cygwin-specific igncr
shopt, or to add \r to IFS if the expansion of `` is subject to field
splitting.  This is because with a cygwin-hosted build directory, the
default platform line ending is \n, not \r\n, for compatibility with
Linux.  But ignoring \r is pretty easy; perhaps all that is needed is a
prep step in the cygwin-hosted build that does '(set -o igncr) 2>/dev/null
&& set -o igncr' before calling any djgpp processes inside ``.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             [hidden email]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGVtNQ84KuGfSFAYARAiNUAJ91Pv9FvTfaNUxcDTXzXWnkQSj2DgCgm4+F
bKkCHboaSO9zkuQt7/s2Syg=
=wpI5
-----END PGP SIGNATURE-----