* File-name completer marks all files as executable on MS-Windows
@ 2014-12-27 19:13 Eli Zaretskii
2014-12-27 22:00 ` Andrew Pinski
2014-12-29 15:38 ` Chet Ramey
0 siblings, 2 replies; 9+ messages in thread
From: Eli Zaretskii @ 2014-12-27 19:13 UTC (permalink / raw)
To: Chet Ramey; +Cc: gdb-patches
I discovered that completing on file names in GDB on MS-Windows marks
every file as executable. This is because Readline uses 'access' and
X_OK to determine that, which doesn't work on Windows.
Suggested patch is below.
2014-12-27 Eli Zaretskii <eliz@gnu.org>
* complete.c (stat_char) [_WIN32]: Don't use 'access' and X_OK on
Windows, they don't work. Instead, look at the file-name
extension to determine whether the file is executable.
--- readline/complete.c~0 2014-06-11 19:34:41.000000000 +0300
+++ readline/complete.c 2014-12-27 21:06:38.255053100 +0200
@@ -598,8 +598,21 @@ stat_char (filename)
#endif
else if (S_ISREG (finfo.st_mode))
{
+#if defined (_WIN32) && !defined (__CYGWIN__)
+ /* Windows 'access' doesn't support X_OK and on latest Windows
+ versions even invokes an invalid parameter exception. */
+ char *ext = strrchr (filename, '.');
+
+ if (ext
+ && (_rl_stricmp (ext, ".exe") == 0
+ || _rl_stricmp (ext, ".cmd") == 0
+ || _rl_stricmp (ext, ".bat") == 0
+ || _rl_stricmp (ext, ".com") == 0))
+ character = '*';
+#else
if (access (filename, X_OK) == 0)
character = '*';
+#endif
}
return (character);
}
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: File-name completer marks all files as executable on MS-Windows
2014-12-27 19:13 File-name completer marks all files as executable on MS-Windows Eli Zaretskii
@ 2014-12-27 22:00 ` Andrew Pinski
2014-12-28 3:38 ` Eli Zaretskii
2014-12-29 15:38 ` Chet Ramey
1 sibling, 1 reply; 9+ messages in thread
From: Andrew Pinski @ 2014-12-27 22:00 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Chet Ramey, gdb-patches
On Sat, Dec 27, 2014 at 11:13 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> I discovered that completing on file names in GDB on MS-Windows marks
> every file as executable. This is because Readline uses 'access' and
> X_OK to determine that, which doesn't work on Windows.
>
> Suggested patch is below.
Has this gone upstream to readline? Maybe it should go upstream first.
Thanks,
Andrew Pinski
>
> 2014-12-27 Eli Zaretskii <eliz@gnu.org>
>
> * complete.c (stat_char) [_WIN32]: Don't use 'access' and X_OK on
> Windows, they don't work. Instead, look at the file-name
> extension to determine whether the file is executable.
>
> --- readline/complete.c~0 2014-06-11 19:34:41.000000000 +0300
> +++ readline/complete.c 2014-12-27 21:06:38.255053100 +0200
> @@ -598,8 +598,21 @@ stat_char (filename)
> #endif
> else if (S_ISREG (finfo.st_mode))
> {
> +#if defined (_WIN32) && !defined (__CYGWIN__)
> + /* Windows 'access' doesn't support X_OK and on latest Windows
> + versions even invokes an invalid parameter exception. */
> + char *ext = strrchr (filename, '.');
> +
> + if (ext
> + && (_rl_stricmp (ext, ".exe") == 0
> + || _rl_stricmp (ext, ".cmd") == 0
> + || _rl_stricmp (ext, ".bat") == 0
> + || _rl_stricmp (ext, ".com") == 0))
> + character = '*';
> +#else
> if (access (filename, X_OK) == 0)
> character = '*';
> +#endif
> }
> return (character);
> }
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: File-name completer marks all files as executable on MS-Windows
2014-12-27 22:00 ` Andrew Pinski
@ 2014-12-28 3:38 ` Eli Zaretskii
0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2014-12-28 3:38 UTC (permalink / raw)
To: Andrew Pinski; +Cc: chet.ramey, gdb-patches
> Date: Sat, 27 Dec 2014 14:00:45 -0800
> From: Andrew Pinski <pinskia@gmail.com>
> Cc: Chet Ramey <chet.ramey@case.edu>,
> "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
>
> On Sat, Dec 27, 2014 at 11:13 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> > I discovered that completing on file names in GDB on MS-Windows marks
> > every file as executable. This is because Readline uses 'access' and
> > X_OK to determine that, which doesn't work on Windows.
> >
> > Suggested patch is below.
>
> Has this gone upstream to readline? Maybe it should go upstream first.
That's why I CC'ed Chet.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: File-name completer marks all files as executable on MS-Windows
2014-12-27 19:13 File-name completer marks all files as executable on MS-Windows Eli Zaretskii
2014-12-27 22:00 ` Andrew Pinski
@ 2014-12-29 15:38 ` Chet Ramey
2014-12-29 16:22 ` Eli Zaretskii
1 sibling, 1 reply; 9+ messages in thread
From: Chet Ramey @ 2014-12-29 15:38 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: chet.ramey, gdb-patches
On 12/27/14 2:13 PM, Eli Zaretskii wrote:
> I discovered that completing on file names in GDB on MS-Windows marks
> every file as executable. This is because Readline uses 'access' and
> X_OK to determine that, which doesn't work on Windows.
Ugh, really? Thanks for the patch.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: File-name completer marks all files as executable on MS-Windows
2014-12-29 15:38 ` Chet Ramey
@ 2014-12-29 16:22 ` Eli Zaretskii
2014-12-29 16:46 ` Chet Ramey
2014-12-29 19:00 ` Pedro Alves
0 siblings, 2 replies; 9+ messages in thread
From: Eli Zaretskii @ 2014-12-29 16:22 UTC (permalink / raw)
To: chet.ramey; +Cc: gdb-patches
> Date: Mon, 29 Dec 2014 10:38:45 -0500
> From: Chet Ramey <chet.ramey@case.edu>
> CC: chet.ramey@case.edu, gdb-patches@sourceware.org
>
> On 12/27/14 2:13 PM, Eli Zaretskii wrote:
> > I discovered that completing on file names in GDB on MS-Windows marks
> > every file as executable. This is because Readline uses 'access' and
> > X_OK to determine that, which doesn't work on Windows.
>
> Ugh, really? Thanks for the patch.
Thanks for reviewing it.
Joel, Pedro, others: can I now commit this to the GDB repository?
Branch too?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: File-name completer marks all files as executable on MS-Windows
2014-12-29 16:22 ` Eli Zaretskii
@ 2014-12-29 16:46 ` Chet Ramey
2014-12-29 17:34 ` Eli Zaretskii
2014-12-29 19:00 ` Pedro Alves
1 sibling, 1 reply; 9+ messages in thread
From: Chet Ramey @ 2014-12-29 16:46 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: chet.ramey, gdb-patches
On 12/29/14 11:22 AM, Eli Zaretskii wrote:
>> Date: Mon, 29 Dec 2014 10:38:45 -0500
>> From: Chet Ramey <chet.ramey@case.edu>
>> CC: chet.ramey@case.edu, gdb-patches@sourceware.org
>>
>> On 12/27/14 2:13 PM, Eli Zaretskii wrote:
>>> I discovered that completing on file names in GDB on MS-Windows marks
>>> every file as executable. This is because Readline uses 'access' and
>>> X_OK to determine that, which doesn't work on Windows.
>>
>> Ugh, really? Thanks for the patch.
>
> Thanks for reviewing it.
>
> Joel, Pedro, others: can I now commit this to the GDB repository?
I am not certain of the exact vintage of the copy of readline in the GDB
repository, but you should probably audit it and see whether or not this
patch should use `fn' instead of `filename'.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: File-name completer marks all files as executable on MS-Windows
2014-12-29 16:46 ` Chet Ramey
@ 2014-12-29 17:34 ` Eli Zaretskii
0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2014-12-29 17:34 UTC (permalink / raw)
To: chet.ramey; +Cc: gdb-patches
> Date: Mon, 29 Dec 2014 11:46:48 -0500
> From: Chet Ramey <chet.ramey@case.edu>
> CC: chet.ramey@case.edu, gdb-patches@sourceware.org
>
> I am not certain of the exact vintage of the copy of readline in the GDB
> repository, but you should probably audit it and see whether or not this
> patch should use `fn' instead of `filename'.
OK, will do. Thanks.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: File-name completer marks all files as executable on MS-Windows
2014-12-29 16:22 ` Eli Zaretskii
2014-12-29 16:46 ` Chet Ramey
@ 2014-12-29 19:00 ` Pedro Alves
2014-12-30 19:30 ` Eli Zaretskii
1 sibling, 1 reply; 9+ messages in thread
From: Pedro Alves @ 2014-12-29 19:00 UTC (permalink / raw)
To: Eli Zaretskii, chet.ramey; +Cc: gdb-patches
On 12/29/2014 04:22 PM, Eli Zaretskii wrote:
>> Date: Mon, 29 Dec 2014 10:38:45 -0500
>> From: Chet Ramey <chet.ramey@case.edu>
>> CC: chet.ramey@case.edu, gdb-patches@sourceware.org
>>
>> On 12/27/14 2:13 PM, Eli Zaretskii wrote:
>>> I discovered that completing on file names in GDB on MS-Windows marks
>>> every file as executable. This is because Readline uses 'access' and
>>> X_OK to determine that, which doesn't work on Windows.
>>
>> Ugh, really? Thanks for the patch.
>
> Thanks for reviewing it.
>
> Joel, Pedro, others: can I now commit this to the GDB repository?
> Branch too?
Fine with me.
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: File-name completer marks all files as executable on MS-Windows
2014-12-29 19:00 ` Pedro Alves
@ 2014-12-30 19:30 ` Eli Zaretskii
0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2014-12-30 19:30 UTC (permalink / raw)
To: Pedro Alves; +Cc: chet.ramey, gdb-patches
> Date: Mon, 29 Dec 2014 18:59:48 +0000
> From: Pedro Alves <palves@redhat.com>
> CC: gdb-patches@sourceware.org
>
> On 12/29/2014 04:22 PM, Eli Zaretskii wrote:
> >> Date: Mon, 29 Dec 2014 10:38:45 -0500
> >> From: Chet Ramey <chet.ramey@case.edu>
> >> CC: chet.ramey@case.edu, gdb-patches@sourceware.org
> >>
> >> On 12/27/14 2:13 PM, Eli Zaretskii wrote:
> >>> I discovered that completing on file names in GDB on MS-Windows marks
> >>> every file as executable. This is because Readline uses 'access' and
> >>> X_OK to determine that, which doesn't work on Windows.
> >>
> >> Ugh, really? Thanks for the patch.
> >
> > Thanks for reviewing it.
> >
> > Joel, Pedro, others: can I now commit this to the GDB repository?
> > Branch too?
>
> Fine with me.
Thanks, done.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-12-30 19:30 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-27 19:13 File-name completer marks all files as executable on MS-Windows Eli Zaretskii
2014-12-27 22:00 ` Andrew Pinski
2014-12-28 3:38 ` Eli Zaretskii
2014-12-29 15:38 ` Chet Ramey
2014-12-29 16:22 ` Eli Zaretskii
2014-12-29 16:46 ` Chet Ramey
2014-12-29 17:34 ` Eli Zaretskii
2014-12-29 19:00 ` Pedro Alves
2014-12-30 19:30 ` Eli Zaretskii
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).