It does make sense indeed!
I do hope to be able to take into account all these details when posting my next question to this list. In the meantime, I keep learning! Thank you so much for your time!
On Wed, Sep 2, 2015 at 10:13 PM, Mark Sapiro <mark@msapiro.net> wrote:
On 09/02/2015 12:27 PM, [IDIS Technical Secretariat] Ricardo Rodríguez wrote:
Still, I've a doubt about the syntax of Mailman commands. I do need to
do...
[root@idis2 r.users.mbox]# cleanarch <r.users.all.mbox>
r.users.all.clean.mbox
While <> are not required in command arch...
[root@idis2 r.users.mbox]# arch --wipe r.users r.users.mbox
If I don't use <> to enclose the input file name in cleanarch, I get the help page!
You are not 'enclosing' the input file name in cleanarch with <>. cleanarch reads the input mailbox from stdin and writes the output mbox to stdout. You are actually saying '<r.users.all.mbox' which redirects stdin from the terminal to the file r.users.all.mbox and '> r.users.all.clean.mbox' which redirects stdout from the terminal to the file r.users.all.clean.mbox.
Note that you didn't need to do this as the <http://www.arctic.org/~dean/scripts/ezmlm2mbox> script already writes a 'clean' mbox.
On the other hand if you give a second argument to bin/arch, it assumes that is the mbox. It doesn't read stdin in any case and writes various progress info to stdout.
Usage of both commands as per their help pages are close to similar...
Usage: cleanarch [options] < inputfile > outputfile
This means use shell redirection to read the input from inputfile and write the output to outputfile.
Usage: /usr/lib/mailman/bin/arch [options] <listname> [<mbox>]
Here the notation <listname> means that is a variable to be replaced with the actual list name and [<mbox>] means that <mbox> is a variable to be replaced with the actual mbox, but the [] mean it's optional - if not provided it is computed as archives/private/<listname>.mbox/<listname>.mbox.
Also, arch alone shows its help page
because arch without at least a <listname> argument is invalid
whereas cleanarch alone do "nothing".
Actually cleanarch alone is valid and both reads its input from and writes its output to the terminal. That's why if you type just 'cleanarch', it doesn't return immediately to a command prompt but waits for input from the terminal.
Consider
mark@msapiro:~$ /var/MM/21/bin/cleanarch
- it's waiting for input- I type From someone
- it responds
- to stdout, and Unix-From line changed: 1 From someone
- to stderr. then I type ^D (control-D - end of file) and it responds 0 messages found
- and exits.
Those usage lines and command behaviour aren't to consistent, are they? Could this behaviour be caused by my local configuration?
From someone
No. They are caused by two different programs written by at least two different people. So yes, they aren't exactly consistent, but if you understand the different commands and the shell redirection, it may make more sense.
True, cleanarch could have been written to require an input file argument instead of using stdin, but using stdin and stdout makes it easy to insert it into a pipeline of commands as in for example
ezmlm2mbox [-d] ezmlm_dir | cleanarch | arch --wipe <listname> -
except for the fact that arch doesn't read its stdin even if the conventional '-' is used as the mbox file name.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
-- Ricardo Rodríguez Research Management and Promotion Technician Technical Secretariat Health Research Institute of Santiago de Compostela (IDIS) http://www.idisantiago.es