Commit a04c6feb a04c6feb5007aeeb133b15558f13733743dee3e8 by Sergey Poznyakoff Committed by Sergey Poznyakoff

Fix expansion of #, &, %, etc. in mail copy and file commands.

This was accidentally broken by commit eea2c4aa.

* include/mailutils/mailbox.h (mu_mailbox_expand_name): New proto.
* libmailutils/mailbox/mbx_default.c (mu_mailbox_expand_name): New function.
(mu_mailbox_create_default): Use it.
(mu_set_folder_directory): Accept NULL as argument.
(mu_folder_directory): Reset default value after assiging it.  This way
the folder directory still defaults to the same value as earlier, but
can be reset to NULL, if so desired.
(plus_expand): Return a copy of the input string if folder is NULL.

* mail/copy.c (append_to_mailbox): Use mu_mailbox_create, as the mailbox
name has already been expanded.
* mail/file.c (mail_expand_name): Use mu_mailbox_expand_name.
(mail_file): Use mu_mailbox_create, as the mailbox
name has already been expanded.
* mail/mailvar.c (mailvar_cmd): New enum.
(mailvar_symbol) <handler>: Change signature and return type.
(mailvar_set): Rewrite. Take care not to modify the variable
if the handler (if any) returns non-null or if the memory can't
be allocated.
(set_folder): Handler for the "folder" variable.

* mail/tests/copy01.at: New testcase.
* mail/tests/copy02.at: New testcase.
* mail/tests/copy03.at: New testcase.
* mail/tests/copy04.at: New testcase.
* mail/tests/Makefile.am: Add new tests.
* mail/tests/testsuite.at (MUT_MAIL_CMD): Set MAILRC to /dev/null.
Add new tests.
1 parent aba91e51
......@@ -36,6 +36,8 @@ const char *mu_mailbox_url (void);
const char *mu_folder_directory (void);
int mu_construct_user_mailbox_url (char **pout, const char *name);
int mu_mailbox_expand_name (const char *name, char **expansion);
/* Constructor/destructor and possible types. */
extern int mu_mailbox_create (mu_mailbox_t *, const char *);
extern int mu_mailbox_create_from_url (mu_mailbox_t *, mu_url_t);
......
......@@ -117,9 +117,17 @@ mu_set_mailbox_pattern (const char *pat)
int
mu_set_folder_directory (const char *p)
{
char *fdir = strdup (p);
char *fdir;
if (p)
{
fdir = strdup (p);
if (!fdir)
return ENOMEM;
}
else
fdir = NULL;
if (_mu_folder_dir != _default_folder_dir)
free (_mu_folder_dir);
_mu_folder_dir = fdir;
......@@ -127,7 +135,7 @@ mu_set_folder_directory (const char *p)
}
const char *
mu_mailbox_url ()
mu_mailbox_url (void)
{
if (_mu_mailbox_pattern)
return _mu_mailbox_pattern;
......@@ -135,10 +143,13 @@ mu_mailbox_url ()
}
const char *
mu_folder_directory ()
mu_folder_directory (void)
{
if (!_mu_folder_dir)
_mu_folder_dir = _default_folder_dir;
if (!_mu_folder_dir && _default_folder_dir)
{
mu_set_folder_directory (_default_folder_dir);
_default_folder_dir = NULL;
}
return _mu_folder_dir;
}
......@@ -286,30 +297,40 @@ user_mailbox_name (const char *user, char **mailbox_name)
static int
plus_expand (const char *file, char **buf)
{
char *home;
int rc = 0;
const char *folder_dir = mu_folder_directory ();
home = get_homedir (NULL);
if (!home)
return ENOENT;
if (!folder_dir)
{
char *p = strdup (file);
if (!p)
return ENOMEM;
*buf = p;
}
else
{
file++;
if (folder_dir[0] == '/' || mu_is_proto (folder_dir))
{
*buf = mu_make_file_name (folder_dir, file);
if (!*buf)
char *p = mu_make_file_name (folder_dir, file);
if (!p)
return errno;
*buf = p;
}
else
{
int rc = mu_asprintf (buf, "%s/%s/%s", home, folder_dir, file);
if (rc)
return rc;
}
char *home = get_homedir (NULL);
if (!home)
return ENOENT;
rc = mu_asprintf (buf, "%s/%s/%s", home, folder_dir, file);
free (home);
return 0;
}
}
return rc;
}
static int
......@@ -374,21 +395,75 @@ attach_auth_ticket (mu_mailbox_t mbox)
}
}
/* We are trying to be smart about the location of the mail.
mu_mailbox_create() is not doing this.
% --> system mailbox for the real uid
%user --> system mailbox for the given user
~/file --> /home/user/file
~user/file --> /home/user/file
+file --> /home/user/Mail/file
=file --> /home/user/Mail/file
*/
/* Expand mailbox name according to the following rules:
NAME Expands to
-------------+------------------------------------
% -> system mailbox for the real uid
%user -> system mailbox for the given user
~/file -> /home/user/file
~user/file -> /home/user/file
+file -> /home/user/Mail/file
=file -> /home/user/Mail/file
*/
int
mu_mailbox_create_default (mu_mailbox_t *pmbox, const char *mail)
mu_mailbox_expand_name (const char *name, char **expansion)
{
char *mbox = NULL;
char *tmp_mbox = NULL;
int status = 0;
char *p;
char *mbox = NULL;
if (!name)
return EINVAL;
if (!expansion)
return MU_ERR_OUT_PTR_NULL;
p = mu_tilde_expansion (name, MU_HIERARCHY_DELIMITER, NULL);
if (!p)
return errno;
switch (p[0])
{
case '%':
status = percent_expand (p, &mbox);
break;
case '+':
case '=':
status = plus_expand (p, &mbox);
break;
case '/':
mbox = p;
p = NULL;
break;
default:
if (!mu_is_proto (p))
{
char *dir = mu_getcwd();
mbox = mu_make_file_name (dir, p);
if (!mbox)
status = errno;
free (dir);
}
else
{
mbox = p;
p = NULL;
}
}
free (p);
if (status == 0)
*expansion = mbox;
return status;
}
/* Expand mailbox name MAIL and create a mailbox structure for it. */
int
mu_mailbox_create_default (mu_mailbox_t *pmbox, const char *mail)
{
char *mboxname = NULL;
char *name_ptr = NULL;
int status = 0;
/* Sanity. */
......@@ -412,63 +487,19 @@ mu_mailbox_create_default (mu_mailbox_t *pmbox, const char *mail)
if (!mail)
{
if ((status = user_mailbox_name (NULL, &tmp_mbox)))
if ((status = user_mailbox_name (NULL, &name_ptr)))
return status;
mail = tmp_mbox;
}
}
p = mu_tilde_expansion (mail, MU_HIERARCHY_DELIMITER, NULL);
if (tmp_mbox)
free (tmp_mbox);
tmp_mbox = p;
mail = tmp_mbox;
if (!mail)
return ENOMEM;
switch (mail[0])
{
case '%':
status = percent_expand (mail, &mbox);
break;
case '+':
case '=':
status = plus_expand (mail, &mbox);
break;
case '/':
mbox = strdup (mail);
if (!mbox)
status = errno;
break;
default:
if (!mu_is_proto (mail))
{
p = mu_getcwd();
mbox = mu_make_file_name (p, mail);
if (!mbox)
status = errno;
free (p);
}
else
{
mbox = strdup (mail);
if (!mbox)
status = errno;
mail = name_ptr;
}
break;
}
if (tmp_mbox)
free (tmp_mbox);
status = mu_mailbox_expand_name (mail, &mboxname);
free (name_ptr);
if (status)
return status;
status = mu_mailbox_create (pmbox, mbox);
free (mbox);
status = mu_mailbox_create (pmbox, mboxname);
free (mboxname);
if (status == 0)
attach_auth_ticket (*pmbox);
......
......@@ -40,7 +40,7 @@ append_to_mailbox (char const *filename, msgset_t *msglist, int mark,
size_t size;
mu_message_t msg;
if ((status = mu_mailbox_create_default (&mbx, filename)) != 0)
if ((status = mu_mailbox_create (&mbx, filename)) != 0)
{
mu_error (_("Cannot create mailbox %s: %s"), filename,
mu_strerror (status));
......
......@@ -23,44 +23,43 @@ static char *prev_name;
* # the previous file
* & the current mbox
* +file the file named in the folder directory (set folder=foo)
* Note 1) The followig notations are left intact, since they are
* handled by mu_mailbox_create_default:
* % system mailbox
* %user system mailbox of the user
* Note 2) Allocates memory
*/
char *
mail_expand_name (const char *name)
{
switch (name[0])
int status = 0;
char *exp = NULL;
if (strcmp (name, "#") == 0)
{
case '#':
if (!prev_name)
{
mu_error (_("No previous file"));
return NULL;
}
else
name = mu_strdup (prev_name);
break;
return mu_strdup (prev_name);
}
case '&':
if (strcmp (name, "&") == 0)
{
name = getenv ("MBOX");
if (!name)
{
mu_error (_("MBOX environment variable not set"));
else
name = mu_strdup (name);
break;
return NULL;
}
/* else fall through */
}
case '+':
name = util_folder_path (name);
break;
status = mu_mailbox_expand_name (name, &exp);
default:
name = mu_strdup (name);
break;
}
return (char*) name;
if (status)
mu_error (_("Failed to expand %s: %s"), name, mu_strerror (status));
return (char*) exp;
}
/*
......@@ -87,7 +86,7 @@ mail_file (int argc, char **argv)
if (!name)
return 1;
if ((status = mu_mailbox_create_default (&newbox, name)) != 0
if ((status = mu_mailbox_create (&newbox, name)) != 0
|| (status = mu_mailbox_open (newbox, MU_STREAM_RDWR)) != 0)
{
mu_mailbox_destroy (&newbox);
......
......@@ -538,10 +538,10 @@ compile_headline (const char *str)
static struct header_segm *mail_header_line;
void
mail_compile_headline (struct mailvar_variable *var)
mail_compile_headline (char const *str)
{
free_headline (mail_header_line);
mail_header_line = compile_headline (var->value.string);
mail_header_line = compile_headline (str);
}
......
......@@ -330,6 +330,7 @@ static char *default_setup[] = {
"set noinplacealiases",
"set fromfield",
"set headline=\"%>%a%4m %18f %16d %3L/%-5o %s\"",
"unset folder",
/* Start in mail reading mode */
"setq mode=read",
......
......@@ -193,7 +193,7 @@ extern int mail_folders (int argc, char **argv);
extern int mail_followup (int argc, char **argv);
extern int mail_from (int argc, char **argv);
extern int mail_from0 (msgset_t *mspec, mu_message_t msg, void *data);
extern void mail_compile_headline (struct mailvar_variable *var);
extern void mail_compile_headline (char const *str);
extern int mail_headers (int argc, char **argv);
extern int mail_hold (int argc, char **argv);
......
......@@ -22,20 +22,34 @@
#define MAILVAR_TYPEMASK(type) (1<<(8+(type)))
enum mailvar_cmd
{
mailvar_cmd_set,
mailvar_cmd_unset
};
struct mailvar_symbol
{
struct mailvar_variable var;
int flags;
char *descr;
void (*handler) (struct mailvar_variable *);
int (*handler) (enum mailvar_cmd, struct mailvar_variable *);
};
mu_list_t mailvar_list = NULL;
static void set_decode_fallback (struct mailvar_variable *);
static void set_replyregex (struct mailvar_variable *);
static void set_screen (struct mailvar_variable *);
static void set_debug (struct mailvar_variable *);
static int set_decode_fallback (enum mailvar_cmd cmd,
struct mailvar_variable *);
static int set_replyregex (enum mailvar_cmd cmd,
struct mailvar_variable *);
static int set_screen (enum mailvar_cmd cmd,
struct mailvar_variable *);
static int set_debug (enum mailvar_cmd cmd,
struct mailvar_variable *);
static int set_folder (enum mailvar_cmd cmd,
struct mailvar_variable *);
static int set_headline (enum mailvar_cmd,
struct mailvar_variable *);
struct mailvar_symbol mailvar_tab[] =
{
......@@ -119,7 +133,8 @@ struct mailvar_symbol mailvar_tab[] =
N_("swap the meaning of reply and Reply commands") },
{ { "folder", },
MAILVAR_TYPEMASK (mailvar_type_string),
N_("folder directory name") },
N_("folder directory name"),
set_folder },
{ { "fromfield", },
MAILVAR_TYPEMASK (mailvar_type_boolean),
N_("get sender address from the `From:' header, instead of "
......@@ -133,7 +148,7 @@ struct mailvar_symbol mailvar_tab[] =
{ { "headline", },
MAILVAR_TYPEMASK (mailvar_type_string),
N_("format string to use for the header summary"),
mail_compile_headline },
set_headline },
{ { "hold", },
MAILVAR_TYPEMASK (mailvar_type_boolean),
N_("hold the read or saved messages in the system mailbox") },
......@@ -471,9 +486,10 @@ int
mailvar_set (const char *variable, void *value, enum mailvar_type type,
int flags)
{
struct mailvar_variable *var;
struct mailvar_variable *var, newvar;
const struct mailvar_symbol *sym = find_mailvar_symbol (variable);
int unset = flags & MOPTF_UNSET;
enum mailvar_cmd cmd =
(flags & MOPTF_UNSET) ? mailvar_cmd_unset : mailvar_cmd_set;
if (!(flags & MOPTF_QUIET)
&& mailvar_get (NULL, "variable-strict", mailvar_type_boolean, 0) == 0)
......@@ -488,95 +504,174 @@ mailvar_set (const char *variable, void *value, enum mailvar_type type,
return 1;
}
else if (!(sym->flags & MAILVAR_TYPEMASK (type))
&& !unset)
&& cmd == mailvar_cmd_set)
{
mu_error (_("Wrong type for %s"), variable);
return 1;
}
}
var = mailvar_find_variable (variable, !unset);
var = mailvar_find_variable (variable, cmd == mailvar_cmd_set);
if (!var || (var->set && !(flags & MOPTF_OVERWRITE)))
return 0;
mailvar_variable_reset (var);
if (!unset)
newvar.name = var->name;
newvar.type = var->type;
newvar.set = 0;
memset (&newvar.value, 0, sizeof (newvar.value));
switch (cmd)
{
var->type = type;
case mailvar_cmd_set:
if (value)
{
var->set = 1;
switch (type)
{
case mailvar_type_number:
var->value.number = *(int*)value;
newvar.value.number = *(int*)value;
break;
case mailvar_type_string:
var->value.string = strdup (value);
{
char *p = strdup (value);
if (!p)
{
mu_error ("%s", _("Not enough memory"));
return 1;
}
newvar.value.string = p;
}
break;
case mailvar_type_boolean:
var->value.bool = *(int*)value;
newvar.value.bool = *(int*)value;
break;
default:
abort();
}
newvar.set = 1;
}
newvar.type = type;
if (sym
&& sym->handler
&& sym->flags & MAILVAR_TYPEMASK (type)
&& sym->handler (cmd, &newvar))
{
mailvar_variable_reset (&newvar);
return 1;
}
mailvar_variable_reset (var);
*var = newvar;
break;
/* Special handling for some variables */
if (sym && sym->flags & MAILVAR_TYPEMASK (type) && sym->handler)
sym->handler (var);
case mailvar_cmd_unset:
if (sym
&& sym->handler
&& sym->handler (cmd, var))
return 1;
mailvar_variable_reset (var);
}
return 0;
}
static int
set_folder (enum mailvar_cmd cmd, struct mailvar_variable *var)
{
int rc = mu_set_folder_directory (var->value.string);
if (rc)
mu_diag_funcall (MU_DIAG_ERROR, "mu_set_folder_directory",
var->value.string, rc);
return rc;
}
static void
set_decode_fallback (struct mailvar_variable *var)
static int
set_headline (enum mailvar_cmd cmd, struct mailvar_variable *var)
{
if (mu_set_default_fallback (var->value.string))
if (cmd == mailvar_cmd_unset)
return 1;
mail_compile_headline (var->value.string);
return 0;
}
static int
set_decode_fallback (enum mailvar_cmd cmd, struct mailvar_variable *var)
{
char *value;
int rc;
switch (cmd)
{
case mailvar_cmd_set:
value = var->value.string;
break;
case mailvar_cmd_unset:
value = "none";
}
rc = mu_set_default_fallback (value);
if (rc)
mu_error (_("Incorrect value for decode-fallback"));
return rc;
}
static void
set_replyregex (struct mailvar_variable *var)
static int
set_replyregex (enum mailvar_cmd cmd, struct mailvar_variable *var)
{
int rc;
char *err;
switch (cmd)
{
case mailvar_cmd_set:
if ((rc = mu_unre_set_regex (var->value.string, 0, &err)))
{
if (err)
mu_error ("%s: %s", mu_strerror (rc), err);
else
mu_error ("%s", mu_strerror (rc));
return 1;
}
break;
case mailvar_cmd_unset:
return 1;
}
return 0;
}
static void
set_screen (struct mailvar_variable *var)
static int
set_screen (enum mailvar_cmd cmd, struct mailvar_variable *var)
{
if (cmd == mailvar_cmd_set)
page_invalidate (1);
return 0;
}
#define DEFAULT_DEBUG_LEVEL MU_DEBUG_LEVEL_UPTO (MU_DEBUG_TRACE7)
static void
set_debug (struct mailvar_variable *var)
static int
set_debug (enum mailvar_cmd cmd, struct mailvar_variable *var)
{
mu_debug_clear_all ();
if (cmd == mailvar_cmd_set)
{
if (var->type == mailvar_type_boolean)
{
if (var->set)
mu_debug_set_category_level (MU_DEBCAT_ALL, DEFAULT_DEBUG_LEVEL);
return;
return 0;
}
mu_debug_parse_spec (var->value.string);
}
return 0;
}
......
......@@ -42,6 +42,10 @@ TESTSUITE_AT =\
cols00.at\
cols01.at\
copy00.at\
copy01.at\
copy02.at\
copy03.at\
copy04.at\
nohome.at\
testsuite.at\
version.at
......
......@@ -24,7 +24,6 @@ AT_KEYWORDS([columns cols00])
AT_CHECK([
MUT_MBCOPY($abs_top_srcdir/testsuite/spool/mbox)
unset MAILRC
COLUMNS=26 MUT_MAIL_CMD -nH -E 'set columns=26' -f ./mbox
COLUMNS=31 MUT_MAIL_CMD -nH -f ./mbox
],
......
......@@ -24,7 +24,6 @@ AT_KEYWORDS([columns cols01])
AT_CHECK([
MUT_MBCOPY($abs_top_srcdir/testsuite/spool/mbox)
unset MAILRC
MUT_MAIL_CMD -nH -E 'set columns=26' -f ./mbox
MUT_MAIL_CMD -nH -E 'set columns=31' -f ./mbox
],
......
......@@ -25,7 +25,6 @@ AT_KEYWORDS([copy copy00])
AT_CHECK([
test -f /dev/stdout || AT_SKIP_TEST
MUT_MBCOPY($abs_top_srcdir/testsuite/spool/mbox)
unset MAILRC
echo 'copy 1 /dev/stdout' | MUT_MAIL_CMD -N -E 'set readonly' -f ./mbox | sed 's/ *$//;/^Held 1 message/d';
],
[0],
......
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2015-2016 Free Software Foundation, Inc.
#
# GNU Mailutils is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3, or (at
# your option) any later version.
#
# GNU Mailutils is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
AT_SETUP([copy: % expansion])
AT_KEYWORDS([copy copy01])
# Description: Check whether special mailbox notations are correctly expanded
# in copy command. This was broken by commit eea2c4aa.
#
# This testcase checks for expansion of "%".
AT_CHECK([
MUT_MBCOPY($abs_top_srcdir/testsuite/spool/mbox)
mbox=`pwd`/user
echo 'copy 1 %' | dnl
MUT_MAIL_CMD -N -f ./mbox --set '|mailbox|mailbox-pattern'=$mbox | dnl
sed 's/ *$//;/^Held 1 message/d;s|'$mbox'|MBOX|'
cmp user $abs_top_srcdir/testsuite/spool/mbox
],
[0],
["MBOX" 14/438
])
AT_CLEANUP
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2015-2016 Free Software Foundation, Inc.
#
# GNU Mailutils is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3, or (at
# your option) any later version.
#
# GNU Mailutils is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
AT_SETUP([copy: + expansion])
AT_KEYWORDS([copy copy02])
# Description: Check whether special mailbox notations are correctly expanded
# in copy command. This was broken by commit eea2c4aa.
#
# This testcase checks for expansion of "+".
AT_CHECK([
MUT_MBCOPY($abs_top_srcdir/testsuite/spool/mbox)
mkdir folder
folder=`pwd`/folder
echo 'copy 1 +saved' | dnl
MUT_MAIL_CMD -N -E "set folder=\"$folder\"" -f ./mbox | dnl
sed 's/ *$//;/^Held 1 message/d;s|'$folder/saved'|MBOX|'
test -f $folder/saved || exit 1
cmp $folder/saved $abs_top_srcdir/testsuite/spool/mbox
],
[0],
["MBOX" 14/438
])
AT_CLEANUP
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2015-2016 Free Software Foundation, Inc.
#
# GNU Mailutils is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3, or (at
# your option) any later version.
#
# GNU Mailutils is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
AT_SETUP([copy: & expansion])
AT_KEYWORDS([copy copy03])
# Description: Check whether special mailbox notations are correctly expanded
# in copy command. This was broken by commit eea2c4aa.
#
# This testcase checks for expansion of "&".
AT_CHECK([
MUT_MBCOPY($abs_top_srcdir/testsuite/spool/mbox)
mkdir folder
MBOX=`pwd`/MBOX
export MBOX
echo 'copy 1 &' | dnl
MUT_MAIL_CMD -N -E "set folder=\"$folder\"" -f ./mbox | dnl
sed 's/ *$//;/^Held 1 message/d;s|'$MBOX'|MBOX|'
test -f $MBOX || exit 1
cmp $MBOX $abs_top_srcdir/testsuite/spool/mbox
],
[0],
["MBOX" 14/438
])
AT_CLEANUP
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2015-2016 Free Software Foundation, Inc.
#
# GNU Mailutils is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3, or (at
# your option) any later version.
#
# GNU Mailutils is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
AT_SETUP([copy: # expansion])
AT_KEYWORDS([copy copy04])
# Description: Check whether special mailbox notations are correctly expanded
# in copy command. This was broken by commit eea2c4aa.
#
# This testcase checks for expansion of "#".
AT_CHECK([
MUT_MBCOPY($abs_top_srcdir/testsuite/spool/mbox)
folder=`pwd`
MBOX=$folder/mbox
NEW=$folder/new
>$NEW
AT_DATA([script],[file +new
file +mbox
copy 1 #
])
MUT_MAIL_CMD -N -E "set folder=\"$folder\"" -f $MBOX < script | dnl
sed 's/ *$//;s|'$NEW'|NEW|;s|'$MBOX'|MBOX|'
sed '/^X-IMAPbase:/d;/^Status:/d;/^X-UID/d' $NEW | diff - $abs_top_srcdir/testsuite/spool/mbox
],
[0],
[Held 1 message in MBOX
Held 0 messages in NEW
"NEW" 17/482
Held 1 message in MBOX
])
AT_CLEANUP
......@@ -24,7 +24,6 @@ AT_KEYWORDS([nohome])
AT_CHECK([
MUT_MBCOPY($abs_top_srcdir/testsuite/spool/mbox)
unset MAILRC
unset HOME
MAIL=./mbox MUT_MAIL_CMD -nH
],
......
......@@ -16,7 +16,7 @@
m4_include([testsuite.inc])
m4_define([MUT_MAIL_CMD],[mail MUT_DEFAULT_OPTIONS])
m4_define([MUT_MAIL_CMD],[MAILRC=/dev/null mail MUT_DEFAULT_OPTIONS])
AT_INIT
AT_TESTED([mail])
......@@ -26,3 +26,7 @@ m4_include([nohome.at])
m4_include([cols00.at])
m4_include([cols01.at])
m4_include([copy00.at])
m4_include([copy01.at])
m4_include([copy02.at])
m4_include([copy03.at])
m4_include([copy04.at])
......