-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mdeliver: ignore last empty line of mbox entries
https://www.loc.gov/preservation/digital/formats/fdd/fdd000383.shtml > Each message is immediately prefaced by a separation line and > terminated by an empty line. Bug discovered by skarnet. Fixes #207.
- Loading branch information
1 parent
70d3ec0
commit a73917f
Showing
2 changed files
with
85 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/bin/sh -e | ||
cd ${0%/*} | ||
. ./lib.sh | ||
plan 2 | ||
|
||
rm -rf test.dir | ||
mkdir test.dir | ||
cd test.dir | ||
|
||
mmkdir inbox | ||
|
||
cat <<EOF >tmp.1 | ||
Subject: message 1 | ||
This is message 1. | ||
EOF | ||
|
||
cat <<EOF >tmp.2 | ||
Subject: message 2 | ||
This is message 2. It has a trailing empty line. | ||
EOF | ||
|
||
printf >tmp.3 'Subject: message 3 | ||
This is message 3. It has a no trailing newline, oops.' | ||
|
||
cat <<EOF >tmp.4 | ||
Subject: message 4 | ||
This is message 4. It has multiple trailing empty lines. | ||
EOF | ||
|
||
mexport ./tmp.1 | mdeliver -M inbox/ | ||
check 'message 1 is delivered verbatim via mbox' 'cmp ./tmp.1 ./inbox/new/*:2,' | ||
rm -f ./inbox/new/* | ||
|
||
mexport ./tmp.2 | mdeliver -M inbox/ | ||
check 'message 2 is delivered verbatim via mbox' 'cmp ./tmp.2 ./inbox/new/*:2,' | ||
rm -f ./inbox/new/* | ||
|
||
mexport ./tmp.3 | mdeliver -M inbox/ | ||
check 'message 3 gets a newline via mbox' 'awk 1 ./tmp.3 | cmp - ./inbox/new/*:2,' | ||
rm -f ./inbox/new/* | ||
|
||
mexport ./tmp.4 | mdeliver -M inbox/ | ||
check 'message 4 gets delivered verbatim via mbox' 'cmp ./tmp.4 ./inbox/new/*:2,' | ||
rm -f ./inbox/new/* | ||
|
||
mdeliver inbox/ <./tmp.1 | ||
check 'message 1 is delivered verbatim via stdin' 'cmp ./tmp.1 ./inbox/new/*:2,' | ||
rm -f ./inbox/new/* | ||
|
||
mdeliver inbox/ <./tmp.2 | ||
check 'message 2 is delivered verbatim via stdin' 'cmp ./tmp.2 ./inbox/new/*:2,' | ||
rm -f ./inbox/new/* | ||
|
||
mdeliver inbox/ <./tmp.3 | ||
check 'message 3 gets a newline via stdin' 'cmp ./tmp.3 ./inbox/new/*:2,' | ||
rm -f ./inbox/new/* | ||
|
||
mdeliver inbox/ <./tmp.4 | ||
check 'message 4 is delivered verbatim via stdin' 'cmp ./tmp.4 ./inbox/new/*:2,' | ||
rm -f ./inbox/new/* |