GNU bug report logs - #13078
[PATCH] configure.ac: Cygwin build breaks when path to pkg-tool contains spaces

Previous Next

Package: emacs;

Reported by: Josh <josh <at> foxtail.org>

Date: Tue, 4 Dec 2012 04:39:01 UTC

Severity: normal

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13078 in the body.
You can then email your comments to 13078 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#13078; Package emacs. (Tue, 04 Dec 2012 04:39:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Josh <josh <at> foxtail.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 04 Dec 2012 04:39:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Josh <josh <at> foxtail.org>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] configure.ac: Cygwin build breaks when path to pkg-tool
	contains spaces
Date: Mon, 3 Dec 2012 20:35:02 -0800
Hi,

I tried building trunk under Cygwin for the first time a few days ago
(with the `--with-w32' switch, though I don't think that's relevant)
but the build failed because ./configure was finding a version of
pkg-config whose path contained whitespace.  This exposed some quoting
problems in configure.ac, fixed in the patch below.  Here's a snippet
of the session with some representative errors:

checking for cma_open in -lpthreads... no
./configure: line 10967: /cygdrive/c/Program: No such file or directory
*** Your version of pkg-config is too old. You need version 0.9.0 or newer.
*** See http://www.freedesktop.org/software/pkgconfig
checking for lgetfilecon in -lselinux... no
./configure: line 11304: /cygdrive/c/Program: No such file or directory
*** Your version of pkg-config is too old. You need version 0.9.0 or newer.
*** See http://www.freedesktop.org/software/pkgconfig
checking for gnutls_certificate_set_verify_function... no
[...]
checking for gpm.h... no
./configure: line 13122: /cygdrive/c/Program: No such file or directory
*** Your version of pkg-config is too old. You need version 0.9.0 or newer.
*** See http://www.freedesktop.org/software/pkgconfig
checking whether netdb declares h_errno... yes

In addition to the quoting problem, it appears that failure to open a
file is interpreted as having a version which is too old, which is
perhaps not ideal.  Here's the patch I applied locally that allowed me
to build successfully:

diff --git a/configure.ac b/configure.ac
index 085ca83..85c21e1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1189,10 +1189,10 @@ AC_DEFUN([PKG_CHECK_MODULES], [
       *** The pkg-config script could not be found. Make sure it is
in your path, or give the full path to pkg-config with the PKG_CONFIG
environment variable or --with-pkg-config-prog.  Or see
http://www.freedesktop.org/software/pkgconfig to get pkg-config.])],
[$4])
   else
      PKG_CONFIG_MIN_VERSION=0.9.0
-     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
+     if "$PKG_CONFIG" --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
         AC_MSG_CHECKING(for $2)

-        if $PKG_CONFIG --exists "$2" 2>&AS_MESSAGE_LOG_FD &&
+        if "$PKG_CONFIG" --exists "$2" 2>&AS_MESSAGE_LOG_FD &&
           $1_CFLAGS=`$PKG_CONFIG --cflags "$2" 2>&AS_MESSAGE_LOG_FD` &&
           $1_LIBS=`$PKG_CONFIG --libs "$2" 2>&AS_MESSAGE_LOG_FD`; then
            edit_cflags="
@@ -2027,7 +2027,7 @@ if test x"$pkg_check_gtk" = xyes; then
     AC_DEFINE(USE_GTK, 1, [Define to 1 if using GTK.])
     GTK_OBJ="gtkutil.o $GTK_OBJ"
     USE_X_TOOLKIT=none
-    if $PKG_CONFIG --atleast-version=2.10 gtk+-2.0; then
+    if "$PKG_CONFIG" --atleast-version=2.10 gtk+-2.0; then
       :
     else
       AC_MSG_WARN([[Your version of Gtk+ will have problems with




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13078; Package emacs. (Wed, 05 Dec 2012 02:00:01 GMT) Full text and rfc822 format available.

Message #8 received at 13078 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Josh <josh <at> foxtail.org>
Cc: 13078 <at> debbugs.gnu.org
Subject: Re: bug#13078: [PATCH] configure.ac: Cygwin build breaks when path to
	pkg-tool contains spaces
Date: Tue, 04 Dec 2012 20:59:34 -0500
Josh wrote:

> but the build failed because ./configure was finding a version of
> pkg-config whose path contained whitespace.  This exposed some quoting
> problems in configure.ac, fixed in the patch below.

Thanks, see comments below. (I wouldn't be surprised to learn that there
are similar problems for other variables.)

> --- a/configure.ac
> +++ b/configure.ac
[...]
> -     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
> +     if "$PKG_CONFIG" --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
>          AC_MSG_CHECKING(for $2)
>
> -        if $PKG_CONFIG --exists "$2" 2>&AS_MESSAGE_LOG_FD &&
> +        if "$PKG_CONFIG" --exists "$2" 2>&AS_MESSAGE_LOG_FD &&
>            $1_CFLAGS=`$PKG_CONFIG --cflags "$2" 2>&AS_MESSAGE_LOG_FD` &&
                        ^^^^^^^^^^^

>            $1_LIBS=`$PKG_CONFIG --libs "$2" 2>&AS_MESSAGE_LOG_FD`; then
                      ^^^^^^^^^^^

Surely these (and the --print-errors call) need quoting too?

>             edit_cflags="
> @@ -2027,7 +2027,7 @@ if test x"$pkg_check_gtk" = xyes; then
>      AC_DEFINE(USE_GTK, 1, [Define to 1 if using GTK.])
>      GTK_OBJ="gtkutil.o $GTK_OBJ"
>      USE_X_TOOLKIT=none
> -    if $PKG_CONFIG --atleast-version=2.10 gtk+-2.0; then
> +    if "$PKG_CONFIG" --atleast-version=2.10 gtk+-2.0; then




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13078; Package emacs. (Wed, 05 Dec 2012 04:17:02 GMT) Full text and rfc822 format available.

Message #11 received at 13078 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Josh <josh <at> foxtail.org>, 13078 <at> debbugs.gnu.org
Subject: Re: bug#13078: [PATCH] configure.ac: Cygwin build breaks when path to
	pkg-tool contains spaces
Date: Tue, 04 Dec 2012 23:16:19 -0500
>> -     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
>> +     if "$PKG_CONFIG" --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then

I'd expect $PKG_CONFIG_MIN_VERSION to need quoting as well.
In my experience, $FOO variable references in sh scripts need to be
wrapped inside "..." by default to avoid such problem.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13078; Package emacs. (Wed, 05 Dec 2012 04:41:01 GMT) Full text and rfc822 format available.

Message #14 received at 13078 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Josh <josh <at> foxtail.org>, 13078 <at> debbugs.gnu.org
Subject: Re: bug#13078: [PATCH] configure.ac: Cygwin build breaks when path to
	pkg-tool contains spaces
Date: Tue, 04 Dec 2012 23:40:42 -0500
Stefan Monnier wrote:

>>> -     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
>>> +     if "$PKG_CONFIG" --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
>
> I'd expect $PKG_CONFIG_MIN_VERSION to need quoting as well.

It's a variable that we define ourselves rather than something we get
from the environment, and we know it doesn't contain spaces.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13078; Package emacs. (Wed, 05 Dec 2012 05:02:01 GMT) Full text and rfc822 format available.

Message #17 received at 13078 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Josh <josh <at> foxtail.org>, 13078 <at> debbugs.gnu.org
Subject: Re: bug#13078: [PATCH] configure.ac: Cygwin build breaks when path to
	pkg-tool contains spaces
Date: Wed, 05 Dec 2012 00:01:30 -0500
>>>> -     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
>>>> +     if "$PKG_CONFIG" --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
>> I'd expect $PKG_CONFIG_MIN_VERSION to need quoting as well.
> It's a variable that we define ourselves rather than something we get
> from the environment, and we know it doesn't contain spaces.

I tend to just put "..." everywhere except in those rare cases where
I know I want the expansion to be split at spaces.

This way I don't need to worry about whether or not this is fully under
my control and whether I'm really sure it won't ever have a space in it.

Served me well so far,


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13078; Package emacs. (Wed, 05 Dec 2012 05:15:02 GMT) Full text and rfc822 format available.

Message #20 received at 13078 <at> debbugs.gnu.org (full text, mbox):

From: Josh <josh <at> foxtail.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 13078 <at> debbugs.gnu.org
Subject: Re: bug#13078: [PATCH] configure.ac: Cygwin build breaks when path to
	pkg-tool contains spaces
Date: Tue, 4 Dec 2012 21:13:47 -0800
On Tue, Dec 4, 2012 at 5:59 PM, Glenn Morris <rgm <at> gnu.org> wrote:
> Josh wrote:
>
>> but the build failed because ./configure was finding a version of
>> pkg-config whose path contained whitespace.  This exposed some quoting
>> problems in configure.ac, fixed in the patch below.
>
> Thanks, see comments below. (I wouldn't be surprised to learn that there
> are similar problems for other variables.)

Nor would I.  My patch addresses only the failure I encountered; it
might be worthwhile for someone more conversant with the build process
than I to investigate.




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Sun, 09 Dec 2012 02:29:01 GMT) Full text and rfc822 format available.

Notification sent to Josh <josh <at> foxtail.org>:
bug acknowledged by developer. (Sun, 09 Dec 2012 02:29:01 GMT) Full text and rfc822 format available.

Message #25 received at 13078-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: 13078-done <at> debbugs.gnu.org
Subject: Re: [PATCH] configure.ac: Cygwin build breaks when path to pkg-tool
	contains spaces
Date: Sat, 08 Dec 2012 18:28:15 -0800
I looked into problems in this area in configure.ac and
fixed all the ones mentioned so far in this bug report,
along with some others, in trunk bzr 111162.  No doubt
there are similar problems in other parts of Emacs,
but at least this bug report we can mark 'done' so I've done that.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13078; Package emacs. (Sun, 09 Dec 2012 04:15:01 GMT) Full text and rfc822 format available.

Message #28 received at 13078 <at> debbugs.gnu.org (full text, mbox):

From: Josh <josh <at> foxtail.org>
To: 13078 <at> debbugs.gnu.org, eggert <at> cs.ucla.edu, josh <at> foxtail.org
Cc: 13078-done <at> debbugs.gnu.org
Subject: Re: bug#13078: [PATCH] configure.ac: Cygwin build breaks when path to
	pkg-tool contains spaces
Date: Sat, 8 Dec 2012 20:14:03 -0800
Great, thanks for looking into it Paul.

Josh

On Sat, Dec 8, 2012 at 6:28 PM, Paul Eggert <eggert <at> cs.ucla.edu> wrote:
> I looked into problems in this area in configure.ac and
> fixed all the ones mentioned so far in this bug report,
> along with some others, in trunk bzr 111162.  No doubt
> there are similar problems in other parts of Emacs,
> but at least this bug report we can mark 'done' so I've done that.
>
>
>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13078; Package emacs. (Sun, 09 Dec 2012 04:15:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13078; Package emacs. (Sun, 09 Dec 2012 07:59:02 GMT) Full text and rfc822 format available.

Message #34 received at 13078 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: 13078 <at> debbugs.gnu.org
Cc: josh <at> foxtail.org, eggert <at> cs.ucla.edu
Subject: Re: bug#13078: [PATCH] configure.ac: Cygwin build breaks when path to
	pkg-tool contains spaces
Date: Sun, 09 Dec 2012 08:57:59 +0100
Paul Eggert <eggert <at> cs.ucla.edu> writes:

> I looked into problems in this area in configure.ac and
> fixed all the ones mentioned so far in this bug report,
> along with some others, in trunk bzr 111162.

This is wrong.  It must be possible to pass options in MAKEINFO and
PKG_CONFIG.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13078; Package emacs. (Sun, 09 Dec 2012 09:06:01 GMT) Full text and rfc822 format available.

Message #37 received at 13078 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: josh <at> foxtail.org, 13078 <at> debbugs.gnu.org
Subject: Re: bug#13078: [PATCH] configure.ac: Cygwin build breaks when path
	to pkg-tool contains spaces
Date: Sun, 09 Dec 2012 01:05:20 -0800
On 12/08/2012 11:57 PM, Andreas Schwab wrote:
> This is wrong.  It must be possible to pass options in MAKEINFO and
> PKG_CONFIG.

MAKEINFO perhaps (and I see that you already changed that back),
but PKG_CONFIG was already documented as being a file name, not
a command with arguments, so it seems more appropriate to quote it.
If we want to make it possible to pass options to PKG_CONFIG,
we could add another 'configure' option to do that.

Is it documented anywhere that Emacs cannot be built if
the working directory has spaces or other special characters
in its fully qualified file name?  If not, perhaps it should be.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13078; Package emacs. (Sun, 09 Dec 2012 11:54:02 GMT) Full text and rfc822 format available.

Message #40 received at 13078 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: josh <at> foxtail.org, 13078 <at> debbugs.gnu.org
Subject: Re: bug#13078: [PATCH] configure.ac: Cygwin build breaks when path to
	pkg-tool contains spaces
Date: Sun, 09 Dec 2012 12:53:10 +0100
Paul Eggert <eggert <at> cs.ucla.edu> writes:

> Is it documented anywhere that Emacs cannot be built if
> the working directory has spaces or other special characters
> in its fully qualified file name?

configure rejects them.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 06 Jan 2013 12:24:04 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 22 Oct 2013 01:15:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 19 Nov 2013 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 170 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.