[imapfilter-devel] imapfilter error: "attempt to concatenate local `header'"

pw woelfel at gmx.net
Thu May 13 13:20:42 EEST 2004


Hi,
once in a while, I get the following strange error message (using Imapfilter 
1.0-rc4):

imapfilter: /usr/share/imapfilter/interface.lua:366: attempt to concatenate 
local `header' (a nil value)

Below is the output of two calls of imapfilter, one right after the other, and 
my imapfilter configuration file.

-- PW


#> imapfilter -c .imapfilter/bogofilter.lua
no HAM  marked for training
no SPAM marked for training
found no messages in 'Junk/spam'
imapfilter: /usr/share/imapfilter/interface.lua:366: attempt to concatenate 
local `header' (a nil value)

#> imapfilter -c .imapfilter/bogofilter.lua
no HAM  marked for training
no SPAM marked for training
found no messages in 'Junk/spam'
0 messages in 'INBOX' classified SPAM
0 messages in 'INBOX' classified UNSURE

--

.imapfilter/bogofilter.lua:
[...]
results = match(mymailserver, 'Junk/ham', {})
text = fetchtext(mymailserver, 'Junk/ham', results)
if(text ~= nil ) then
  for msgid, msgtxt in pairs(text) do
        pipe_to('bogofilter -nM', msgtxt)
  end
  results = match(mymailserver, 'Junk/ham', {})
  delete(mymailserver, 'Junk/ham', results)
  print( string.format("%d messages trained as HAM", table.getn(text)) )
else
  print( "no HAM  marked for training" )
end

results = match(mymailserver, 'Junk/spam', {})
text = fetchtext(mymailserver, 'Junk/spam', results)
if(text ~= nil ) then
  for msgid, msgtxt in pairs(text) do
        pipe_to('bogofilter -sM', msgtxt)
  end
  print( string.format("%d messages trained as SPAM", table.getn(text)) )
else
  print( "no SPAM marked for training" )
end

results = match(mymailserver, 'Junk/spam', {})
spam = {}
unsure = {}
text = fetchtext(mymailserver, 'Junk/spam', results)
if(text ~= nil ) then
  for msgid, msgtxt in pairs(text) do
        exitstatus = pipe_to('bogofilter', msgtxt)
        if (exitstatus == 0 ) then
          table.insert(spam, msgid)
        elseif (exitstatus == 2) then
          table.insert(unsure, msgid)
        end
  end
  print( string.format("%d messages in 'Junk/spam' classified SPAM", 
table.getn(spam)) )
  print( string.format("%d messages in 'Junk/spam' classified UNSURE", 
table.getn(unsure)) )
else
  print( "found no messages in 'Junk/spam'" )
end
move(mymailserver, 'Junk/spam', mymailserver, 'Junk', spam)
move(mymailserver, 'Junk/spam', mymailserver, 'Junk/unsure', unsure)

results = match(mymailserver, 'INBOX', {})
spam = {}
unsure = {}
text = fetchtext(mymailserver, 'INBOX', results)
if(text ~= nil ) then
  for msgid, msgtxt in pairs(text) do
        -- bogofilter aufrufen:
        exitstatus = pipe_to('bogofilter', msgtxt)
        if (exitstatus == 0) then
          table.insert(spam, msgid)
        elseif (exitstatus == 2) then
          table.insert(unsure, msgid)
        end
  end
  print( string.format("%d messages in 'INBOX' classified SPAM", 
table.getn(spam)) )
  print( string.format("%d messages in 'INBOX' classified UNSURE", 
table.getn(unsure)) )
  move(mymailserver, 'INBOX', mymailserver, 'Junk', spam)
  copy(mymailserver, 'INBOX', mymailserver, 'Junk/unsure', unsure)
else
  print( "found no messages in 'INBOX'" )
end




More information about the Imapfilter-devel mailing list