Opened 16 years ago

Closed 16 years ago

#2113 closed defect (fixed)

Bugfix for procps

Reported by: Arthur Demchenkov Owned by: randy@…
Priority: high Milestone: 6.4
Component: Book Version: SVN
Severity: normal Keywords:
Cc:

Description

Hello everyone.

Here is the patch that fixes two bugs in watch program from procps-3.2.7: 1) watch -n doesn't handle large integers properly 2) watch ignores multibyte characters (was pointed in locale related issues chapter of BLFS book earlier)

It's adapted from Fedora Core procps source rpm to LFS.

Attachments (3)

procps-3.2.7-watch_fix.patch (3.6 KB ) - added by Arthur Demchenkov 16 years ago.
procps-3.2.7-watch-unicode.patch (3.2 KB ) - added by Arthur Demchenkov 16 years ago.
procps-3.2.7-12.fc6.tar.bz2 (21.4 KB ) - added by Arthur Demchenkov 16 years ago.
Replaced with tar.bz2 without procps-3.2.7.tar.gz because of limited size of attachments

Download all attachments as: .zip

Change History (15)

by Arthur Demchenkov, 16 years ago

comment:1 by alexander@…, 16 years ago

As far as I can see:

  • The part about closing the fd 0, reopening it from /dev/null and asserting that the new fd is really 0 doesn't have any relation to the two abovementioned bugs, it just makes sure that the executed program receives nothing on stdin.
  • The rest of the patch is a straightforward rewrite of the old logic using wide characters - i.e., the fix for (2). It is definitely good, but should be rechecked for corner cases like a Chinese character at the end of line, and correct display of the title.
  • I don't see how issue (1) is fixed, or a testcase.

in reply to:  1 comment:2 by Arthur Demchenkov, 16 years ago

You are right. The first patch is some kind of atavism. I removed it.

I'm reattaching the properly patch to make watch to work with unicode.

by Arthur Demchenkov, 16 years ago

comment:3 by alexander@…, 16 years ago

Still, you didn't explain why you dropped the "close fd 0" part. I didn't say that it is bad - I only noted the inaccurate patch description.

As for the unicode patch, it is definitely better than nothing, but I still haven't tested it. From looking at the code, it seems that it mishandles zero-width characters.

comment:4 by Arthur Demchenkov, 16 years ago

Hello, Alexander.

As I said before the first patch is compilation of two patches from Fedora Core 6 src.rpm

The first one is called procps-3.1.15-misc.patch (that's about fd0)

The second on is called procps-3.2.7-watch-unicode.patch

But the problem was the second patch needed the first one. So I checked rpm's spec file for occurence of 'watch' and found 2 bugs (the first one was in procps-3.2.6 so my description was incorrect as this bug was fixed in procps-3.2.7):

* Thu Apr 26 2007 Tomas Smetana <tsmetana@redhat.com> 3.2.7-9
- fix #183029 - watch ignores multibyte characters
* Thu Jun  1 2006 Karel Zak <kzak@redhat.com> -> 3.2.6-4 <-
- fix #191493 - watch -n doesn't handle large integers properly

So after your message I checked that watch -n 12345678901234 <some command> works as expected without the first patch and I removed it. But if you know why watch needs it you are free to apply it. Looking at its name it comes from ancient version of procps-3.1.15.

I'm attaching original source converted to cpio.

by Arthur Demchenkov, 16 years ago

Attachment: procps-3.2.7-12.fc6.tar.bz2 added

Replaced with tar.bz2 without procps-3.2.7.tar.gz because of limited size of attachments

comment:5 by robert@…, 16 years ago

I can't reproduce the 'watch -n' bug at https://bugzilla.redhat.com/show_bug.cgi?id=191493.
Anyone else?

comment:6 by alexander@…, 16 years ago

The "watch -n" bug was relevant for versions 3.2.6 and below. procps 3.2.7 silently caps the interval to 4294 seconds. So we only have the unicode-related bug.

in reply to:  6 comment:7 by Arthur Demchenkov, 16 years ago

Replying to alexander@linuxfromscratch.org:

The "watch -n" bug was relevant for versions 3.2.6 and below. procps 3.2.7 silently caps the interval to 4294 seconds. So we only have the unicode-related bug.

Yes, unicode-related bug is fixed with procps-3.2.7-watch-unicode.patch. Do you have any contraindication on applying it?

comment:8 by alexander@…, 16 years ago

Please apply it, as a better patch doesn't exist yet.

comment:9 by bdubbs@…, 16 years ago

Milestone: 7.06.4

comment:10 by randy@…, 16 years ago

Priority: normalhigh

This is marked for the next release, but a consensus has not even been reached on this issue. We need to revisit this as a 6.4 ticket.

comment:11 by randy@…, 16 years ago

Owner: changed from lfs-book@… to randy@…
Status: newassigned

comment:12 by randy@…, 16 years ago

Resolution: fixed
Status: assignedclosed

Added the watch_unicode patch to the Procps instructions in r8636.

Note: See TracTickets for help on using tickets.