public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug driver/86030] specs file processing does not create response files for input directories
       [not found] <bug-86030-4@http.gcc.gnu.org/bugzilla/>
@ 2021-05-19 10:43 ` redi at gcc dot gnu.org
  2023-06-14 18:27 ` costas.argyris at gmail dot com
                   ` (15 subsequent siblings)
  16 siblings, 0 replies; 17+ messages in thread
From: redi at gcc dot gnu.org @ 2021-05-19 10:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86030

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2018-07-02 00:00:00         |2021-5-19

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This is still a problem today: https://github.com/envoyproxy/envoy/issues/16196

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

* [Bug driver/86030] specs file processing does not create response files for input directories
       [not found] <bug-86030-4@http.gcc.gnu.org/bugzilla/>
  2021-05-19 10:43 ` [Bug driver/86030] specs file processing does not create response files for input directories redi at gcc dot gnu.org
@ 2023-06-14 18:27 ` costas.argyris at gmail dot com
  2023-09-09 16:17 ` john.soo+gcc-bugzilla at arista dot com
                   ` (14 subsequent siblings)
  16 siblings, 0 replies; 17+ messages in thread
From: costas.argyris at gmail dot com @ 2023-06-14 18:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86030

Costas Argyris <costas.argyris at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |costas.argyris at gmail dot com

--- Comment #5 from Costas Argyris <costas.argyris at gmail dot com> ---
Very likely fixed by

https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=180ebb8a24d24fc5b105f2257d6216f6dfde62df

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

* [Bug driver/86030] specs file processing does not create response files for input directories
       [not found] <bug-86030-4@http.gcc.gnu.org/bugzilla/>
  2021-05-19 10:43 ` [Bug driver/86030] specs file processing does not create response files for input directories redi at gcc dot gnu.org
  2023-06-14 18:27 ` costas.argyris at gmail dot com
@ 2023-09-09 16:17 ` john.soo+gcc-bugzilla at arista dot com
  2023-09-09 16:35 ` costas.argyris at gmail dot com
                   ` (13 subsequent siblings)
  16 siblings, 0 replies; 17+ messages in thread
From: john.soo+gcc-bugzilla at arista dot com @ 2023-09-09 16:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86030

John Soo <john.soo+gcc-bugzilla at arista dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |john.soo+gcc-bugzilla@arist
                   |                            |a.com

--- Comment #6 from John Soo <john.soo+gcc-bugzilla at arista dot com> ---
This is not a Windows-only bug, so I don't think it is fixed.

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

* [Bug driver/86030] specs file processing does not create response files for input directories
       [not found] <bug-86030-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2023-09-09 16:17 ` john.soo+gcc-bugzilla at arista dot com
@ 2023-09-09 16:35 ` costas.argyris at gmail dot com
  2023-09-09 19:59 ` john.soo+gcc-bugzilla at arista dot com
                   ` (12 subsequent siblings)
  16 siblings, 0 replies; 17+ messages in thread
From: costas.argyris at gmail dot com @ 2023-09-09 16:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86030

--- Comment #7 from Costas Argyris <costas.argyris at gmail dot com> ---
(In reply to John Soo from comment #6)
> This is not a Windows-only bug, so I don't think it is fixed.

Althought it is not mentioned explicitly in the title of this PR, the original
reporter did describe it as Windows-specific problem:

"GCC does not use response files for %D and %I handling (see do_spec_1), so if
you have a project which contrains a lot of Includes or library directories cc1
or collect2 respectively will overflow the commandline limit on Windows and
error out."

Also, it is typically Windows that suffers from this limitation of command line
length.

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

* [Bug driver/86030] specs file processing does not create response files for input directories
       [not found] <bug-86030-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2023-09-09 16:35 ` costas.argyris at gmail dot com
@ 2023-09-09 19:59 ` john.soo+gcc-bugzilla at arista dot com
  2023-09-10 20:50 ` john.soo+gcc-bugzilla at arista dot com
                   ` (11 subsequent siblings)
  16 siblings, 0 replies; 17+ messages in thread
From: john.soo+gcc-bugzilla at arista dot com @ 2023-09-09 19:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86030

--- Comment #8 from John Soo <john.soo+gcc-bugzilla at arista dot com> ---
> Also, it is typically Windows that suffers from this limitation of command line length.

Ok that may be true but I am effected by this on linux as are quite a few
others in this issue https://github.com/NixOS/nixpkgs/issues/41340

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

* [Bug driver/86030] specs file processing does not create response files for input directories
       [not found] <bug-86030-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2023-09-09 19:59 ` john.soo+gcc-bugzilla at arista dot com
@ 2023-09-10 20:50 ` john.soo+gcc-bugzilla at arista dot com
  2023-09-11  3:49 ` john.soo+gcc-bugzilla at arista dot com
                   ` (10 subsequent siblings)
  16 siblings, 0 replies; 17+ messages in thread
From: john.soo+gcc-bugzilla at arista dot com @ 2023-09-10 20:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86030

--- Comment #9 from John Soo <john.soo+gcc-bugzilla at arista dot com> ---
Would a patch for unix doing something similar to
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=180ebb8a24d24fc5b105f2257d6216f6dfde62df
be accepted? I am happy to start working on something like it but I have no gcc
contributions yet and would like to know ahead of time if it is desired.

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

* [Bug driver/86030] specs file processing does not create response files for input directories
       [not found] <bug-86030-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2023-09-10 20:50 ` john.soo+gcc-bugzilla at arista dot com
@ 2023-09-11  3:49 ` john.soo+gcc-bugzilla at arista dot com
  2023-09-11  8:34 ` costas.argyris at gmail dot com
                   ` (9 subsequent siblings)
  16 siblings, 0 replies; 17+ messages in thread
From: john.soo+gcc-bugzilla at arista dot com @ 2023-09-11  3:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86030

--- Comment #10 from John Soo <john.soo+gcc-bugzilla at arista dot com> ---
I'm also not sure
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=180ebb8a24d24fc5b105f2257d6216f6dfde62df
fixes the collect bug because collect uses collect_execute instead of the pex_*
exec functions.

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

* [Bug driver/86030] specs file processing does not create response files for input directories
       [not found] <bug-86030-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2023-09-11  3:49 ` john.soo+gcc-bugzilla at arista dot com
@ 2023-09-11  8:34 ` costas.argyris at gmail dot com
  2023-09-11 15:28 ` john.soo+gcc-bugzilla at arista dot com
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 17+ messages in thread
From: costas.argyris at gmail dot com @ 2023-09-11  8:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86030

--- Comment #11 from Costas Argyris <costas.argyris at gmail dot com> ---
(In reply to John Soo from comment #10)
> I'm also not sure
> https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;
> h=180ebb8a24d24fc5b105f2257d6216f6dfde62df fixes the collect bug because
> collect uses collect_execute instead of the pex_* exec functions.

That patch was only meant to deal with the 32K command line length limitation
on Windows hosts, for programs spawned with the pex functions (to my knowledge,
this is how the driver spawns its sub-programs like the compiler, assembler and
linker).

In this PR though the problem appears to be something else which I am not
familiar with, so I don't know if its going to be helpful to see that patch as
a guide.   I only put the reference in the hopes that it solved this as well
because it looked similar, but it doesn't look like it.    You may need to come
up with a completely new solution for all I know.

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

* [Bug driver/86030] specs file processing does not create response files for input directories
       [not found] <bug-86030-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2023-09-11  8:34 ` costas.argyris at gmail dot com
@ 2023-09-11 15:28 ` john.soo+gcc-bugzilla at arista dot com
  2023-09-11 15:52 ` costas.argyris at gmail dot com
                   ` (7 subsequent siblings)
  16 siblings, 0 replies; 17+ messages in thread
From: john.soo+gcc-bugzilla at arista dot com @ 2023-09-11 15:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86030

--- Comment #12 from John Soo <john.soo+gcc-bugzilla at arista dot com> ---
I think the general problem in that issue is that ARG_MAX is not respected when
the driver (or any subprocess) execs things on linux. I think that it is not
the same as the original issue here, though.

> I don't know if its going to be helpful to see that patch as a guide

Do you think using response files like in pex-win32.c in pex-unix.c could help?
I tried this out and it seems like this may not solve all the ARG_MAX problems.

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

* [Bug driver/86030] specs file processing does not create response files for input directories
       [not found] <bug-86030-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2023-09-11 15:28 ` john.soo+gcc-bugzilla at arista dot com
@ 2023-09-11 15:52 ` costas.argyris at gmail dot com
  2023-09-13 20:20 ` john.soo+gcc-bugzilla at arista dot com
                   ` (6 subsequent siblings)
  16 siblings, 0 replies; 17+ messages in thread
From: costas.argyris at gmail dot com @ 2023-09-11 15:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86030

--- Comment #13 from Costas Argyris <costas.argyris at gmail dot com> ---
(In reply to John Soo from comment #12)
> I think the general problem in that issue is that ARG_MAX is not respected
> when the driver (or any subprocess) execs things on linux. I think that it
> is not the same as the original issue here, though.
> 
> > I don't know if its going to be helpful to see that patch as a guide
> 
> Do you think using response files like in pex-win32.c in pex-unix.c could
> help? I tried this out and it seems like this may not solve all the ARG_MAX
> problems.

I really don't know because the problem might be happening even before it gets
to the point where the new subprocess is spawned.    Then, passing the command
line through a response file wouldn't help with anything, if the problem has
already happened by that point.

The Windows patch above just checks if the subprocess is about to be spawned
with a command line > 32K and if that is true it simply puts it in a temporary
response file and calls the subprocess with @rsp as the only arg, instead of
the large command line which would break it.    But obviously this makes the
assumption that the large command line is correct (nothing has been dropped or
otherwise messed up).

Here though it seems that you are dealing with another sort of limit which is
much larger (I have seen 128K being mentioned on the GH page).    If this
somehow corrupts the command line, it wouldn't help if that command line went
into a response file because it would still be wrong.    To my knowledge,
Linux-based systems don't have a command line length limitation, so I can't see
how a response file approach would be useful at the point where the subprocess
is spawned.    Whether something similar can be used at an earlier point to
save it from the 128K limit, whatever it is, is unknown to me.

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

* [Bug driver/86030] specs file processing does not create response files for input directories
       [not found] <bug-86030-4@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2023-09-11 15:52 ` costas.argyris at gmail dot com
@ 2023-09-13 20:20 ` john.soo+gcc-bugzilla at arista dot com
  2023-09-14 12:55 ` john.soo+gcc-bugzilla at arista dot com
                   ` (5 subsequent siblings)
  16 siblings, 0 replies; 17+ messages in thread
From: john.soo+gcc-bugzilla at arista dot com @ 2023-09-13 20:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86030

--- Comment #14 from John Soo <john.soo+gcc-bugzilla at arista dot com> ---
> Here though it seems that you are dealing with another sort of limit which is much larger (I have seen 128K being mentioned on the GH page).    If this somehow corrupts the command line, it wouldn't help if that command line went into a response file because it would still be wrong.    To my knowledge, Linux-based systems don't have a command line length limitation, so I can't see how a response file approach would be useful at the point where the subprocess is spawned.    Whether something similar can be used at an earlier point to save it from the 128K limit, whatever it is, is unknown to me.

It is a much larger limit (ARG_MAX resulting in E2BIG), but it is fundamentally
the same problem. I think we should assume that the command line is correct and
still respect ARG_MAX on linux/unix systems, too. It seems to me that the
temporary response file is the best way to do this.

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

* [Bug driver/86030] specs file processing does not create response files for input directories
       [not found] <bug-86030-4@http.gcc.gnu.org/bugzilla/>
                   ` (10 preceding siblings ...)
  2023-09-13 20:20 ` john.soo+gcc-bugzilla at arista dot com
@ 2023-09-14 12:55 ` john.soo+gcc-bugzilla at arista dot com
  2023-09-15 19:22 ` john.soo+gcc-bugzilla at arista dot com
                   ` (4 subsequent siblings)
  16 siblings, 0 replies; 17+ messages in thread
From: john.soo+gcc-bugzilla at arista dot com @ 2023-09-14 12:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86030

--- Comment #15 from John Soo <john.soo+gcc-bugzilla at arista dot com> ---
Just for some context on what limit is hit: under man sysconf you will find a
description of ARG_MAX
(https://www.man7.org/linux/man-pages/man3/sysconf.3.html)

> ARG_MAX - _SC_ARG_MAX
>     The maximum length of the arguments to the exec(3) family
>     of functions.  Must not be less than _POSIX_ARG_MAX
>     (4096).

Exceeding ARG_MAX will result in E2BIG
(https://man7.org/linux/man-pages/man3/errno.3.html).

> E2BIG  Argument list too long (POSIX.1-2001).

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

* [Bug driver/86030] specs file processing does not create response files for input directories
       [not found] <bug-86030-4@http.gcc.gnu.org/bugzilla/>
                   ` (11 preceding siblings ...)
  2023-09-14 12:55 ` john.soo+gcc-bugzilla at arista dot com
@ 2023-09-15 19:22 ` john.soo+gcc-bugzilla at arista dot com
  2023-09-16 15:45 ` john.soo+gcc-bugzilla at arista dot com
                   ` (3 subsequent siblings)
  16 siblings, 0 replies; 17+ messages in thread
From: john.soo+gcc-bugzilla at arista dot com @ 2023-09-15 19:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86030

--- Comment #16 from John Soo <john.soo+gcc-bugzilla at arista dot com> ---
It is actually somewhat likely that ARG_MAX will be hit when running on linux
because it is hit when the stack can't contain enough pointers to contain argv
and environ (see exec.c in the kernel
https://github.com/torvalds/linux/blob/master/fs/exec.c#L509).

The bad news is that response files can only mitigate the problem since environ
must also be small enough to fit into an execv* call.

Is there a reasonable way to keep only the env vars required to exec
subprocesses?

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

* [Bug driver/86030] specs file processing does not create response files for input directories
       [not found] <bug-86030-4@http.gcc.gnu.org/bugzilla/>
                   ` (12 preceding siblings ...)
  2023-09-15 19:22 ` john.soo+gcc-bugzilla at arista dot com
@ 2023-09-16 15:45 ` john.soo+gcc-bugzilla at arista dot com
  2023-09-17  5:47 ` john.soo+gcc-bugzilla at arista dot com
                   ` (2 subsequent siblings)
  16 siblings, 0 replies; 17+ messages in thread
From: john.soo+gcc-bugzilla at arista dot com @ 2023-09-16 15:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86030

--- Comment #17 from John Soo <john.soo+gcc-bugzilla at arista dot com> ---
Created attachment 55910
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55910&action=edit
libiberty, Unix: pass argv over ARG_MAX through an @file

This does not handle environ being too large, but it is an adaptation of the
argv fix in pex-win32.c.

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

* [Bug driver/86030] specs file processing does not create response files for input directories
       [not found] <bug-86030-4@http.gcc.gnu.org/bugzilla/>
                   ` (13 preceding siblings ...)
  2023-09-16 15:45 ` john.soo+gcc-bugzilla at arista dot com
@ 2023-09-17  5:47 ` john.soo+gcc-bugzilla at arista dot com
  2023-09-17 15:47 ` john.soo+gcc-bugzilla at arista dot com
  2023-09-19  1:54 ` john.soo+gcc-bugzilla at arista dot com
  16 siblings, 0 replies; 17+ messages in thread
From: john.soo+gcc-bugzilla at arista dot com @ 2023-09-17  5:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86030

--- Comment #18 from John Soo <john.soo+gcc-bugzilla at arista dot com> ---
And actually the proposed patch is not conservative enough, because the size of
the strings in argv/env also matter.

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

* [Bug driver/86030] specs file processing does not create response files for input directories
       [not found] <bug-86030-4@http.gcc.gnu.org/bugzilla/>
                   ` (14 preceding siblings ...)
  2023-09-17  5:47 ` john.soo+gcc-bugzilla at arista dot com
@ 2023-09-17 15:47 ` john.soo+gcc-bugzilla at arista dot com
  2023-09-19  1:54 ` john.soo+gcc-bugzilla at arista dot com
  16 siblings, 0 replies; 17+ messages in thread
From: john.soo+gcc-bugzilla at arista dot com @ 2023-09-17 15:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86030

--- Comment #19 from John Soo <john.soo+gcc-bugzilla at arista dot com> ---
I verified the proposed patch sent argv through @file, but COLLECT_GCC_OPTIONS
still caused E2BIG. In the failing execve, COLLECT_GCC_OPTIONS was 134227
characters long.

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

* [Bug driver/86030] specs file processing does not create response files for input directories
       [not found] <bug-86030-4@http.gcc.gnu.org/bugzilla/>
                   ` (15 preceding siblings ...)
  2023-09-17 15:47 ` john.soo+gcc-bugzilla at arista dot com
@ 2023-09-19  1:54 ` john.soo+gcc-bugzilla at arista dot com
  16 siblings, 0 replies; 17+ messages in thread
From: john.soo+gcc-bugzilla at arista dot com @ 2023-09-19  1:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86030

--- Comment #20 from John Soo <john.soo+gcc-bugzilla at arista dot com> ---
I think that in order to really rid gcc of the E2BIG problem on linux,
COLLECT_*_OPTIONS will have to be deprecated and removed. This is particularly
a problem when executing spec files, it seems.

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

end of thread, other threads:[~2023-09-19  1:54 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-86030-4@http.gcc.gnu.org/bugzilla/>
2021-05-19 10:43 ` [Bug driver/86030] specs file processing does not create response files for input directories redi at gcc dot gnu.org
2023-06-14 18:27 ` costas.argyris at gmail dot com
2023-09-09 16:17 ` john.soo+gcc-bugzilla at arista dot com
2023-09-09 16:35 ` costas.argyris at gmail dot com
2023-09-09 19:59 ` john.soo+gcc-bugzilla at arista dot com
2023-09-10 20:50 ` john.soo+gcc-bugzilla at arista dot com
2023-09-11  3:49 ` john.soo+gcc-bugzilla at arista dot com
2023-09-11  8:34 ` costas.argyris at gmail dot com
2023-09-11 15:28 ` john.soo+gcc-bugzilla at arista dot com
2023-09-11 15:52 ` costas.argyris at gmail dot com
2023-09-13 20:20 ` john.soo+gcc-bugzilla at arista dot com
2023-09-14 12:55 ` john.soo+gcc-bugzilla at arista dot com
2023-09-15 19:22 ` john.soo+gcc-bugzilla at arista dot com
2023-09-16 15:45 ` john.soo+gcc-bugzilla at arista dot com
2023-09-17  5:47 ` john.soo+gcc-bugzilla at arista dot com
2023-09-17 15:47 ` john.soo+gcc-bugzilla at arista dot com
2023-09-19  1:54 ` john.soo+gcc-bugzilla at arista 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).