🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
7 messages
7 total messages Started by Jon Bendtsen Wed, 02 Sep 2009 11:27
mailpost exits with 0 when it should not
#81849
Author: Jon Bendtsen
Date: Wed, 02 Sep 2009 11:27
41 lines
1962 bytes
Hi

mailpost exists with 0 when it should not.

I just ran the bash code below.

for mail in $(grep -l "^To: .*bad@@example.com" *); do
	../p.sh $mail bad.example
done

And I got the following

inews failed: inews: no space after colon in
"X-MS-Exchange-Organization-Mes..." inews: article not posted

So, I wanted to take a look at the mail that had this problem.

news@dknntp:~/Maildir/new$ grep -l "^To: .*bad@example.com" *

BUT THEY ARE ALL GONE??

Sure, my p.sh script deletes the file, but _ONLY_ if it was posted
successfully.

cat p.sh

#!/bin/bash

group="$2"
post="$1"

cat "$post" | /usr/lib/news/bin/mailpost -a approved $group && rm
"$post"

So it should ONLY delete mails that was successfully posted, which
leads to mailpost should not return 0 when there was an error.




JonB
Re: mailpost exits with 0 when it should not
#81850
Author: Jon Bendtsen
Date: Wed, 02 Sep 2009 11:30
23 lines
1616 bytes
Jon Bendtsen wrote:
> Hi
> 
> mailpost exists with 0 when it should not.
> 
> I just ran the bash code below.
> 
> for mail in $(grep -l "^To: .*bad@@example.com" *); do
> 	../p.sh $mail bad.example
> done
> 
> And I got the following
> 
> inews failed: inews: no space after colon in
> "X-MS-Exchange-Organization-Mes..." inews: article not posted


It does the same with
	inews failed: inews: no space after colon in
"X-DomainKey-Signature:a=rsa-sh..." inews: article not posted


JonB
Re: mailpost exits with 0 when it should not
#81852
Author: Ray Banana
Date: Wed, 02 Sep 2009 11:51
13 lines
1721 bytes
* Jon Bendtsen wrote:

> cat "$post" | /usr/lib/news/bin/mailpost -a approved $group && rm
> "$post"
> So it should ONLY delete mails that was successfully posted, which
> leads to mailpost should not return 0 when there was an error.

It's not the return code from mailpost that triggers the rm command,
but the return code from cat and cat was successful.

-- 
Too many ingredients in the soup, no room for a spoon
http://www.eternal-september.org
Re: mailpost exits with 0 when it should not
#81853
Author: Jon Bendtsen
Date: Wed, 02 Sep 2009 12:32
12 lines
1572 bytes
Ray Banana wrote:
> * Jon Bendtsen wrote:
> 
>> cat "$post" | /usr/lib/news/bin/mailpost -a approved $group && rm
>> "$post"
>> So it should ONLY delete mails that was successfully posted, which
>> leads to mailpost should not return 0 when there was an error.
> 
> It's not the return code from mailpost that triggers the rm command,
> but the return code from cat and cat was successful.

Oh i see. sorry about that.
Re: mailpost exits with 0 when it should not
#81851
Author: Jon Bendtsen
Date: Wed, 02 Sep 2009 12:34
20 lines
1700 bytes
Ray Banana wrote:
> * Jon Bendtsen wrote:
> 
>> cat "$post" | /usr/lib/news/bin/mailpost -a approved $group && rm
>> "$post"
>> So it should ONLY delete mails that was successfully posted, which
>> leads to mailpost should not return 0 when there was an error.
> 
> It's not the return code from mailpost that triggers the rm command,
> but the return code from cat and cat was successful.

Are you sure about that?
	true | false && echo "hello world"
gives no output, where as
	false | true && echo "hello world"
does give output



JonB
Re: mailpost exits with 0 when it should not
#81854
Author: Ray Banana
Date: Wed, 02 Sep 2009 13:43
24 lines
2161 bytes
* Jon Bendtsen wrote:
> Ray Banana wrote:
>>> cat "$post" | /usr/lib/news/bin/mailpost -a approved $group && rm
>>> "$post"
>>> So it should ONLY delete mails that was successfully posted, which
>>> leads to mailpost should not return 0 when there was an error.
>> It's not the return code from mailpost that triggers the rm command,
>> but the return code from cat and cat was successful.
> Are you sure about that?
> 	true | false && echo "hello world"
> gives no output, where as
> 	false | true && echo "hello world"
> does give output

Oops, sorry, my bad:

from man bash:

| The return status of a pipeline is the exit status of the last command,
| unless the pipefail option is enabled.

-- 
Too many ingredients in the soup, no room for a spoon
http://www.eternal-september.org
Re: mailpost exits with 0 when it should not
#81855
Author: Julien ÉLIE
Date: Wed, 02 Sep 2009 16:56
23 lines
1968 bytes
Hi Jon,

> mailpost exists with 0 when it should not.

Then update to INN 2.5.0; that issue has already been fixed.
    http://inn.eyrie.org/trac/changeset/8359/trunk/frontends/mailpost.in
    http://inn.eyrie.org/trac/changeset/8370/trunk/frontends/mailpost.in


> inews failed: inews: no space after colon in
> "X-MS-Exchange-Organization-Mes..." inews: article not posted

Idem.  D. Stussy sent the following patch to solve that issue because
SMTP does not require such a space whereas NNTP does.
    http://inn.eyrie.org/trac/changeset/8462/trunk/frontends/mailpost.in

Also already fixed in INN 2.5.0.

-- 
Julien ÉLIE

« Veni, uidi, et je n'en crois pas mes yeux ! » (César) 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads