You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Otherwise one cannot tell apart the name of the executable from the rest of the arguments.
When trying to use NUL bytes expicitly:
In [7]: setproctitle.setproctitle('exec\x00arg1\x00')
TypeError Traceback (most recent call last)
/home/vkoukis/<ipython console> in <module>()
TypeError: argument 1 must be string without null bytes, not str
What version of the product are you using? On what operating system?
I am using the package that comes with Debian Squeeze:
$ dpkg -l python-setproctitle
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Description
+++-=====================-=====================-==========================================================
ii python-setproctitle 1.0.1-1 A setproctitle implementation for Python
Please provide any additional information below.
I think it would make sense to support setting the names of command-line arguments explicitly, either by supporting an arbitrary number of arguments, e.g. setproctitle('exec', 'arg1', 'arg2'), or by allowing NUL bytes inside the string.
The text was updated successfully, but these errors were encountered:
It is not possible to pass nulls to the underlying libraries: the postgres wrapper don't support it and the procfs won't behave correctly after a certain point.
setproctitle is to set some useful info in the process title, not to fake a different executable and arguments set.
/proc/PID/cmdline uses \0 as separator between arguments, which isn't supported
by setproctitle:
dvarrazzo/py-setproctitle#23 (comment)
Using space as separator technically means that everything in /proc/PID/cmdline
is the name of the executable. This is also who it is displayed in tools like
htop.
Leaving the cmdline untouched unless we're in tmux is the best compromise I can
think of.
rndusr
added a commit
to rndusr/stig
that referenced
this issue
Jan 22, 2018
/proc/PID/cmdline uses \0 as separator between arguments, which isn't supported
by setproctitle:
dvarrazzo/py-setproctitle#23 (comment)
Using space as separator technically means that everything in /proc/PID/cmdline
is the name of the executable. This is also who it is displayed in tools like
htop.
Leaving the cmdline untouched unless we're in tmux is the best compromise I can
think of.
Originally submitted by vkoukis as issue 23:
What steps will reproduce the problem?
import setproctitle; setproctitle.setproctitle('exec arg1 arg2')
What is the expected output? What do you see instead?
Everything looks ok in ps:
vkoukis 32321 32287 3 12:54 pts/3 00:00:00 exec arg1 arg2
But not in /proc/32321/cmdline:
$ cat /proc/32321/cmdline
exec arg1 arg2
The problem is that arguments should be separated from the actual name of the executable by NUL bytes, e.g.:
$ hexdump -vC /proc/32137/cmdline
00000000 2f 75 73 72 2f 73 62 69 6e 2f 61 70 61 63 68 65 |/usr/sbin/apache|
00000010 32 00 2d 6b 00 73 74 61 72 74 00 |2.-k.start.|
0000001b
Otherwise one cannot tell apart the name of the executable from the rest of the arguments.
When trying to use NUL bytes expicitly:
In [7]: setproctitle.setproctitle('exec\x00arg1\x00')
TypeError Traceback (most recent call last)
/home/vkoukis/<ipython console> in <module>()
TypeError: argument 1 must be string without null bytes, not str
What version of the product are you using? On what operating system?
I am using the package that comes with Debian Squeeze:
$ dpkg -l python-setproctitle
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Description
+++-=====================-=====================-==========================================================
ii python-setproctitle 1.0.1-1 A setproctitle implementation for Python
Please provide any additional information below.
I think it would make sense to support setting the names of command-line arguments explicitly, either by supporting an arbitrary number of arguments, e.g. setproctitle('exec', 'arg1', 'arg2'), or by allowing NUL bytes inside the string.
The text was updated successfully, but these errors were encountered: