LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Does some spec require a space-padded day-of-month in the From line that separates messages in an mbox file? (https://www.linuxquestions.org/questions/linux-software-2/does-some-spec-require-a-space-padded-day-of-month-in-the-from-line-that-separates-messages-in-an-mbox-file-4175644019/)

RandomTroll 12-10-2018 01:26 PM

Does some spec require a space-padded day-of-month in the From line that separates messages in an mbox file?
 
The new mailx complains about From lines that have a single-digit day-of-month. mailx's man page says it uses ctime. ctime's man page says nothing about this. time.h doesn't so specify.

Now, to create a From line I can't just use 'date', but have to specify the whole format.

It's a small thing. I'm just wondering.

scasey 12-10-2018 02:06 PM

Please show what you're trying that's not working. AFAIK From lines only contain email addresses...not dates.

RandomTroll 12-10-2018 05:20 PM

I refer to rfc4155, the spec for mbox files.
Quote:


• Each message in the mbox database MUST be immediately preceded
by a single separator line, which MUST conform to the following
syntax:

The exact character sequence of "From";

a single Space character (0x20);

the email address of the message sender (as obtained from the
message envelope or other authoritative source), conformant
with the "addr-spec" syntax from RFC 2822;



a single Space character;

a timestamp indicating the UTC date and time when the message
was originally received, conformant with the syntax of the
traditional UNIX 'ctime' output sans timezone (note that the
use of UTC precludes the need for a timezone indicator);

an end-of-line marker.

• Each message in the database MUST be terminated by an empty
line, containing a single end-of-line marker.

I create my own mbox from messages I send. I prepend a line that meets this test, except I don't pad day-of-month. The new mailx complains about single-digit day-of-month. The spec refers to ctime, which doesn't require it, at least as I read the man page.

scasey 12-10-2018 06:03 PM

Ahh. Very Interesting. I had no idea.

I'm sorry, I don't use mbox, I'm a Maildir guy; but perhaps the expanded explanation will draw knowledgeable responses.

['Tho, if the only thing that's changed is the version of mailx, I'd just probably start padding the month...with a fun script to update all the existing entries] ;)

ehartman 12-10-2018 07:27 PM

Quote:

Originally Posted by RandomTroll (Post 5935647)
I refer to rfc4155, the spec for mbox files.

Hmm, interesting. I never used mailx a lot, but the very first mbox format file I looked at (rather an old one) has this as its first line
Code:

From noreply@linux-mag.com Tue Jun  2 14:26:28 2009
and you see that IT has a double space before the day of month.
(btw, this was from a Linux magazine I was subscribed to at that time, I do not remember exactly what MTA I was using then, but it passed a lot of the university mail processing agents before it reached me). It was retrieved FROM a university (Delft University of Technology) server through imap, though, possibly by evolution.

So certainly at that time having a single digit day of month was no problem.

RandomTroll 12-10-2018 09:38 PM

Quote:

Originally Posted by scasey (Post 5935654)
if the only thing that's changed is the version of mailx, I'd just probably start padding the month...with a fun script to update all the existing entries

I figured that out. I've been using mailx for 30 years. This is the first time I've seen this behavior. I found 2 other bugs in the new maintainer's version, so maybe this was a bug. If it is, other mbox user(s) (is there another?) may have the same problem; if it is, he should fix it. That's why I asked about the ctime spec.

What I use is what date returns. I take that as a sign of what the spec is. To get a space-padded day-of-month, I have to specify every element. It'd be nice if date responded to an environment variable to get its default format.

Quote:

Originally Posted by ehartman (Post 5935667)
Hmm, interesting. I never used mailx a lot, but the very first mbox format file I looked at (rather an old one) has this as its first line
Code:

From noreply@linux-mag.com Tue Jun  2 14:26:28 2009
So certainly at that time having a single digit day of month was no problem.

That head line has 2 spaces between Jun and 2, what the new version of mailx expects, what old ones didn't
I don't object to accepting it. I ask about requiring it.

RandomTroll 12-11-2018 12:29 PM

A fellow on the s-mailx list pointed me to the relevant POSIX page http://pubs.opengroup.org/onlinepubs...s/asctime.html which says the day-of-month displayed by %2d , so it is POSIX.


All times are GMT -5. The time now is 02:12 AM.