public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug server/28392] New: gdb server no longer supports argument globbing and variable substitution
@ 2021-09-28 10:29 nikita6 at bk dot ru
  2021-09-28 11:09 ` [Bug server/28392] " nikita6 at bk dot ru
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: nikita6 at bk dot ru @ 2021-09-28 10:29 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28392

            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 commit
bea571ebd78ee29cb94adf648fbcda1e109e1be6), it is no longer possible to do shell
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='target remote localhost:5006' --eval-command='c'
--eval-command='q'

Before the offending commit you would get:

Process ls created; pid = 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 = 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 handling
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 files.
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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2024-01-17 15:35 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-28 10:29 [Bug server/28392] New: gdb server no longer supports argument globbing and variable substitution nikita6 at bk dot ru
2021-09-28 11:09 ` [Bug server/28392] " nikita6 at bk dot ru
2021-09-28 14:33 ` simark at simark dot ca
2021-10-01  7:56 ` m.weghorn at posteo dot de
2021-10-01 20:21 ` nikita6 at bk dot ru
2021-10-06  6:33 ` m.weghorn at posteo dot de
2021-10-06 19:14 ` simon.marchi at polymtl dot ca
2021-10-13  6:43 ` m.weghorn at posteo dot de
2021-10-13 18:09 ` simon.marchi at polymtl dot ca
2021-10-14 15:06 ` m.weghorn at posteo dot de
2021-10-14 15:15 ` simark at simark dot ca
2021-10-22  7:21 ` m.weghorn at posteo dot de
2024-01-17 15:35 ` vries at gcc dot gnu.org

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).