Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* GDB 7.4 --with-python doesn't like d:/foo/bar
@ 2012-01-26  7:31 Eli Zaretskii
  2012-01-27  5:34 ` Joel Brobecker
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2012-01-26  7:31 UTC (permalink / raw)
  To: gdb-patches

GDB 7.4 cannot be configured using --with-python-d:/foo/bar on
MS-Windows.  The gdb/configure script aborts with an error message:

  checking whether to use python... d:/usr/python26
  configure: error: invalid value for --with-python

The culprit is this snippet from gdb/configure.ac:

  if test "${with_python}" = no; then
    AC_MSG_WARN([python support disabled; some features may be unavailable.])
    have_libpython=no
  else
    case "${with_python}" in
    /*)   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
      if test -d ${with_python}; then
	# Assume the python binary is ${with_python}/bin/python.
	python_prog="${with_python}/bin/python"
	python_prefix=
	# If python does not exit ${with_python}/bin, then try in
	# ${with_python}.  On Windows/MinGW, this is where the Python
	# executable is.
	if test ! -x "${python_prog}"; then
	  python_prog="${with_python}/python"
	  python_prefix=
	fi
	if test ! -x "${python_prog}"; then
	  # Fall back to gdb 7.0/7.1 behaviour.
	  python_prog=missing
	  python_prefix=${with_python}
	fi
      elif test -x "${with_python}"; then
	# While we can't run python compiled for $host (unless host == build),
	# the user could write a script that provides the needed information,
	# so we support that.
	python_prog=${with_python}
	python_prefix=
      else
	AC_ERROR(invalid value for --with-python)
      fi
      ;;

As can be clearly seen, it only accepts absolute file names that begin
with a forward slash.

I don't have Autoconf installed on the Windows/MinGW machine where I
did this (thus no patch), so I manually edited gdb/configure to
replace the line marked above with

 [\\/]* | [A-Za-z]:[\\/]*)

Then the configure and build steps ran successfully to completion.

Since (AFAIK) [] is a quote sequence in Autoconf, could someone please
make the appropriate change in configure.ac to fix this?

TIA


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: GDB 7.4 --with-python doesn't like d:/foo/bar
  2012-01-26  7:31 GDB 7.4 --with-python doesn't like d:/foo/bar Eli Zaretskii
@ 2012-01-27  5:34 ` Joel Brobecker
  2012-01-27 10:02   ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Joel Brobecker @ 2012-01-27  5:34 UTC (permalink / raw)
  To: dje; +Cc: gdb-patches, eliz

[-- Attachment #1: Type: text/plain, Size: 1809 bytes --]

Hi Doug,

> GDB 7.4 cannot be configured using --with-python-d:/foo/bar on
> MS-Windows.  The gdb/configure script aborts with an error message:
> 
>   checking whether to use python... d:/usr/python26
>   configure: error: invalid value for --with-python
> 
> The culprit is this snippet from gdb/configure.ac:
> 
>   if test "${with_python}" = no; then
>     AC_MSG_WARN([python support disabled; some features may be unavailable.])
>     have_libpython=no
>   else
>     case "${with_python}" in
>     /*)   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>       if test -d ${with_python}; then
> 	# Assume the python binary is ${with_python}/bin/python.
[...]
> As can be clearly seen, it only accepts absolute file names that begin
> with a forward slash.
> 
> I don't have Autoconf installed on the Windows/MinGW machine where I
> did this (thus no patch), so I manually edited gdb/configure to
> replace the line marked above with
> 
>  [\\/]* | [A-Za-z]:[\\/]*)
> 
> Then the configure and build steps ran successfully to completion.
> 
> Since (AFAIK) [] is a quote sequence in Autoconf, could someone please
> make the appropriate change in configure.ac to fix this?

I can make the change for Eli sometime this weekend. Would it be OK
with you?

To me, the change would not be completely correct on Unix hosts,
but I think that the chances of someone calling a local directory
a single-letter followed by a colon are very small. So I think
it's OK.

I changed the expressions a bit replacing "[\\/]*" back into just "/"
as originally used. Eli, would that still work for you?

gdb/ChangeLog:

        * configure.ac (--with-python): Directory names starting
        with a letter followed by a colon are treated as non-relative.

Not tested yet (that part will have to wait for the weekend).

-- 
Joel

[-- Attachment #2: config-python-windows.diff --]
[-- Type: text/x-diff, Size: 413 bytes --]

diff --git a/gdb/configure.ac b/gdb/configure.ac
index 6f9a42c..2154574 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -734,7 +734,7 @@ if test "${with_python}" = no; then
   have_libpython=no
 else
   case "${with_python}" in
-  /*)
+  /* | [A-Za-z]:/* )
     if test -d ${with_python}; then
       # Assume the python binary is ${with_python}/bin/python.
       python_prog="${with_python}/bin/python"

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: GDB 7.4 --with-python doesn't like d:/foo/bar
  2012-01-27  5:34 ` Joel Brobecker
@ 2012-01-27 10:02   ` Eli Zaretskii
  2012-01-27 11:49     ` Joel Brobecker
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2012-01-27 10:02 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: dje, gdb-patches

> Date: Fri, 27 Jan 2012 09:25:15 +0400
> From: Joel Brobecker <brobecker@adacore.com>
> Cc: gdb-patches@sourceware.org, eliz@gnu.org
> 
> To me, the change would not be completely correct on Unix hosts,
> but I think that the chances of someone calling a local directory
> a single-letter followed by a colon are very small. So I think
> it's OK.

This is a standard way of Autoconf's catering to DOS and Windows
platforms.  You can see it at work elsewhere in the configure script,
because it's part of AC_PROG_PATH.  In fact, you can find it just a
few lines below the test that failed.

> I changed the expressions a bit replacing "[\\/]*" back into just "/"
> as originally used. Eli, would that still work for you?

Again, I think consistency with AC_PROG_PATH is better, even though a
case of a single backslash starting an absolute file name on Windows
is extremely rare.

Thanks.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: GDB 7.4 --with-python doesn't like d:/foo/bar
  2012-01-27 10:02   ` Eli Zaretskii
@ 2012-01-27 11:49     ` Joel Brobecker
  2012-01-27 19:01       ` Doug Evans
  0 siblings, 1 reply; 6+ messages in thread
From: Joel Brobecker @ 2012-01-27 11:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: dje, gdb-patches

> This is a standard way of Autoconf's catering to DOS and Windows
> platforms.  You can see it at work elsewhere in the configure script,
> because it's part of AC_PROG_PATH.  In fact, you can find it just a
> few lines below the test that failed.

You're right. I wasn't thinking clearly in the morning. For some
reason, I was seeing both expressions as equivalent, when clearly
they are not! So your proposed change is on the table instead.

-- 
Joel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: GDB 7.4 --with-python doesn't like d:/foo/bar
  2012-01-27 11:49     ` Joel Brobecker
@ 2012-01-27 19:01       ` Doug Evans
  2012-01-27 20:32         ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Doug Evans @ 2012-01-27 19:01 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Eli Zaretskii, gdb-patches

On Fri, Jan 27, 2012 at 2:28 AM, Joel Brobecker <brobecker@adacore.com> wrote:
>> This is a standard way of Autoconf's catering to DOS and Windows
>> platforms.  You can see it at work elsewhere in the configure script,
>> because it's part of AC_PROG_PATH.  In fact, you can find it just a
>> few lines below the test that failed.
>
> You're right. I wasn't thinking clearly in the morning. For some
> reason, I was seeing both expressions as equivalent, when clearly
> they are not! So your proposed change is on the table instead.

Hi.
I copied over the same test that autoconf uses and committed that.
[ref: autoconf 2.64, programs.m4, _AC_PATH_PROG]
Tested with an absolute path on amd64-linux.


2012-01-27  Doug Evans  <dje@google.com>

        * configure.ac (with_python): Fix absolute path handling for win32.
        * configure: Regenerate.

Index: configure
===================================================================
RCS file: /cvs/src/src/gdb/configure,v
retrieving revision 1.341
diff -u -p -r1.341 configure
--- configure   20 Jan 2012 09:47:32 -0000      1.341
+++ configure   27 Jan 2012 18:20:21 -0000
@@ -10814,7 +10814,7 @@ $as_echo "$as_me: WARNING: python suppor
   have_libpython=no
 else
   case "${with_python}" in
-  /*)
+  [\\/]* | ?:[\\/]*)
     if test -d ${with_python}; then
       # Assume the python binary is ${with_python}/bin/python.
       python_prog="${with_python}/bin/python"
Index: configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/configure.ac,v
retrieving revision 1.156
diff -u -p -r1.156 configure.ac
--- configure.ac        20 Jan 2012 09:47:32 -0000      1.156
+++ configure.ac        27 Jan 2012 18:20:21 -0000
@@ -734,7 +734,7 @@ if test "${with_python}" = no; then
   have_libpython=no
 else
   case "${with_python}" in
-  /*)
+  [[\\/]]* | ?:[[\\/]]*)
     if test -d ${with_python}; then
       # Assume the python binary is ${with_python}/bin/python.
       python_prog="${with_python}/bin/python"


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: GDB 7.4 --with-python doesn't like d:/foo/bar
  2012-01-27 19:01       ` Doug Evans
@ 2012-01-27 20:32         ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2012-01-27 20:32 UTC (permalink / raw)
  To: Doug Evans; +Cc: brobecker, gdb-patches

> Date: Fri, 27 Jan 2012 10:26:59 -0800
> From: Doug Evans <dje@google.com>
> Cc: Eli Zaretskii <eliz@gnu.org>, gdb-patches@sourceware.org
> 
> I copied over the same test that autoconf uses and committed that.
> [ref: autoconf 2.64, programs.m4, _AC_PATH_PROG]

Thanks!


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-01-27 20:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-26  7:31 GDB 7.4 --with-python doesn't like d:/foo/bar Eli Zaretskii
2012-01-27  5:34 ` Joel Brobecker
2012-01-27 10:02   ` Eli Zaretskii
2012-01-27 11:49     ` Joel Brobecker
2012-01-27 19:01       ` Doug Evans
2012-01-27 20:32         ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox