Article View: news.software.readers
Article #875Re: rn 4.4 -- "k" when Subject is "."
From: Mark Brader
Date: Sun, 10 Nov 1991 06:53
Date: Sun, 10 Nov 1991 06:53
55 lines
3447 bytes
3447 bytes
(Despite the Subject line, I'm actually speaking of rn 4.3 and earlier when I talk about present behavior; I haven't seen 4.4.) > >Which is exactly his point! Shouldn't 'k' escape any periods it sees? > >Hitting 'k' on a "Subject: ." should do a "/\./j", not a "/./j" > > To answer your question: no, I don't think so. I think keeping the > behavior consistent (i.e. treating "." as the metacharacter which > matches any single character) regardless of the context is cleaner ... This interpretation seems bizarre to me. Man rn says: # k Mark as read all articles with the same subject as # the current article. ... It does *not* say "Mark as read all articles whose Subject line contains a match for that of the current article taken as a regular expression". The present behavior is simply a bug. Or rather, a misfeature, for it was obviously intentional. The actual behavior fits *neither* of the descriptions above. What is actually done is that all metacharacters in the Subject line are *replaced* by dots, the subject is truncated to about 24 characters and prefixed by ": *", and *then* it's treated as a regular expression. (And the match is unanchored, too; a k on "Subject: sex" will match "Subject: Re: which is best: sex, drugs, or rock & roll?".) You can see this by using K instead of k and looking at the KILL file entry generated. I think the reason Larry did it this way is simply that he only implemented searching by regular expressions and not matching against fixed strings. For many purposes this is adequate, but regular expression matchers on UNIX tend to be limited to patterns that are relatively short and simple, and he evidently felt or found that they couldn't handle a regular expression search for a long Subject line, or at least, couldn't handle it fast enough. So he transformed the subject to a shorter and simpler regular expression. I think now that it would have been beneficial for *both* regular expression matching and exact string matching on Subject lines to have been provided, perhaps governed by a modifier on the / command. The K and k commands should have done exact matching on the full length of the subject; if the user wanted regular expression matching on a substring of it or unanchored matching, they should have had to specify their own expression explicitly. Hindsight is wonderful. This could still be retrofitted, by adding an f modifier (exact match like fgrep -x) to the / and ? commands, and making K and k generate / patterns with this modifier. Anyone feel like doing it? -- Mark Brader, Toronto sed -e "s;??\\([-=(/)'<!>]\\);?\\\\?\\1;g" utzoo!sq!msb, msb@sq.com will fix them... -- Karl Heuer This article is in the public domain.
Technical Details
Message-ID:
<1991Nov10.065350.13117@sq.sq.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!gmdzi!unido!mcsun!uunet!cs.utexas.edu!utgpu!utzoo!sq!msbReferences:
<55406@netnews.upenn.edu> <=*9Hwuzl3@cs.psu.edu> <55541@netnews.upenn.edu>Show Full Headers
Complete Article Headers
Message-ID: <1991Nov10.065350.13117@sq.sq.com> Subject: Re: rn 4.4 -- "k" when Subject is "." Date: Sun, 10 Nov 1991 06:53:50 +0000 From: msb@sq.sq.com (Mark Brader) References: <55406@netnews.upenn.edu> <=*9Hwuzl3@cs.psu.edu> <55541@netnews.upenn.edu> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!gmdzi!unido!mcsun!uunet!cs.utexas.edu!utgpu!utzoo!sq!msb Newsgroups: news.software.readers Organization: SoftQuad Inc., Toronto, Canada Lines: 55