|
From: | Helmut Leitner |
Subject: | Re: [bug-mailutils] mail -f option processing |
Date: | Wed, 25 Jan 2006 09:54:39 +0100 |
User-agent: | Mozilla Thunderbird 1.0 (Windows/20041206) |
Sergey Poznyakoff wrote:
Helmut Leitner <address@hidden> wrote:The program "mail" seems to process the -f option incorrectly. In a call mail -f path name or mail name (with "-f path" coming from /etc/mailutils.rc ":mail -f path") the name is interpreted as another mailbox path and the stored path is overwritten and lost.The switch -f takes an optional argument. As such, it must eiter appear right after the short form (-f), or after an equal sign if used with the long form (--file), in both cases without any intervening whitespace. That is, the correct ways of invocation are: mail -fpath mail --file=path Any other usage is an error and previous versions of mail detected it as such. However, as the comment you noticed states, people were often forgetting this option specific and therefore an heuristics was introduced that allows to handle both `mail -fpath' and `mail -f path' the same way *in the absence of other command line arguments*. It did not appear to me that anyone would want to use both mailbox name and recipient addresses on the same command line, since this is effectively senseless. The invocation mail -f path name should be understood as follows: "set default mailbox url to the system mailbox for the current uid and enter compose mode for sending a message to users `path' (sic) and `name'". Currently, however, mail understands it as "open `path', than drop it and open `name' instead". The proposed way of understanding this invocation as "open mailbox `path' and send a mail to `name'" is also wrong, since `path' has nothing to do with -f, because it is separated from it. Perhaps the best bet would be to printan error message and exit.
I just want to set maildir format and "~/maildir" as the default path for all operations of mailutils. I tried to set corresponding options in mailutils.rc Together with mailutils 0.6 I used: :mailutils --maildir :messages -f~/maildir This effectively creates a mail -f~/maildir name parameter situation when calling mail name from the command line, even when this is neither needed nor intended. These are the affected case-sections of mail.c/pars_opt: case 'f': if (arg != NULL) args->file = arg; else { int len; char *home = getenv("HOME"); len = strlen (home) + strlen ("/mbox") + 1; args->file = xmalloc(len * sizeof (char)); strcpy (args->file, home); strcat (args->file, "/mbox"); } break; case ARGP_KEY_ARG: /* People often tend to separate -f option from its argument with a whitespace. This heuristics tries to catch the error: */ if (args->file) { args->file = arg; } else { args->args = realloc (args->args, sizeof (char *) * (state->arg_num + 2)); args->args[state->arg_num] = arg; args->args[state->arg_num + 1] = NULL; util_cache_command (&command_list, "set mode=send"); } break; My working case-sections of mail.c/pars_opt are: case 'f': if (arg != NULL) args->file = arg; else if(state->argv[state->next][0] >= '-') { args->file = state->argv[state->next++]; } else { int len; char *home = getenv("HOME"); len = strlen (home) + strlen ("/mbox") + 1; args->file = xmalloc(len * sizeof (char)); strcpy (args->file, home); strcat (args->file, "/mbox"); } break; case ARGP_KEY_ARG: args->args = realloc (args->args, sizeof (char *) * (state->arg_num + 2)); args->args[state->arg_num] = arg; args->args[state->arg_num + 1] = NULL; util_cache_command (&command_list, "set mode=send"); break; Things even seem to get simpler by resolving this issue. But this is minor. Basically I just want "maildir:~/maildir for everyutil and everyuser". and have at least mail, pop3d and imap4d work with that. How can I configure that? -- Helmut Leitner address@hidden Graz, Austria www.hls-software.com
[Prev in Thread] | Current Thread | [Next in Thread] |