Files
openide/platform/xdebugger-impl
Dmitry.Neverov 66fb288928 [clion debugger] CPP-43417 handle long usernames in ps output
On Linux, the previously used ps commands truncate usernames longer
than 9 characters and show them as usernam+. This makes attach debugger
to process logic to think the process doesn't belong to a user and sudo
password is required for attach.

We parse command output assuming values in the columns are not wider than
the column headers. This assumption doesn't hold on macOS where username
longer than 17 characters is not truncated and spills to the next column.
As a result we get a wrong command line and a truncated username in UI.

The fix is to list process owners using a separate command with
the username as the last column. In this case the username is not truncated.

The deprecated parseLinuxOutputMacStyle() is changed to throw an exception
because there is no way to make it work without process owner command output.
There is no internal or external usages of this method.

Other possible solutions:

On linux it is possible to specify column width in ps (e.g. -o user:32).
But this is not supported on macOS.

Alternatively, one can specify a custom column header with the desired
width (ps -o user:USER_HEADER_NAME), but the header width is fixed.
Linux has a 32-characters username limit, but it is not enforced on macOS.


(cherry picked from commit 59a08e4a7297f5ecf773964ed678df4f4c1689ec)

IJ-CR-155642


(cherry picked from commit e891e8fe4c0f45daa161fdcc524145aec511a3b9)

IJ-CR-159806

GitOrigin-RevId: 4abd6b56dff0e92d4c98a5a81f9374f78aa7eb68
2025-04-29 11:37:46 +00:00
..