coredump: handle long command-lines

This fixes errors with long command-lines:

  File "/home/criu/coredump/criu_coredump/coredump.py", line 320, in _gen_prpsinfo
    prpsinfo.pr_psargs = self._gen_cmdline(pid)
    ^^^^^^^^^^^^^^^^^^
ValueError: bytes too long (88, maximum length 80)

Signed-off-by: Adrian Reber <areber@redhat.com>
This commit is contained in:
Adrian Reber 2023-03-01 15:47:53 +00:00 committed by Andrei Vagin
parent a0cc95c03e
commit 3ca979f9a1

View file

@ -315,7 +315,9 @@ class coredump_generator:
prpsinfo.pr_ppid = pstree["ppid"]
prpsinfo.pr_pgrp = pstree["pgid"]
prpsinfo.pr_sid = pstree["sid"]
prpsinfo.pr_psargs = self._gen_cmdline(pid)
# prpsinfo.pr_psargs has a limit of 80 characters which means it will
# fail here if the cmdline is longer than 80
prpsinfo.pr_psargs = self._gen_cmdline(pid)[:80]
if (sys.version_info > (3, 0)):
prpsinfo.pr_fname = core["tc"]["comm"].encode()
else: