From: "Björn Schäpers" <gcc@hazardy.de>
To: Eli Zaretskii <eliz@gnu.org>, Ian Lance Taylor <iant@golang.org>
Cc: gcc-patches@gcc.gnu.org, gcc@gcc.gnu.org
Subject: Re: [PATCH 2/4] libbacktrace: detect executable path on windows
Date: Tue, 24 Jan 2023 22:00:21 +0100 [thread overview]
Message-ID: <ecdc8709-84ad-90fd-bf7e-f01bb610869c@hazardy.de> (raw)
In-Reply-To: <83o7qnho2o.fsf@gnu.org>
Am 24.01.2023 um 17:52 schrieb Eli Zaretskii:
>> From: Ian Lance Taylor <iant@golang.org>
>> Date: Tue, 24 Jan 2023 06:35:21 -0800
>> Cc: gcc@hazardy.de, gcc-patches@gcc.gnu.org, gcc@gcc.gnu.org
>>
>>>> On Windows it seems that MAX_PATH is not
>>>> a true limit, as an extended length path may be up to 32767 bytes.
>>>
>>> The limit of 32767 characters (not bytes, AFAIK) is only applicable
>>> when using the Unicode (a.k.a. "wide") versions of the Windows Win32
>>> APIs, see
>>>
>>> https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation
>>>
>>> Since the above code uses GetModuleFileNameA, which is an "ANSI"
>>> single-byte API, it is still subject to the MAX_PATH limitation, and
>>> MAX_PATH is defined as 260 on Windows headers.
>>
>> Thanks. Should this code be using GetModuleFileNameW? Or would that
>> mean that the later call to open will fail?
>
> We'd need to use _wopen or somesuch, and the file name will have to be
> a wchar_t array, not a char array, yes. So this is not very practical
> when file names need to be passed between functions, unless they are
> converted to UTF-8 (and back again before using them in Windows APIs).
>
> And note that even then, the 260-byte limit could be lifted only if
> the user has a new enough Windows version _and_ has opted in to the
> long-name feature by turning it on in the Registry. Otherwise, file
> names used in "wide" APIs can only break the 260-byte limit if they
> use the special format "\\?\D:\foo\bar", which means file names
> specified by user outside of the program or file names that come from
> other programs will need to be reformatted to this special format.
>
>> 260 bytes does not seem like very much for a path name these days.
>
> That's true. But complications with using longer file names are still
> a PITA on Windows, even though they are a step closer to practically
> possible.
That was basically also my reasoning for choosing the A variant instead of W.
next prev parent reply other threads:[~2023-01-24 21:00 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-20 10:54 [PATCH 1/4] libbacktrace: change all pc related variables to uintptr_t Björn Schäpers
2023-01-20 10:54 ` [PATCH 2/4] libbacktrace: detect executable path on windows Björn Schäpers
2023-01-23 23:00 ` Ian Lance Taylor
2023-01-24 13:11 ` Eli Zaretskii
2023-01-24 14:35 ` Ian Lance Taylor
2023-01-24 16:52 ` Eli Zaretskii
2023-01-24 17:58 ` Ian Lance Taylor
2023-01-24 18:11 ` Eli Zaretskii
2023-01-24 18:32 ` Ian Lance Taylor
2023-02-05 9:20 ` Björn Schäpers
2023-02-06 0:22 ` Ian Lance Taylor
2023-11-20 19:56 ` Björn Schäpers
2023-11-29 22:05 ` Ian Lance Taylor
2023-01-24 21:00 ` Björn Schäpers [this message]
2023-01-20 10:54 ` [PATCH 3/4] libbacktrace: work with aslr " Björn Schäpers
2023-01-20 13:39 ` Eli Zaretskii
2023-01-20 16:46 ` Gabriel Ravier
2023-01-20 19:19 ` Eli Zaretskii
2023-01-20 20:39 ` Gabriel Ravier
2023-01-21 4:05 ` Eli Zaretskii
2023-01-21 9:18 ` LIU Hao
2023-01-21 9:25 ` Eli Zaretskii
2023-01-21 10:47 ` Gabriel Ravier
2023-01-21 11:42 ` Eli Zaretskii
2023-11-20 19:57 ` Björn Schäpers
2023-11-20 20:07 ` Eli Zaretskii
2023-11-21 19:35 ` Björn Schäpers
2023-11-22 1:13 ` LIU Hao
2023-11-30 19:25 ` Ian Lance Taylor
2023-01-20 10:54 ` [PATCH 4/4] libbacktrace: get debug information for loaded dlls Björn Schäpers
2023-11-30 19:53 ` Ian Lance Taylor
2023-11-30 20:16 ` Eli Zaretskii
2024-01-02 23:12 ` Björn Schäpers
2024-01-04 22:33 ` [PATCH 5/4] libbacktrace: improve getting " Björn Schäpers
2024-01-06 22:15 ` [PATCH 6/4] libbacktrace: Add loaded dlls after initialize Björn Schäpers
2024-01-07 6:50 ` Eli Zaretskii
[not found] ` <4cb3a2a5-c0b3-40c8-b460-f21d65a9aea2@hazardy.de>
2024-01-07 14:46 ` Eli Zaretskii
2024-01-07 16:07 ` Björn Schäpers
2024-01-07 17:03 ` Eli Zaretskii
2024-01-09 20:02 ` Björn Schäpers
2024-01-10 12:34 ` Eli Zaretskii
2024-03-15 20:41 ` Björn Schäpers
2024-01-23 22:37 ` [PATCH 5/4] libbacktrace: improve getting debug information for loaded dlls Ian Lance Taylor
2024-01-25 19:53 ` Björn Schäpers
2024-01-25 22:04 ` Ian Lance Taylor
2024-03-15 20:40 ` Björn Schäpers
2024-04-25 20:14 ` Björn Schäpers
2024-04-28 18:16 ` Ian Lance Taylor
2024-05-02 19:23 ` Björn Schäpers
2024-05-03 22:27 ` Ian Lance Taylor
2024-01-23 21:24 ` [PATCH 4/4] libbacktrace: get " Björn Schäpers
2023-01-20 22:25 ` [PATCH 1/4] libbacktrace: change all pc related variables to uintptr_t Ian Lance Taylor
2023-01-23 20:17 ` Björn Schäpers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ecdc8709-84ad-90fd-bf7e-f01bb610869c@hazardy.de \
--to=gcc@hazardy.de \
--cc=eliz@gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=gcc@gcc.gnu.org \
--cc=iant@golang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).