* Auto-load safe-path and auto-load scripts-directory on Windows
@ 2015-08-29 8:55 Eli Zaretskii
2015-08-29 9:51 ` Eli Zaretskii
` (2 more replies)
0 siblings, 3 replies; 16+ messages in thread
From: Eli Zaretskii @ 2015-08-29 8:55 UTC (permalink / raw)
To: gdb
I've noticed that the default values of these 2 path lists use ':' as
directory separator, even on MS-Windows. Isn't that a bug? (Does
anyone use these features on Windows? if so, how come no one noticed?)
Btw, the name of the variable "auto-load scripts-directory" is
misleading, as it really is a PATH-style list of directories, not a
single directory.
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: Auto-load safe-path and auto-load scripts-directory on Windows
2015-08-29 8:55 Auto-load safe-path and auto-load scripts-directory on Windows Eli Zaretskii
@ 2015-08-29 9:51 ` Eli Zaretskii
2015-08-29 11:27 ` Jan Kratochvil
2015-08-29 11:24 ` Jan Kratochvil
2015-09-19 22:33 ` asmwarrior
2 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2015-08-29 9:51 UTC (permalink / raw)
To: gdb
> Date: Sat, 29 Aug 2015 11:55:34 +0300
> From: Eli Zaretskii <eliz@gnu.org>
>
> I've noticed that the default values of these 2 path lists use ':' as
> directory separator, even on MS-Windows.
Also, trying to fix that by configuring with, e.g.
--with-auto-load-dir='$debugdir;$datadir/auto-load'
doesn't work, as the resulting binary only shows $debugdir in the
value. Evidently, the semi-colon and everything after it was
stripped, even though it was in '..' quotes. How can I provide a
Windows-style path with this configure-time option?
TIA
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Auto-load safe-path and auto-load scripts-directory on Windows
2015-08-29 9:51 ` Eli Zaretskii
@ 2015-08-29 11:27 ` Jan Kratochvil
2015-08-29 11:34 ` Eli Zaretskii
0 siblings, 1 reply; 16+ messages in thread
From: Jan Kratochvil @ 2015-08-29 11:27 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb
On Sat, 29 Aug 2015 11:51:48 +0200, Eli Zaretskii wrote:
> Also, trying to fix that by configuring with, e.g.
>
> --with-auto-load-dir='$debugdir;$datadir/auto-load'
>
> doesn't work, as the resulting binary only shows $debugdir in the
> value. Evidently, the semi-colon and everything after it was
> stripped, even though it was in '..' quotes. How can I provide a
> Windows-style path with this configure-time option?
Check first how it has been output to config.h's AUTO_LOAD_DIR.
Jan
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Auto-load safe-path and auto-load scripts-directory on Windows
2015-08-29 11:27 ` Jan Kratochvil
@ 2015-08-29 11:34 ` Eli Zaretskii
2015-08-29 11:44 ` Jan Kratochvil
0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2015-08-29 11:34 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb
> Date: Sat, 29 Aug 2015 13:27:13 +0200
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
> Cc: gdb@sourceware.org
>
> On Sat, 29 Aug 2015 11:51:48 +0200, Eli Zaretskii wrote:
> > Also, trying to fix that by configuring with, e.g.
> >
> > --with-auto-load-dir='$debugdir;$datadir/auto-load'
> >
> > doesn't work, as the resulting binary only shows $debugdir in the
> > value. Evidently, the semi-colon and everything after it was
> > stripped, even though it was in '..' quotes. How can I provide a
> > Windows-style path with this configure-time option?
>
> Check first how it has been output to config.h's AUTO_LOAD_DIR.
Like this:
/* Directories from which to load auto-loaded scripts. */
#define AUTO_LOAD_DIR "$debugdir"
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Auto-load safe-path and auto-load scripts-directory on Windows
2015-08-29 11:34 ` Eli Zaretskii
@ 2015-08-29 11:44 ` Jan Kratochvil
2015-08-29 13:00 ` Eli Zaretskii
0 siblings, 1 reply; 16+ messages in thread
From: Jan Kratochvil @ 2015-08-29 11:44 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb
On Sat, 29 Aug 2015 13:34:44 +0200, Eli Zaretskii wrote:
> Like this:
>
> /* Directories from which to load auto-loaded scripts. */
> #define AUTO_LOAD_DIR "$debugdir"
OK, so the bug is in configure.ac, if it is used in Mingw on MS-Windows (if
you use Mingw). I do not see what is wrong in configure.ac, MS-Windows host
maintainer should debug that.
Jan
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Auto-load safe-path and auto-load scripts-directory on Windows
2015-08-29 11:44 ` Jan Kratochvil
@ 2015-08-29 13:00 ` Eli Zaretskii
2015-10-10 1:29 ` asmwarrior
0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2015-08-29 13:00 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb
> Date: Sat, 29 Aug 2015 13:43:56 +0200
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
> Cc: gdb@sourceware.org
>
> On Sat, 29 Aug 2015 13:34:44 +0200, Eli Zaretskii wrote:
> > Like this:
> >
> > /* Directories from which to load auto-loaded scripts. */
> > #define AUTO_LOAD_DIR "$debugdir"
>
> OK, so the bug is in configure.ac, if it is used in Mingw on MS-Windows (if
> you use Mingw). I do not see what is wrong in configure.ac, MS-Windows host
> maintainer should debug that.
Thanks, I've filed bug reports for both problems.
https://sourceware.org/bugzilla/show_bug.cgi?id=18897
https://sourceware.org/bugzilla/show_bug.cgi?id=18898
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Auto-load safe-path and auto-load scripts-directory on Windows
2015-08-29 13:00 ` Eli Zaretskii
@ 2015-10-10 1:29 ` asmwarrior
2015-10-10 7:27 ` Eli Zaretskii
0 siblings, 1 reply; 16+ messages in thread
From: asmwarrior @ 2015-10-10 1:29 UTC (permalink / raw)
To: Eli Zaretskii, Jan Kratochvil; +Cc: gdb
On 2015-8-29 21:00, Eli Zaretskii wrote:
>> Date: Sat, 29 Aug 2015 13:43:56 +0200
>> From: Jan Kratochvil <jan.kratochvil@redhat.com>
>> Cc: gdb@sourceware.org
>>
>> On Sat, 29 Aug 2015 13:34:44 +0200, Eli Zaretskii wrote:
>>> Like this:
>>>
>>> /* Directories from which to load auto-loaded scripts. */
>>> #define AUTO_LOAD_DIR "$debugdir"
>>
>> OK, so the bug is in configure.ac, if it is used in Mingw on MS-Windows (if
>> you use Mingw). I do not see what is wrong in configure.ac, MS-Windows host
>> maintainer should debug that.
>
> Thanks, I've filed bug reports for both problems.
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=18897
> https://sourceware.org/bugzilla/show_bug.cgi?id=18898
>
Maybe, this discussion is related:
pkg-config wiki update and build problem - http://permalink.gmane.org/gmane.comp.gnu.mingw.msys/3822
Then, replace some text in the configure.ac:
AC_MSG_CHECKING([for default auto-load directory])
AC_ARG_WITH(auto-load-dir,
AS_HELP_STRING([--with-auto-load-dir=PATH],
[directories from which to load auto-loaded scripts @<:@$debugdir:$datadir/auto-load@:>@]),,
[with_auto_load_dir='$debugdir:$datadir/auto-load'])
escape_dir=`echo $with_auto_load_dir | sed 's/[[$]]\(datadir\|debugdir\)\>/\\\\\\\\\\\\&/g'`
AC_DEFINE_DIR(AUTO_LOAD_DIR, escape_dir,
[Directories from which to load auto-loaded scripts.])
AC_MSG_RESULT([$with_auto_load_dir])
Yuanhui Zhang
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Auto-load safe-path and auto-load scripts-directory on Windows
2015-10-10 1:29 ` asmwarrior
@ 2015-10-10 7:27 ` Eli Zaretskii
2015-10-10 13:13 ` asmwarrior
0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2015-10-10 7:27 UTC (permalink / raw)
To: asmwarrior; +Cc: jan.kratochvil, gdb
> Date: Sat, 10 Oct 2015 09:39:50 +0800
> From: asmwarrior <asmwarrior@gmail.com>
> CC: gdb@sourceware.org
>
> Maybe, this discussion is related:
> pkg-config wiki update and build problem - http://permalink.gmane.org/gmane.comp.gnu.mingw.msys/3822
That discussion is about a different problem, which we don't have in
GDB. In GDB, the relevant character, DIRNAME_SEPARATOR, is computed
at compile time (not at configure time) in gdb/common/host-defs.h.
> Then, replace some text in the configure.ac:
>
> AC_MSG_CHECKING([for default auto-load directory])
> AC_ARG_WITH(auto-load-dir,
> AS_HELP_STRING([--with-auto-load-dir=PATH],
> [directories from which to load auto-loaded scripts @<:@$debugdir:$datadir/auto-load@:>@]),,
> [with_auto_load_dir='$debugdir:$datadir/auto-load'])
> escape_dir=`echo $with_auto_load_dir | sed 's/[[$]]\(datadir\|debugdir\)\>/\\\\\\\\\\\\&/g'`
> AC_DEFINE_DIR(AUTO_LOAD_DIR, escape_dir,
> [Directories from which to load auto-loaded scripts.])
> AC_MSG_RESULT([$with_auto_load_dir])
Patches to configure.ac to fix this problem are welcome. I don't
think we need elaborate logic to compute the character, it's enough to
look at the host name.
Thanks.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Auto-load safe-path and auto-load scripts-directory on Windows
2015-10-10 7:27 ` Eli Zaretskii
@ 2015-10-10 13:13 ` asmwarrior
2015-10-10 13:17 ` Eli Zaretskii
0 siblings, 1 reply; 16+ messages in thread
From: asmwarrior @ 2015-10-10 13:13 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: jan.kratochvil, gdb
I did some test under msys(MSYS-20111123.zip)
Which comes from:
http://sourceforge.net/projects/mingw-w64/files/External%20binary%20packages%20%28Win64%20hosted%29/MSYS%20%2832-bit%29/MSYS-20111123.zip
The test code was just copied from "configure" and configure.ac" file:
--------------------
#!/bin/bash
with_auto_load_dir='$debugdir:$datadir/auto-load'
escape_dir=`echo $with_auto_load_dir | sed 's/[[$]]\(datadir\|debugdir\)\>/\\\\\\\\\\\\&/g'`
echo $escape_dir
ac_define_dir=`eval echo $escape_dir`
ac_define_dir=`eval echo $ac_define_dir`
echo $ac_defefine_dir
--------------------
The result is: $debugdir:$datadir/auto-load
This is the default value, and I have
/* Directories from which to load auto-loaded scripts. */
#define AUTO_LOAD_DIR "$debugdir:$datadir/auto-load"
in config.h
But if I change the line to: (note I use the semicolon)
with_auto_load_dir='$debugdir;$datadir/auto-load'
Then, I get an error:
$ ./mytest.sh
$debugdir;$datadir/auto-load
./mytest.sh: line 7: /auto-load: No such file or directory
So, it looks like an issue in the eval command?
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Auto-load safe-path and auto-load scripts-directory on Windows
2015-10-10 13:13 ` asmwarrior
@ 2015-10-10 13:17 ` Eli Zaretskii
2015-10-10 13:29 ` asmwarrior
2015-10-10 14:10 ` asmwarrior
0 siblings, 2 replies; 16+ messages in thread
From: Eli Zaretskii @ 2015-10-10 13:17 UTC (permalink / raw)
To: asmwarrior; +Cc: jan.kratochvil, gdb
> Date: Sat, 10 Oct 2015 21:24:45 +0800
> From: asmwarrior <asmwarrior@gmail.com>
> CC: jan.kratochvil@redhat.com, gdb@sourceware.org
>
> The result is: $debugdir:$datadir/auto-load
> This is the default value, and I have
>
> /* Directories from which to load auto-loaded scripts. */
> #define AUTO_LOAD_DIR "$debugdir:$datadir/auto-load"
>
> in config.h
>
> But if I change the line to: (note I use the semicolon)
> with_auto_load_dir='$debugdir;$datadir/auto-load'
>
> Then, I get an error:
> $ ./mytest.sh
> $debugdir;$datadir/auto-load
> ./mytest.sh: line 7: /auto-load: No such file or directory
>
> So, it looks like an issue in the eval command?
The semi-colon is a special character, you need to quote or escape it.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Auto-load safe-path and auto-load scripts-directory on Windows
2015-10-10 13:17 ` Eli Zaretskii
@ 2015-10-10 13:29 ` asmwarrior
2015-10-10 14:10 ` asmwarrior
1 sibling, 0 replies; 16+ messages in thread
From: asmwarrior @ 2015-10-10 13:29 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: jan.kratochvil, gdb
On 2015-10-10 21:17, Eli Zaretskii wrote:
>> Date: Sat, 10 Oct 2015 21:24:45 +0800
>> From: asmwarrior <asmwarrior@gmail.com>
>> CC: jan.kratochvil@redhat.com, gdb@sourceware.org
>>
>> The result is: $debugdir:$datadir/auto-load
>> This is the default value, and I have
>>
>> /* Directories from which to load auto-loaded scripts. */
>> #define AUTO_LOAD_DIR "$debugdir:$datadir/auto-load"
>>
>> in config.h
>>
>> But if I change the line to: (note I use the semicolon)
>> with_auto_load_dir='$debugdir;$datadir/auto-load'
>>
>> Then, I get an error:
>> $ ./mytest.sh
>> $debugdir;$datadir/auto-load
>> ./mytest.sh: line 7: /auto-load: No such file or directory
>>
>> So, it looks like an issue in the eval command?
>
> The semi-colon is a special character, you need to quote or escape it.
>
Yes, I see, thanks.
I'm not quite good at Bash programming(I'm a beginner), simple add a "\" before ";" doesn't solve the issue.
I don't have a way to solve this issue.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Auto-load safe-path and auto-load scripts-directory on Windows
2015-10-10 13:17 ` Eli Zaretskii
2015-10-10 13:29 ` asmwarrior
@ 2015-10-10 14:10 ` asmwarrior
1 sibling, 0 replies; 16+ messages in thread
From: asmwarrior @ 2015-10-10 14:10 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: jan.kratochvil, gdb
On 2015-10-10 21:17, Eli Zaretskii wrote:
>> Date: Sat, 10 Oct 2015 21:24:45 +0800
>> From: asmwarrior <asmwarrior@gmail.com>
>> CC: jan.kratochvil@redhat.com, gdb@sourceware.org
>>
>> The result is: $debugdir:$datadir/auto-load
>> This is the default value, and I have
>>
>> /* Directories from which to load auto-loaded scripts. */
>> #define AUTO_LOAD_DIR "$debugdir:$datadir/auto-load"
>>
>> in config.h
>>
>> But if I change the line to: (note I use the semicolon)
>> with_auto_load_dir='$debugdir;$datadir/auto-load'
>>
>> Then, I get an error:
>> $ ./mytest.sh
>> $debugdir;$datadir/auto-load
>> ./mytest.sh: line 7: /auto-load: No such file or directory
>>
>> So, it looks like an issue in the eval command?
>
> The semi-colon is a special character, you need to quote or escape it.
>
Sounds like this could at least print the ";" by adding two level escapes
------
#!/bin/bash
with_auto_load_dir='$debugdir\\\;$datadir/auto-load'
escape_dir=`echo $with_auto_load_dir | sed 's/[[$]]\(datadir\|debugdir\)\>/\\\\\\\\\\\\&/g'`
echo $escape_dir
ac_define_dir=`eval echo $escape_dir`
ac_define_dir=`eval echo $ac_define_dir`
echo $ac_define_dir
------
My previous example code has a typo, the last line should be "echo $ac_define_dir", not "echo $ac_defefine_dir"
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Auto-load safe-path and auto-load scripts-directory on Windows
2015-08-29 8:55 Auto-load safe-path and auto-load scripts-directory on Windows Eli Zaretskii
2015-08-29 9:51 ` Eli Zaretskii
@ 2015-08-29 11:24 ` Jan Kratochvil
2015-08-29 11:33 ` Eli Zaretskii
2015-09-19 22:33 ` asmwarrior
2 siblings, 1 reply; 16+ messages in thread
From: Jan Kratochvil @ 2015-08-29 11:24 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb
On Sat, 29 Aug 2015 10:55:34 +0200, Eli Zaretskii wrote:
> I've noticed that the default values of these 2 path lists use ':' as
> directory separator, even on MS-Windows. Isn't that a bug?
Yes, that seems a bug to me. I have no idea if configure is used for Mingw
and I guess ':' works for Cygwin. So I still do not see how to fix that.
> Btw, the name of the variable "auto-load scripts-directory" is
> misleading, as it really is a PATH-style list of directories, not a
> single directory.
In these cases I follow the rule:
https://stackoverflow.com/questions/338156/table-naming-dilemma-singular-vs-plural-names
Besides that for example 'set debug-file-directory' originally allowed only
one directory but for some years it allows a PATH-style list of directories.
Should it be therefore the old option name deprecated + renamed?
Jan
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Auto-load safe-path and auto-load scripts-directory on Windows
2015-08-29 11:24 ` Jan Kratochvil
@ 2015-08-29 11:33 ` Eli Zaretskii
0 siblings, 0 replies; 16+ messages in thread
From: Eli Zaretskii @ 2015-08-29 11:33 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb
> Date: Sat, 29 Aug 2015 13:24:36 +0200
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
> Cc: gdb@sourceware.org
>
> On Sat, 29 Aug 2015 10:55:34 +0200, Eli Zaretskii wrote:
> > I've noticed that the default values of these 2 path lists use ':' as
> > directory separator, even on MS-Windows. Isn't that a bug?
>
> Yes, that seems a bug to me. I have no idea if configure is used for Mingw
It is, of course. There's no other practical way of building GDB with
MinGW.
> and I guess ':' works for Cygwin. So I still do not see how to fix that.
Using a variable set from the host, instead of a literal colon, seems
like a starting point, no?
> Besides that for example 'set debug-file-directory' originally allowed only
> one directory but for some years it allows a PATH-style list of directories.
> Should it be therefore the old option name deprecated + renamed?
Preferably the options should be called "directories" or "path", not
"directory".
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Auto-load safe-path and auto-load scripts-directory on Windows
2015-08-29 8:55 Auto-load safe-path and auto-load scripts-directory on Windows Eli Zaretskii
2015-08-29 9:51 ` Eli Zaretskii
2015-08-29 11:24 ` Jan Kratochvil
@ 2015-09-19 22:33 ` asmwarrior
2015-09-20 6:13 ` Eli Zaretskii
2 siblings, 1 reply; 16+ messages in thread
From: asmwarrior @ 2015-09-19 22:33 UTC (permalink / raw)
To: Eli Zaretskii, gdb
On 2015-8-29 16:55, Eli Zaretskii wrote:
> I've noticed that the default values of these 2 path lists use ':' as
> directory separator, even on MS-Windows. Isn't that a bug? (Does
> anyone use these features on Windows? if so, how come no one noticed?)
>
When I start GDB on windows, I pass this argument:
-iex "set auto-load safe-path /"
This enable Auto-load safe-path to every directories. This is not quite safe, but it works.
Yuanhui Zhang
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Auto-load safe-path and auto-load scripts-directory on Windows
2015-09-19 22:33 ` asmwarrior
@ 2015-09-20 6:13 ` Eli Zaretskii
0 siblings, 0 replies; 16+ messages in thread
From: Eli Zaretskii @ 2015-09-20 6:13 UTC (permalink / raw)
To: asmwarrior; +Cc: gdb
> Date: Sun, 20 Sep 2015 06:43:38 +0800
> From: asmwarrior <asmwarrior@gmail.com>
>
> On 2015-8-29 16:55, Eli Zaretskii wrote:
> > I've noticed that the default values of these 2 path lists use ':' as
> > directory separator, even on MS-Windows. Isn't that a bug? (Does
> > anyone use these features on Windows? if so, how come no one noticed?)
> >
>
> When I start GDB on windows, I pass this argument:
> -iex "set auto-load safe-path /"
(You can have that in your ~/.gdbinit instead, then you won't need to
specify this argument on every invocation of GDB.)
> This enable Auto-load safe-path to every directories. This is not quite safe, but it works.
As long as auto-load safe-path includes a single directory on the
current drive, be it "/" or anything else, you can get away with this
bug. But once you really want a list of directories, or a directory
on a specific drive, you are toast: the feature becomes broken.
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2015-10-10 14:10 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-29 8:55 Auto-load safe-path and auto-load scripts-directory on Windows Eli Zaretskii
2015-08-29 9:51 ` Eli Zaretskii
2015-08-29 11:27 ` Jan Kratochvil
2015-08-29 11:34 ` Eli Zaretskii
2015-08-29 11:44 ` Jan Kratochvil
2015-08-29 13:00 ` Eli Zaretskii
2015-10-10 1:29 ` asmwarrior
2015-10-10 7:27 ` Eli Zaretskii
2015-10-10 13:13 ` asmwarrior
2015-10-10 13:17 ` Eli Zaretskii
2015-10-10 13:29 ` asmwarrior
2015-10-10 14:10 ` asmwarrior
2015-08-29 11:24 ` Jan Kratochvil
2015-08-29 11:33 ` Eli Zaretskii
2015-09-19 22:33 ` asmwarrior
2015-09-20 6:13 ` Eli Zaretskii
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox