Commit 1e33c774 1e33c774caafff0816a346ba1f34b6c7352b6874 by Sergey Poznyakoff

mh: open mailboxes in read-only mode unless the requested operation mandates otherwise.

* mh/mhn.c: Open mailbox in read-only mode.
* mh/mhseq.c: Likewise.
* mh/scan.c: Likewise.
* mh/pick.c: If sequences are given, open mailbox for RW, otherwise
open it for reading only.

* testsuite/testsuite.inc (MUT_MBCHMOD): New macro.
(MUT_MBCOPY): Take optional third argument - mailbox mode.
* mh/tests/mhl.at: Make sure mailboxes are r/o.
* mh/tests/mhn.at: Likewise.
* mh/tests/mhseq.at: Likewise.
* mh/tests/scan.at: Likewise.
1 parent 85032d0e
......@@ -2322,12 +2322,12 @@ edit_forw (char *cmd, struct compose_env *env, mu_message_t *pmsg, int level)
if (ws.ws_wordv[0][0] == '+')
{
mbox = mh_open_folder (ws.ws_wordv[0], MU_STREAM_RDWR);
mbox = mh_open_folder (ws.ws_wordv[0], MU_STREAM_READ);
i = 1;
}
else
{
mbox = mh_open_folder (mh_current_folder (), MU_STREAM_RDWR);
mbox = mh_open_folder (mh_current_folder (), MU_STREAM_READ);
i = 0;
}
......@@ -2970,7 +2970,7 @@ main (int argc, char **argv)
}
else
{
mbox = mh_open_folder (mh_current_folder (), MU_STREAM_RDWR);
mbox = mh_open_folder (mh_current_folder (), MU_STREAM_READ);
mh_msgset_parse (mbox, &msgset, argc, argv, "cur");
}
......
......@@ -80,7 +80,7 @@ main (int argc, char **argv)
argc -= index;
argv += index;
mbox = mh_open_folder (mh_current_folder (), MU_STREAM_RDWR);
mbox = mh_open_folder (mh_current_folder (), MU_STREAM_READ);
mh_msgset_parse (mbox, &msgset, argc, argv, "cur");
if (uid_option)
......
......@@ -390,7 +390,8 @@ main (int argc, char **argv)
if (pick_parse (lexlist))
return 1;
mbox = mh_open_folder (mh_current_folder (), MU_STREAM_RDWR);
mbox = mh_open_folder (mh_current_folder (),
seq_list ? MU_STREAM_RDWR : MU_STREAM_READ);
argc -= index;
argv += index;
......
......@@ -179,7 +179,7 @@ main (int argc, char **argv)
exit (1);
}
mbox = mh_open_folder (mh_current_folder (), MU_STREAM_RDWR);
mbox = mh_open_folder (mh_current_folder (), MU_STREAM_READ);
argc -= index;
argv += index;
......
......@@ -17,7 +17,7 @@
m4_pushdef([MH_KEYWORDS],[mhl])
MH_CHECK([mhl],[mhl00],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox],[700])
mhl -form mhl.format Mail/inbox/2
],
[0],
......@@ -35,7 +35,7 @@ I don't see any wine
])
MH_CHECK([mhl repl],[mhl01 mhl.repl],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox],[700])
mhl -form mhl.repl Mail/inbox/15
],
[0],
......@@ -46,7 +46,7 @@ mhl -form mhl.repl Mail/inbox/15
])
MH_CHECK([mhl usenet],[mhl02 mhl.usenet],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox],[700])
mhl -form mhl.usenet Mail/inbox/15
],
[0],
......
......@@ -21,7 +21,7 @@ dnl 1. List mode
dnl -------------------------------------------------------------------
MH_CHECK([mhn -list],[mhn00 mhn-list],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox],[700])
mhn +inbox -list all
],
[0],
......@@ -44,7 +44,7 @@ mhn +inbox -list all
])
MH_CHECK([mhn -list -realsize],[mhn01 mhn-list-realsize],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox],[700])
mhn +inbox -list -realsize all
],
[0],
......@@ -71,7 +71,7 @@ dnl 2. Store mode
dnl -------------------------------------------------------------------
MH_CHECK([mhn -store],[mhn02 mhn-store],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox],[700])
mhn +inbox -store 4 || exit $?
for file in 4.1.plain 4.2.1.octet-stream 4.2.2.1.octet-stream 4.2.2.2.octet-stream
do
......@@ -139,7 +139,7 @@ storing message 4 part 2.2.2 as file msg.24
])
MH_CHECK([mhn -store -auto -part],[mhn04 mhn-store-auto-part],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox],[700])
mhn +inbox -store -auto -part 2.2.1 4 | remove_curdir || exit $?
],
[0],
......@@ -150,6 +150,7 @@ MH_CHECK([mhn -store -auto (pathname safety)],[mhn05 mhn-store-auto-safety],[
mkdir Mail/inbox
sed 's|; *name="msg|; name="../msg|' \
$abs_top_srcdir/testsuite/mh/mbox1/4 > Mail/inbox/4
MUT_MBCHMOD(Mail/inbox, 700)
mhn +inbox -store -auto -part 2.1 4 || echo $?
echo == 4.2.1.octet-stream ==
cat 4.2.1.octet-stream
......@@ -171,7 +172,7 @@ Allow me to sell you a couple?'
MH_CHECK([mhn-storage],[mhn06 mhn-store-auto],[
mkdir Mail/inbox
cp $abs_top_srcdir/testsuite/mh/mbox1/4 Mail/inbox
chmod +w Mail/inbox/4
MUT_MBCHMOD(Mail/inbox, 700)
mkdir out
echo "mhn-storage: $curdir/out" >> $MH
......@@ -188,7 +189,7 @@ storing message 4 part 2.2.2 as file out/4.2.2.2.octet-stream
MH_CHECK([mhn-store-: all escapes],[mhn07 mhn-store_escapes],[
mkdir Mail/inbox
cp $abs_top_srcdir/testsuite/mh/mbox1/4 Mail/inbox
chmod +w Mail/inbox/4
MUT_MBCHMOD(Mail/inbox, 700)
echo "mhn-store-application: %%-%m%P.%s-%p" >> $MH
mhn +inbox -store 4 | remove_curdir || exit $?
......@@ -208,7 +209,7 @@ MH_CHECK([mhn-store-: absolute path],[mhn08 mhn-store_abspath],[
mkdir Mail/inbox
mkdir out
cp $abs_top_srcdir/testsuite/mh/mbox1/4 Mail/inbox
chmod +w Mail/inbox/4
MUT_MBCHMOD(Mail/inbox, 700)
echo "mhn-store-application: $curdir/out/%m%P.%s" >> $MH
mhn +inbox -store 4 | remove_curdir || exit $?
......@@ -224,7 +225,7 @@ MH_CHECK([mhn-store-: +folder],[mhn09 mhn-store+folder],[
mkdir Mail/inbox
mkdir Mail/app
cp $abs_top_srcdir/testsuite/mh/mbox1/4 Mail/inbox
chmod +w Mail/inbox/4
MUT_MBCHMOD(Mail, 700)
echo "mhn-store-application: +app" >> $MH
mhn +inbox -store 4 | remove_curdir || exit $?
......@@ -239,7 +240,7 @@ storing message 4 part 2.2.2 to folder +app as message 3
MH_CHECK([mhn-store-: +],[mhn10 mhn-store+],[
mkdir Mail/inbox
cp $abs_top_srcdir/testsuite/mh/mbox1/4 Mail/inbox
chmod +w Mail/inbox/4
MUT_MBCHMOD(Mail/inbox, 700)
echo "Current-Folder: inbox" > Mail/context
cat >> $MH <<EOT
......@@ -251,15 +252,15 @@ mhn +inbox -store -part 2.2.1 4 | remove_curdir || exit $?
[storing message 4 part 2.2.1 to folder inbox as message 5
])
MH_CHECK([mhn-store-: pipe],[mhn11 mhn-store-pipe],[[
MH_CHECK([mhn-store-: pipe],[mhn11 mhn-store-pipe],[
mkdir Mail/inbox
cp $abs_top_srcdir/testsuite/mh/mbox1/4 Mail/inbox
chmod +w Mail/inbox/4
MUT_MBCHMOD(Mail/inbox, 700)
echo "Current-Folder: inbox" > Mail/context
echo "mhn-store-text: | $abs_top_srcdir/mh/tests/mhed -" >> $MH
mhn +inbox -store -part 1 4 | sed "s|$abs_top_srcdir/mh/tests/||;s|(cd \(.*\)\;|(cd home\;|;s| *$||" || exit $?
]],
],
[0],
[-- Editor invocation: -
-- Input file:
......@@ -281,7 +282,7 @@ dnl -------------------------------------------------------------------
dnl 3. Show mode
dnl -------------------------------------------------------------------
MH_CHECK([mhn-show msg1],[mhn12 mhn-show-msg1],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox],[700])
mhn -show 1 | sed /^X-IMAPbase/d
],
[0],
......@@ -332,7 +333,7 @@ And the mome raths outgrabe.
])
MH_CHECK([mhn-show type=tar],[mhn13 mhn-show-type=tar],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mime,[Mail/inbox])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mime,[Mail/inbox],[700])
AT_DATA([filter.awk],[
/^X-IMAPbase/ { next }
/^-rw-r--r--/ { print $1, $2, $3, $6; next }
......@@ -360,7 +361,7 @@ Initial text.
# FIXME: What about exit code?
# FIXME: See comment about the error message, near mhn.c:792
MH_CHECK([mhn-show unsupported type],[mhn14 mhn-show-unsupported-type],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mime,[Mail/inbox])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mime,[Mail/inbox],[700])
mhn -show 1 | sed /^X-IMAPbase/d
],
[0],
......@@ -382,7 +383,7 @@ Initial text.
MH_CHECK([mhn-show- variable (with subtype)],
[mhn15 mhn-show-with-subtype],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mime,[Mail/inbox])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mime,[Mail/inbox],[700])
echo "mhn-show-application/x-tar: %ltar tvf '%F'" >> $MH
AT_DATA([filter.awk],[
/^X-IMAPbase/ { next }
......@@ -411,7 +412,7 @@ part 2 application/x-tar 13835
MH_CHECK([mhn-show- variable (without subtype)],
[mhn16 mhn-show-without-subtype],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mime,[Mail/inbox])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mime,[Mail/inbox],[700])
echo "mhn-show-application: %ltar tvf '%F'" >> $MH
AT_DATA([filter.awk],[
/^X-IMAPbase/ { next }
......@@ -821,7 +822,7 @@ Content-Description: Single line part
MH_CHECK([mhn-compose: forward (single message)],
[mhn23 mhn-compose mhn-compose-07],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox],[700])
AT_DATA([input],
[From: gray@example.net
Subject: Forwards
......@@ -925,7 +926,7 @@ Content-Type: application/octet-stream; type=tar; conversions=compress
MH_CHECK([mhn-compose: multipart],
[mhn25 mhn-compose mhn-compose-09],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail],[700])
AT_DATA([foo.tar],
[Not a tarball, really
......
......@@ -19,7 +19,7 @@ m4_pushdef([MH_KEYWORDS],[mhseq mh-sequences])
dnl ---------------------------------------------------------------
MH_CHECK([mhseq: existing message number],[mhseq00],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox],[700])
mhseq 1
],
[0],
......@@ -27,7 +27,7 @@ mhseq 1
])
MH_CHECK([mhseq: not existing message number],[mhseq01],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox],[700])
mhseq 100
],
[1],
......@@ -37,7 +37,7 @@ dnl FIXME: See FIXME 3 in mhpath.at
])
MH_CHECK([mhseq: contiguous message range],[mhseq02],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox],[700])
mhseq 2-5
],
[0],
......@@ -48,7 +48,7 @@ mhseq 2-5
])
MH_CHECK([mhseq: reversed contiguous message range],[mhseq03],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox],[700])
mhseq 5-2
],
[0],
......@@ -61,6 +61,7 @@ mhseq 5-2
MH_CHECK([mhseq: reversed non-contiguous message range],[mhseq04],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
rm Mail/inbox/3 Mail/inbox/4
MUT_MBCHMOD(Mail/inbox, 700)
mhseq 5-2
],
[0],
......@@ -71,6 +72,7 @@ mhseq 5-2
MH_CHECK([mhseq: message range (left fixup)],[mhseq05],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
rm Mail/inbox/1 Mail/inbox/2
MUT_MBCHMOD(Mail/inbox, 700)
mhseq 1-5
],
[0],
......@@ -82,6 +84,7 @@ mhseq 1-5
MH_CHECK([mhseq: message range (right fixup)],[mhseq06],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
rm Mail/inbox/4 Mail/inbox/5
MUT_MBCHMOD(Mail/inbox, 700)
mhseq 1-5
],
[0],
......@@ -93,6 +96,7 @@ mhseq 1-5
MH_CHECK([mhseq: message range (both fixups)],[mhseq07],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
rm Mail/inbox/1 Mail/inbox/5
MUT_MBCHMOD(Mail/inbox, 700)
mhseq 1-5
],
[0],
......@@ -104,6 +108,7 @@ mhseq 1-5
MH_CHECK([mhseq: non-existent message range (left)],[mhseq08],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
rm Mail/inbox/1 Mail/inbox/2 Mail/inbox/3
MUT_MBCHMOD(Mail/inbox, 700)
mhseq 1-2
],
[1],
......@@ -112,7 +117,7 @@ mhseq 1-2
])
MH_CHECK([mhseq: non-existent message range (right)],[mhseq09],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox],[700])
mhseq 6-10
],
[1],
......@@ -121,7 +126,7 @@ mhseq 6-10
])
MH_CHECK([mhseq: message set addition],[mhseq10],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox],[700])
mhseq 5 8-10 15-20
],
[0],
......@@ -140,6 +145,7 @@ mhseq 5 8-10 15-20
MH_CHECK([mhseq: message set optimization],[mhseq11],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox])
rm Mail/inbox/17 Mail/inbox/19
MUT_MBCHMOD(Mail/inbox, 700)
mhseq 5 1-10 15-20
],
[0],
......@@ -160,7 +166,7 @@ mhseq 5 1-10 15-20
])
MH_CHECK([mhseq: counted range (positive)],[mhseq12],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox],[700])
mhseq 10:4
],
[0],
......@@ -173,6 +179,7 @@ mhseq 10:4
MH_CHECK([mhseq: non-contiguous counted range (positive)],[mhseq13],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox])
rm Mail/inbox/12 Mail/inbox/14
MUT_MBCHMOD(Mail/inbox, 700)
mhseq 10:4
],
[0],
......@@ -185,6 +192,7 @@ mhseq 10:4
MH_CHECK([mhseq: counted range (positive, left fixup)],[mhseq14],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
rm Mail/inbox/1 Mail/inbox/2
MUT_MBCHMOD(Mail/inbox, 700)
mhseq 1:3
],
[0],
......@@ -194,7 +202,7 @@ mhseq 1:3
])
MH_CHECK([mhseq: counted range (positive, right fixup)],[mhseq15],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox],[700])
mhseq 2:10
],
[0],
......@@ -207,6 +215,7 @@ mhseq 2:10
MH_CHECK([mhseq: invalid counted range (negative)],[mhseq16],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
rm Mail/inbox/1 Mail/inbox/2
MUT_MBCHMOD(Mail/inbox, 700)
mhseq 10:2
],
[1],
......@@ -215,7 +224,7 @@ mhseq 10:2
])
MH_CHECK([mhseq: counted range (negative)],[mhseq17],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox],[700])
mhseq 10:-4
],
[0],
......@@ -228,6 +237,7 @@ mhseq 10:-4
MH_CHECK([mhseq: non-contiguous counted range (negative)],[mhseq18],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox])
rm Mail/inbox/8 Mail/inbox/6
MUT_MBCHMOD(Mail/inbox, 700)
mhseq 10:-4
],
[0],
......@@ -240,6 +250,7 @@ mhseq 10:-4
MH_CHECK([mhseq: counted range (negative, left fixup)],[mhseq19],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
rm Mail/inbox/1 Mail/inbox/2
MUT_MBCHMOD(Mail/inbox, 700)
mhseq 4:-30
],
[0],
......@@ -250,6 +261,7 @@ mhseq 4:-30
MH_CHECK([mhseq: counted range (negative, right fixup)],[mhseq20],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
rm Mail/inbox/1 Mail/inbox/2
MUT_MBCHMOD(Mail/inbox, 700)
mhseq 4:30
],
[0],
......@@ -260,6 +272,7 @@ mhseq 4:30
MH_CHECK([mhseq: invalid counted range (negative)],[mhseq21],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
rm Mail/inbox/1 Mail/inbox/2
MUT_MBCHMOD(Mail/inbox, 700)
mhseq 1:-30
],
[1],
......@@ -270,6 +283,7 @@ mhseq 1:-30
MH_CHECK([mhseq: cur],[mhseq22 cur],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
echo "cur: 3" > Mail/inbox/.mh_sequences
MUT_MBCHMOD(Mail/inbox, 700)
mhseq cur
],
[0],
......@@ -279,6 +293,7 @@ mhseq cur
MH_CHECK([mhseq: cur:n -- default direction],[mhseq23 cur:n],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
echo "cur: 3" > Mail/inbox/.mh_sequences
MUT_MBCHMOD(Mail/inbox, 700)
mhseq cur:2
],
[0],
......@@ -289,6 +304,7 @@ mhseq cur:2
MH_CHECK([mhseq: cur:n -- explicit dir (negative)],[mhseq24 cur:n cur:n-],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
echo "cur: 3" > Mail/inbox/.mh_sequences
MUT_MBCHMOD(Mail/inbox, 700)
mhseq cur:-2
],
[0],
......@@ -299,6 +315,7 @@ mhseq cur:-2
MH_CHECK([mhseq: cur:n -- explicit dir (positive)],[mhseq25 cur:n cur:n+],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
echo "cur: 3" > Mail/inbox/.mh_sequences
MUT_MBCHMOD(Mail/inbox, 700)
mhseq cur:+2
],
[0],
......@@ -310,6 +327,7 @@ MH_CHECK([mhseq: next],[mhseq26 next],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
echo "cur: 3" > Mail/inbox/.mh_sequences
rm Mail/inbox/4
MUT_MBCHMOD(Mail/inbox, 700)
mhseq next
],
[0],
......@@ -319,6 +337,7 @@ mhseq next
MH_CHECK([mhseq: next:n -- default direction],[mhseq27 next:n],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
echo "cur: 3" > Mail/inbox/.mh_sequences
MUT_MBCHMOD(Mail/inbox, 700)
mhseq next:2
],
[0],
......@@ -330,6 +349,7 @@ MH_CHECK([mhseq: prev],[mhseq28 prev],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
echo "cur: 3" > Mail/inbox/.mh_sequences
rm Mail/inbox/2
MUT_MBCHMOD(Mail/inbox, 700)
mhseq prev
],
[0],
......@@ -339,6 +359,7 @@ mhseq prev
MH_CHECK([mhseq: prev:n -- default direction],[mhseq29 prev:n],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
echo "cur: 3" > Mail/inbox/.mh_sequences
MUT_MBCHMOD(Mail/inbox, 700)
mhseq prev:2
],
[0],
......@@ -349,6 +370,7 @@ mhseq prev:2
MH_CHECK([mhseq: first],[mhseq30 first],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
rm Mail/inbox/1
MUT_MBCHMOD(Mail/inbox, 700)
mhseq first
],
[0],
......@@ -358,6 +380,7 @@ mhseq first
MH_CHECK([mhseq: first:n -- default direction],[mhseq31 first:n],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
rm Mail/inbox/1
MUT_MBCHMOD(Mail/inbox, 700)
mhseq first:2
],
[0],
......@@ -366,7 +389,7 @@ mhseq first:2
])
MH_CHECK([mhseq: last],[mhseq32 last],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox],[700])
mhseq last
],
[0],
......@@ -374,7 +397,7 @@ mhseq last
])
MH_CHECK([mhseq: last:n -- default direction],[mhseq33 last:n],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox],[700])
mhseq last:2
],
[0],
......
......@@ -17,7 +17,7 @@
m4_pushdef([MH_KEYWORDS],[scan])
MH_CHECK([scan],[scan00],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox],[700])
echo "Current-Folder: inbox" > Mail/context
scan | sed 's/ *$//'
],
......@@ -30,7 +30,7 @@ scan | sed 's/ *$//'
])
MH_CHECK([scan -folder],[scan01 scan-folder],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox],[700])
scan +inbox | sed 's/ *$//'
],
[0],
......@@ -42,7 +42,7 @@ scan +inbox | sed 's/ *$//'
])
MH_CHECK([scan -format],[scan02 scan-format],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail],[700])
scan +mbox1 -format '%4(msg) %{from} - %{to}'
],
[0],
......@@ -54,7 +54,7 @@ scan +mbox1 -format '%4(msg) %{from} - %{to}'
])
MH_CHECK([scan -form],[scan03 scan-form],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail],[700])
echo '%4(msg) %(decode(friendly{from})) - %(decode(friendly{to}))' > formfile
scan +mbox1 -form formfile
],
......@@ -67,7 +67,7 @@ scan +mbox1 -form formfile
])
MH_CHECK([scan -reverse],[scan04 scan-reverse],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail])
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail],[700])
scan +mbox1 -reverse | sed 's/ *$//'
],
[0],
......
......@@ -45,17 +45,28 @@ AT_CLEANUP
])
dnl ------------------------------------------------------------
dnl MUT_MBCOPY(SRC, [DST = `.']) -- Copy mailbox SRC to DST.
dnl MUT_MBCHMOD(MBOX, MODE)
dnl
m4_define([MUT_MBCHMOD],[
# First, set all modes to $2
find $1 | xargs chmod $2
# Then, remove executable bit from regular files
find $1 -type f | xargs chmod -x
])
dnl ------------------------------------------------------------
dnl MUT_MBCOPY(SRC, [DST = `.'], [mode]) -- Copy mailbox SRC to DST.
dnl
dnl
m4_define([MUT_MBCOPY],[
m4_pushdef([__dst],[m4_if([$2],,[.],[$2])])
m4_pushdef([__basename],[m4_bregexp($1,[.*/\([^/]+\)$],\1)])
m4_pushdef([__mode],[m4_if([$3],,[+w],[$3])])
cp -r $1 __dst
if test -e __dst/__basename; then
chmod -R +w __dst/__basename
MUT_MBCHMOD(__dst/__basename, __mode)
else
chmod -R +w __dst
MUT_MBCHMOD(__dst, __mode)
fi
m4_popdef([__basename])
m4_popdef([__dst])
......