In case there’s another right parenthesis from the process name.
str.partition would get the first parenthesis while rpartition would get
the last one, which is guaranteed to be the right one (no pun intended
:−). Unlikely but why not play it safe when possible. ps does the same.
See for yourself:
ln -s /usr/bin/python xyzzy:-\)plugh
./xyzzy:-\)plugh <<E
statline = open("/proc/self/stat").read()
print(statline)
print("Parent PID is not " + statline.partition(")")[2].split()[1])
print("But rather " + statline.rpartition(")")[2].split()[1])
E
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1399916
Title:
/just/in/case:-)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+bug/1399916/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs