Description of problem: ps reads cmdline from /proc/*/cmdline This file contains list of arguments separated with \0. ps rewrites all \0 with space, so it can use it and print it out as one string. This behaviour breaks ksh shell - in some special cases, ksh does not exec new script, but executes it within itself and just rewrites argv and zeroes out the rest. Because ps replaces even trailing zeroes with spaces, ps gives odd results. For example instead of "./a foo" it prints "./a foo " The problem lies in readproc.c:read_unvectored(...) if(n){ int i=n; while(i--) if(dst[i]=='\n' || dst[i]=='\0') dst[i]=sep; if(dst[n-1]==' ') dst[n-1]='\0'; } dst[n] = '\0'; before the rewrite while loop, it should skip trailing zeroes: while(i && dst[i-1]=='\0') --i; Version-Release number of selected component (if applicable): 1:procps-ng-3.3.8-10.fc19 How reproducible: always Steps to Reproduce: ################### cut here ######################### #include <stdlib.h> #include <stdio.h> #include <unistd.h> int main(int argc, char *argv[]) { int i; char *p; for(i=1;i<argc;++i) { p=argv[i]; while(*p) *p++='\0'; } printf("%d\n",getpid()); sleep(99); return 0; } ################### cut here ######################### 1) gcc -o reproducer reproducer.c 2) ,/reproducer foo bar baz <PID> 3) echo "'$(ps -p <PID> ho args)'" Actual results: './reproducer ' Expected results: './reproducer' Additional info:
Ahoj Michale. That sounds reasonable. Going to test and commit upstream if the change is ok. Thanks, Jaromir.
Fixed in all currently supported Fedora releases.
procps-ng-3.3.8-15.fc20 has been submitted as an update for Fedora 20. https://admin.fedoraproject.org/updates/procps-ng-3.3.8-15.fc20
procps-ng-3.3.8-11.fc19 has been submitted as an update for Fedora 19. https://admin.fedoraproject.org/updates/procps-ng-3.3.8-11.fc19
Package procps-ng-3.3.8-15.fc20: * should fix your issue, * was pushed to the Fedora 20 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing procps-ng-3.3.8-15.fc20' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2014-1523/procps-ng-3.3.8-15.fc20 then log in and leave karma (feedback).
procps-ng-3.3.8-15.fc20 has been pushed to the Fedora 20 stable repository. If problems still persist, please make note of it in this bug report.
procps-ng-3.3.8-11.fc19 has been pushed to the Fedora 19 stable repository. If problems still persist, please make note of it in this bug report.