Bug 134516
| Summary: | ps truncates line to 2048 characters | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 3 | Reporter: | Bastien Nocera <bnocera> | ||||||||||||
| Component: | procps | Assignee: | Karel Zak <kzak> | ||||||||||||
| Status: | CLOSED WONTFIX | QA Contact: | Brian Brock <bbrock> | ||||||||||||
| Severity: | medium | Docs Contact: | |||||||||||||
| Priority: | medium | ||||||||||||||
| Version: | 3.0 | CC: | jturner, kmori, tao | ||||||||||||
| Target Milestone: | --- | Keywords: | Reopened | ||||||||||||
| Target Release: | --- | ||||||||||||||
| Hardware: | All | ||||||||||||||
| OS: | Linux | ||||||||||||||
| Whiteboard: | |||||||||||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||||||||||
| Doc Text: | Story Points: | --- | |||||||||||||
| Clone Of: | Environment: | ||||||||||||||
| Last Closed: | 2007-01-08 22:57:01 UTC | Type: | --- | ||||||||||||
| Regression: | --- | Mount Type: | --- | ||||||||||||
| Documentation: | --- | CRM: | |||||||||||||
| Verified Versions: | Category: | --- | |||||||||||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||||||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||||||||||
| Embargoed: | |||||||||||||||
| Bug Depends On: | |||||||||||||||
| Bug Blocks: | 190430, 203310 | ||||||||||||||
| Attachments: |
|
||||||||||||||
|
Description
Bastien Nocera
2004-10-04 10:50:01 UTC
Created attachment 104713 [details]
long-name.c
Hmm.. it's interesting: $ ps -a -o command= | grep java | head -n 1 | tr -d "\n" | wc -c 1515 $ cat /proc/762/cmdline | wc -c 1515 $ uname -r 2.6.8-1.521 It's FC2 and long-name.c sets 3725 bytes to argv[0]. In this case a problem is not in the procps. Agreed, but the problem is in procps on a RHEL3 system, as the data is correct is /proc. Created attachment 105638 [details]
Bugfix patch.
This patch fix the problem with truncated output lines to 2048 characters in
procps 2.0.17. The problem will fixed in the next update (RHEL3-U5).
Looks good with 2.0.17-13. Prepping for the next errata update. Sorry, this going to RHEL3-U4 (and not to U5 as I expected). An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on the solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2004-544.html The problem still exists when the command-line is exactly 2047 characters
because of an off-by-one error in the procps-2.0.17-longcmd.patch patch.
in readproc.c:
/* read whole file into a memory buffer, allocating as we go */
while ((n = read(fd, buf, sizeof buf - 1)) > 0) {
if (n < BUF_LEN)
end_of_file = 1;
BUF_LEN is *always* greater than n, as BUF_LEN is 2048, and we read up to 2048-1
characters.
Your code is without the patch. I see code:
while ((n = read(fd, buf, sizeof buf - 1)) > 0) {
if (n < (int) (sizeof buf - 1))
end_of_file = 1;
Seems I got that wrong, here are the 2 files for the test case. $ ./test_2047.sh <snip> $ ps auxwwww <snip> bnocera 385 0.0 0.1 4640 992 pts/9 S+ 16:40 0:00 [sh] <snip> Instead of the whole command-line. Created attachment 128361 [details]
test_2047.sh
Created attachment 128362 [details]
test.sh
Fujitsu is asking what the current status on this. Could engineer please update anything here ? And could we get the fix in RHEL3 ? Bastien, http://people.redhat.com/kzak/procps/ps-test-truncates.tar.gz $ tar zxvf ps-test-truncates.tar.gz ps-test-truncates/ ps-test-truncates/run.sh ps-test-truncates/ps_truncates.sh $ cd ps-test-truncates/ $ ./run.sh cmdline size (org=2029, new=2029) .... PASS $ rpm -q procps procps-2.0.17-13.7 (the latest version is 2.0.17-13.10) Note: you can manually add "ps auxwwww" to the ps_truncates.sh srcipt and you will see real output. I don't see there any problem. Created attachment 131872 [details]
Testcase
Karel,
Please try this testcase under /tmp directory. You can see this issue with the
latest procps package.
[root@dhcp100 root]# tar zxvf ps-test-truncates.tar.gz -C /tmp/
ps-test-truncates/
ps-test-truncates/run.sh
ps-test-truncates/ps_truncates.sh
[root@dhcp100 root]# cd /tmp/ps-test-truncates/
[root@dhcp100 ps-test-truncates]# ./run.sh
cmdline size (org=1995, new= 18) .... FAILED
===output===
[ps_truncates.sh]
============
[root@dhcp100 ps-test-truncates]# rpm -q procps
procps-2.0.17-13.10
Keiichi, I don't see this here. # ./run.sh cmdline size (org=1995, new= 1995) .... PASS # rpm -q procps procps-2.0.17-13.7 Bastien, Where did you execute a testcase ? You need to run my testcase in comment#20 under /tmp/ps-test-truncates directory. I have seen this issue both with procps-2.0.17-13.10 and procps-2.0.17-13.7. [root@dhcp100 ps-test-truncates]# rpm -q procps procps-2.0.17-13.7 [root@dhcp100 ps-test-truncates]# pwd /tmp/ps-test-truncates [root@dhcp100 ps-test-truncates]# ./run.sh cmdline size (org=1995, new= 18) .... FAILED ===output=== [ps_truncates.sh] ============ [root@dhcp100 ps-test-truncates]# up2date --update Fetching Obsoletes list for channel: rhel-i386-as-3... Fetching Obsoletes list for channel: rhel-i386-as-3-extras... Fetching Obsoletes list for channel: rhn-tools-rhel-3-as-i386... Fetching Obsoletes list for channel: rhel-i386-as-3-fastrack... Fetching rpm headers... ######################################## Name Version Rel ---------------------------------------------------------- kernel-smp-unsupported 2.4.21 40.EL i686 procps 2.0.17 13.10 i386 quagga 0.96.2 11.3E i386 sendmail-doc 8.12.11 4.RHEL3.6 i386 Testing package set / solving RPM inter-dependencies... ######################################## kernel-smp-unsupported-2.4. ########################## Done. procps-2.0.17-13.10.i386.rp ########################## Done. quagga-0.96.2-11.3E.i386.rp ########################## Done. sendmail-doc-8.12.11-4.RHEL ########################## Done. Preparing ########################################### [100%] Installing... 1:procps ########################################### [100%] 2:kernel-smp-unsupported ########################################### [100%] 3:quagga ########################################### [100%] 4:sendmail-doc ########################################### [100%] [root@dhcp100 ps-test-truncates]# ./run.sh cmdline size (org=1995, new= 18) .... FAILED ===output=== [ps_truncates.sh] ============ [root@dhcp100 ps-test-truncates]# rpm -q procps procps-2.0.17-13.10 Keiichi is right. You need to run the test in /tmp/ps-test-truncates I could reproduce it without any problems. I guess the testcase needs to be updated, and made a bit more solid. I see the bug now. There is also bad condition for the while(). So the final
version of the patch must be:
- while ((n = read(fd, buf, sizeof buf - 1)) > 0) {
- if (n < BUF_LEN)
+ while ((n = read(fd, buf, sizeof buf - 1)) >= 0) {
+ if (n < (int) (sizeof buf - 1))
Note: this problem appears with procps-2.0.17-13.10 only when the size of
cmdline is exactly 2047 bytes.
Unofficial package (for your tests only) with bugfix:
http://people.redhat.com/kzak/procps/bz134516/procps-2.0.17-13.10.1.src.rpm
The same problem is in all procps packages (include the latest 3.2.7 version).
I'll send patch to upstream developer too.
Thanks for your enthusiasm!
Note: the test at http://people.redhat.com/kzak/procps/ps-test-truncates.tar.gz has been updated and it's more stable now. $ ./run.sh 2050: PASS 2049: PASS 2048: PASS 2047: FAILED for 2047 bytes in /proc/#/cmdline ===ps output procps-3.2.7-5=== [ps_truncates.sh] ============================== |