From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DAC5D3858C2C; Tue, 28 Sep 2021 10:29:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DAC5D3858C2C From: "nikita6 at bk dot ru" To: gdb-prs@sourceware.org Subject: [Bug server/28392] New: gdb server no longer supports argument globbing and variable substitution Date: Tue, 28 Sep 2021 10:29:56 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: server X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: nikita6 at bk dot ru X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 10:29:57 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28392 Bug ID: 28392 Summary: gdb server no longer supports argument globbing and variable substitution Product: gdb Version: HEAD Status: UNCONFIRMED Severity: normal Priority: P2 Component: server Assignee: unassigned at sourceware dot org Reporter: nikita6 at bk dot ru Target Milestone: --- Due to change in the way arguments are handled by gdbserver (bisected as co= mmit bea571ebd78ee29cb94adf648fbcda1e109e1be6), it is no longer possible to do s= hell variable substitution, globbing and inferior output redirection via command line. Steps to reproduce: 1) Run gdbserver gdbserver --startup-with-shell localhost:5006 ls ">test.txt" 2) (in another terminal) Connect to it with gdb gdb --eval-command=3D'target remote localhost:5006' --eval-command=3D'c' --eval-command=3D'q' Before the offending commit you would get: Process ls created; pid =3D 2060713 Listening on port 5006 Remote debugging from host 127.0.0.1, port 48496 Child exited with status 0 and a file test.txt created After the offending commit you would get: Process ls created; pid =3D 2060582 Listening on port 5006 Remote debugging from host 127.0.0.1, port 48494 ls: cannot access '>test.txt': No such file or directory Child exited with status 2 It appears that the commit was trying to fix PR 25893, which was about hand= ling arguments with spaces. It appears that it was too restrictive about escaping though, not allowing the usage of any of the shell features Those features are actually documented in --no-startup-with-shell flag help: > Exec PROG directly instead of using a shell. > Disables argument globbing and variable substitution > on UNIX-like systems. (with the commit applied and flag --startup-with-shell used this does not work). The problem was discovered when using bazel extension for CLion (tracked at https://github.com/bazelbuild/intellij/issues/2958). The plugin executes gdbserver, redirecting gdbserver's and interior's outputs to different file= s. Due to changed parsing inferior gets something like `1>/tmp/gdbserver_wrapper.KxJr27Av/inferior.out 2>/tmp/gdbserver_wrapper.KxJr27Av/inferior.err` as arguments when using gdb 10.2, which is.. Inconvenient to say the least. --=20 You are receiving this mail because: You are on the CC list for the bug.=