public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug driver/107007] New: libiberty's win32_spawn error handling is poor
@ 2022-09-22 8:42 redi at gcc dot gnu.org
2022-10-24 15:22 ` [Bug driver/107007] " costas.argyris at gmail dot com
0 siblings, 1 reply; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2022-09-22 8:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107007
Bug ID: 107007
Summary: libiberty's win32_spawn error handling is poor
Product: gcc
Version: 12.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: driver
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
Host: *-*-mingw*
As described in
https://gcc.gnu.org/pipermail/gcc-help/2022-September/141906.html the
pex_win32_exec_child function just assumes that all errors are ENOENT:
/* Create the child process. */
pid = win32_spawn (executable, (flags & PEX_SEARCH) != 0,
argv, env, dwCreationFlags, &si, &pi);
if (pid == (pid_t) -1)
pid = spawn_script (executable, argv, env, dwCreationFlags,
&si, &pi);
if (pid == (pid_t) -1)
{
*err = ENOENT;
*errmsg = "CreateProcess";
}
This gives users incorrect information when something goes wrong for a reason
that isn't "No such file or directory".
Maybe win32_spawn should use the Win32 GetLastError() function to get a Windows
Error Code and then translate that to an errno value, and store it in errno. Or
ensure that GetLastError will still be valid for the caller of win32_spawn and
spawn_script to retrieve.
libstdc++-v3/src/c++11/system_error.cc already has code to do that translation
(so maybe it should move to libiberty, and then reuse that in libstdc++).
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-10-24 15:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-22 8:42 [Bug driver/107007] New: libiberty's win32_spawn error handling is poor redi at gcc dot gnu.org
2022-10-24 15:22 ` [Bug driver/107007] " costas.argyris at gmail dot com
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).