Gnus development mailing list
 help / color / mirror / Atom feed
* spam-get-ifile-database-parameter returns inappropriate value
@ 2003-01-09 19:36 David Z Maze
  2003-01-09 20:13 ` Ted Zlatanov
  0 siblings, 1 reply; 4+ messages in thread
From: David Z Maze @ 2003-01-09 19:36 UTC (permalink / raw)


`spam-get-ifile-database-parameter' looks at spam-ifile-database-path,
and if it's non-nil, returns a string command-line parameter for ifile
that corresponds to this.  This is fine, except that if returns "" if
the variable isn't set, and Emacs dutifully passes that on as a
parameter to ifile.  So you get 'ifile -q -c ""', ifile tries to read
"" as a file, and exits immediately rather than reading the message
from stdin.  It doesn't look like ifile has a magic filename for "read
the message from stdin", and I don't know if call-process-* will drop
nil arguments (I'd guess it won't, though).  This means the call to
call-process-region there needs to be a bit trickier to support a
variable number of arguments...

-- 
David Maze             dmaze@mit.edu          http://www.mit.edu/~dmaze/
"Theoretical politics is interesting.  Politicking should be illegal."
	-- Abra Mitchell




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: spam-get-ifile-database-parameter returns inappropriate value
  2003-01-09 19:36 spam-get-ifile-database-parameter returns inappropriate value David Z Maze
@ 2003-01-09 20:13 ` Ted Zlatanov
  2003-01-09 20:33   ` David Z Maze
  0 siblings, 1 reply; 4+ messages in thread
From: Ted Zlatanov @ 2003-01-09 20:13 UTC (permalink / raw)
  Cc: ding

On Thu, 09 Jan 2003, dmaze@MIT.EDU wrote:
> `spam-get-ifile-database-parameter' looks at
> spam-ifile-database-path, and if it's non-nil, returns a string
> command-line parameter for ifile that corresponds to this.  This is
> fine, except that if returns "" if the variable isn't set, and Emacs
> dutifully passes that on as a parameter to ifile.  So you get 'ifile
> -q -c ""', ifile tries to read "" as a file, and exits immediately
> rather than reading the message from stdin.  It doesn't look like
> ifile has a magic filename for "read the message from stdin", and I
> don't know if call-process-* will drop nil arguments (I'd guess it
> won't, though).  This means the call to call-process-region there
> needs to be a bit trickier to support a variable number of
> arguments...

I just did an if statement there instead.  I didn't expect ifile to
try to read an empty filename - serves me right for only testing the
new parameter, not retroactively testing the old stuff.

Thanks for the catch.

Ted



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: spam-get-ifile-database-parameter returns inappropriate value
  2003-01-09 20:13 ` Ted Zlatanov
@ 2003-01-09 20:33   ` David Z Maze
  2003-01-09 21:02     ` Ted Zlatanov
  0 siblings, 1 reply; 4+ messages in thread
From: David Z Maze @ 2003-01-09 20:33 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 319 bytes --]

Ted Zlatanov <tzz@lifelogs.com> writes:

> I just did an if statement there instead.  I didn't expect ifile to
> try to read an empty filename - serves me right for only testing the
> new parameter, not retroactively testing the old stuff.

Thanks.  You need to make the same change in
spam-ifile-register-with-ifile:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1203 bytes --]

--- spam.el.orig        Thu Jan  9 15:29:38 2003
+++ spam.el     Thu Jan  9 15:31:24 2003
@@ -588,13 +588,17 @@
   "Register an article, given as a string, with a category.
 Uses `gnus-newsgroup-name' if category is nil (for ham registration)."
   (when (stringp article-string)
-    (let ((category (or category gnus-newsgroup-name)))
+    (let ((category (or category gnus-newsgroup-name))
+          (db-param (spam-get-ifile-database-parameter)))
       (with-temp-buffer
        (insert-string article-string)
-       (call-process-region (point-min) (point-max) spam-ifile-path 
-                            nil nil nil 
-                            "-h" "-i" category 
-                            (spam-get-ifile-database-parameter))))))
+        (if db-param
+           (call-process-region (point-min) (point-max) spam-ifile-path 
+                                nil nil nil 
+                                "-h" "-i" category db-param)
+         (call-process-region (point-min) (point-max) spam-ifile-path 
+                              nil nil nil 
+                              "-h" "-i" category))))))
 
 (defun spam-ifile-register-spam-routine ()
   (spam-generic-register-routine 

[-- Attachment #3: Type: text/plain, Size: 167 bytes --]


-- 
David Maze             dmaze@mit.edu          http://www.mit.edu/~dmaze/
"Theoretical politics is interesting.  Politicking should be illegal."
	-- Abra Mitchell

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: spam-get-ifile-database-parameter returns inappropriate value
  2003-01-09 20:33   ` David Z Maze
@ 2003-01-09 21:02     ` Ted Zlatanov
  0 siblings, 0 replies; 4+ messages in thread
From: Ted Zlatanov @ 2003-01-09 21:02 UTC (permalink / raw)
  Cc: ding

On Thu, 09 Jan 2003, dmaze@MIT.EDU wrote:
> Ted Zlatanov <tzz@lifelogs.com> writes:
> 
>> I just did an if statement there instead.  I didn't expect ifile to
>> try to read an empty filename - serves me right for only testing
>> the new parameter, not retroactively testing the old stuff.
> 
> Thanks.  You need to make the same change in
> spam-ifile-register-with-ifile:

Applied, thanks.

Ted



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-01-09 21:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-09 19:36 spam-get-ifile-database-parameter returns inappropriate value David Z Maze
2003-01-09 20:13 ` Ted Zlatanov
2003-01-09 20:33   ` David Z Maze
2003-01-09 21:02     ` Ted Zlatanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).