Re: [mmh] Accept header lines of exactly 998 characters

2018-07-19 Thread markus schnalke
Hoi.

[2018-07-19 03:24] Philipp Takacs 
> [2018-07-18 23:13] Vasilii Kolobkov 
> > I'm having the tests green... well technically they are black, but
> > function much better to their end on OpenBSD :)
> 
> Thanks.
> 
> > Yet two of them do fail, but that'd be another patch. The ali tests
> > for the blind lists fail - it's the first time i came to know of
> > this feature and frankly don't know if i'd want to work on fixing
> > that. Does anybody use them?
> 
> If you talk about the test which fails on markus nightly tests[0],
> it's a known bug, but down on the priority list. I don't know if
> someone use this feature[1], but I would like to have this sane
> implemented.

My view is the same.


> > The other broken part is second to last case in test/send/test-mimeify.
> > The sizes reported for multipart/... types differ from expected
> > values. I'll be looking further into it, but wonder if it's broken
> > on your systems as well?
> 
> This also a known bug and behaves realy strange, because sometimes
> the numbers differ. I have looked at this some time ago, but because
> the mime implementation is realy complex I coldn't find it.

These could have been my words as well. ;-)

If one could track that down, that would be great.


> In general I like your patch, but I have some comments:
> 
> > p.s. i prefixed all the portable functions with p* so to not shadown
> > the system ones just in case.

Now that I thought about that, I wonder if we should name the
compat functions in the shell scripts the same way as we name
them in the C code: by prefixing them with ``mh''. But OTOH, these
functions in the C code usually don't provide 1:1 functionality
but rather slightly adjusted functionality. Still, the ``mh'' or
``mh_'' prefix shows quicker what's going on, IMO.

Your oppinion on this?


> > ---8<---
> > From 204ae88524838063493242f012a1b1fe2fcf2d05 Mon Sep 17 00:00:00 2001
> > From: Vasilii Kolobkov 
> > Date: Sun, 15 Jul 2018 23:05:09 +0200
> > Subject: [PATCH] Fix tests to run on OpenBSD
> > 
> >   For there's no seq(1) in OpenBSD, Use pseq function from common.sh
> >   for generating sequence numbers. Credits for the function goes
> >   to Markus Schnalke.
> > 
> >   He also had a one-liner, which having less features is so freaking
> >   nice to not mention it here:
> > < /dev/zero tr \\000 \\n | sed 10q  | nl -b a
> > 
> >   awk(1) doesn't support interval regular expression syntax ({n,m})
> >   on some BSDs.
> > 
> >   hostname(1) has no -f flag on OpenBSD and, while invocation without
> >   flags is supposed to return FQDN allright. Use the same phostname
> >   function in mhsign(1).
> > 
> >   mktemp(1) is limited to at least 6 placeholder symbols on OpenBSD.
> > ---
> >  test/common.sh| 18 ++
> >  test/runtest  |  4 +++-
> >  test/tests/inc/test-eom-align |  2 +-
> >  test/tests/mhsign/test-mhsign | 11 +--
> >  test/tests/mhstore/test-filenames |  2 +-
> >  test/tests/show/test-longlines|  6 ++
> >  uip/mhsign.sh | 11 ++-
> >  7 files changed, 44 insertions(+), 10 deletions(-)
> > 
> > diff --git a/test/common.sh b/test/common.sh
> > index 805afea..056eac2 100644
> > --- a/test/common.sh
> > +++ b/test/common.sh
> > @@ -105,7 +105,25 @@ runandcheck()
> >  
> > if [ "$diff" ]; then
> > echo "$0: $1 failed"
> > echo "$diff"
> > failed=`expr "${failed:-0}" + 1`
> > fi
> >  }
> > +
> > +pseq() {
> > +   start=1
> > +   inc=1
> > +
> > +   case $# in
> > +   1) end="$1" ;;
> > +   2) start="$1"; end="$2" ;;
> > +   3) start="$1"; inc="$2" ; end="$3" ;;
> > +   *) echo "Usage: pseq end | start end | start step end" >&2; return 1 ;;
> > +   esac
> > +
> > +   awk 'BEGIN{
> > +   for (i='"$start"'; i<='"$end"'; i+='"$inc"') {
> > +   print i
> > +   }
> > +   }'
> > +}
> 
> I'm not sure, if we realy nead this funktion, because it's used on
> two places. In the one place it's easy to remove. On the other place
> I would remove the hole test.
> 
> > diff --git a/test/runtest b/test/runtest
> > index 9f35ade..37a23ac 100755
> > --- a/test/runtest
> > +++ b/test/runtest
> > @@ -1,13 +1,15 @@
> >  #!/bin/sh
> >  
> >  set -e
> >  
> >  export MH_TEST_COMMON="$PWD/common.sh"
> >  
> > +. ${MH_TEST_COMMON}
> > +
> 
> Would be nice if this patch would also remove the source in
> the single tests.

I wonder why we haven't done so already? It seems to be pretty
obvious to load the helper scripts for all tests during the test
setup. Was it initially implemented this way due to
time-performance motivation in nmh and we just never thought
about it? Or is there another reason? If there is no other reason
and the tests work fine with the sourcing in runtest, then we
should do as Philipp suggests.


> >  if [ ! -f test-temp-dir ]; then
> > echo "test-temp-dir not found: running setup-test"
> > 

Re: [mmh] Accept header lines of exactly 998 characters

2018-07-19 Thread Vasilii Kolobkov
I've split the last patch and updated it according to your feedback.
Hopefully whitout having lost anything while in transit :)

What do you say?
From 899eac2cee69e32abe2813735ee7ff0870f5ebd1 Mon Sep 17 00:00:00 2001
From: Vasilii Kolobkov 
Date: Thu, 19 Jul 2018 11:56:11 +0200
Subject: [PATCH 1/4] Remove tests/inc/test-eom-align

Reimplemented m_getfld2() makes it obsolete.
---
 test/tests/inc/cksums |   3 -
 test/tests/inc/filler.txt | 356 --
 test/tests/inc/fromline.txt   |   1 -
 test/tests/inc/msgheader.txt  |   5 -
 test/tests/inc/test-eom-align | 123 ---
 5 files changed, 488 deletions(-)
 delete mode 100644 test/tests/inc/cksums
 delete mode 100644 test/tests/inc/filler.txt
 delete mode 100644 test/tests/inc/fromline.txt
 delete mode 100644 test/tests/inc/msgheader.txt
 delete mode 100644 test/tests/inc/test-eom-align

diff --git a/test/tests/inc/cksums b/test/tests/inc/cksums
deleted file mode 100644
index a8667a7..000
--- a/test/tests/inc/cksums
+++ /dev/null
@@ -1,3 +0,0 @@
-4195362473 17161 filler.txt
-3020538295 51 fromline.txt
-525303352 121 msgheader.txt
diff --git a/test/tests/inc/filler.txt b/test/tests/inc/filler.txt
deleted file mode 100644
index 7be957f..000
--- a/test/tests/inc/filler.txt
+++ /dev/null
@@ -1,356 +0,0 @@
-CHAPTER I. MR. SHERLOCK HOLMES.
-
-
-IN the year 1878 I took my degree of Doctor of Medicine of the
-University of London, and proceeded to Netley to go through the course
-prescribed for surgeons in the army. Having completed my studies there,
-I was duly attached to the Fifth Northumberland Fusiliers as Assistant
-Surgeon. The regiment was stationed in India at the time, and before
-I could join it, the second Afghan war had broken out. On landing at
-Bombay, I learned that my corps had advanced through the passes, and
-was already deep in the enemy's country. I followed, however, with many
-other officers who were in the same situation as myself, and succeeded
-in reaching Candahar in safety, where I found my regiment, and at once
-entered upon my new duties.
-
-The campaign brought honours and promotion to many, but for me it had
-nothing but misfortune and disaster. I was removed from my brigade and
-attached to the Berkshires, with whom I served at the fatal battle of
-Maiwand. There I was struck on the shoulder by a Jezail bullet, which
-shattered the bone and grazed the subclavian artery. I should have
-fallen into the hands of the murderous Ghazis had it not been for the
-devotion and courage shown by Murray, my orderly, who threw me across a
-pack-horse, and succeeded in bringing me safely to the British lines.
-
-Worn with pain, and weak from the prolonged hardships which I had
-undergone, I was removed, with a great train of wounded sufferers, to
-the base hospital at Peshawar. Here I rallied, and had already improved
-so far as to be able to walk about the wards, and even to bask a little
-upon the verandah, when I was struck down by enteric fever, that curse
-of our Indian possessions. For months my life was despaired of, and
-when at last I came to myself and became convalescent, I was so weak and
-emaciated that a medical board determined that not a day should be lost
-in sending me back to England. I was dispatched, accordingly, in the
-troopship "Orontes," and landed a month later on Portsmouth jetty, with
-my health irretrievably ruined, but with permission from a paternal
-government to spend the next nine months in attempting to improve it.
-
-I had neither kith nor kin in England, and was therefore as free as
-air--or as free as an income of eleven shillings and sixpence a day will
-permit a man to be. Under such circumstances, I naturally gravitated to
-London, that great cesspool into which all the loungers and idlers of
-the Empire are irresistibly drained. There I stayed for some time at
-a private hotel in the Strand, leading a comfortless, meaningless
-existence, and spending such money as I had, considerably more freely
-than I ought. So alarming did the state of my finances become, that
-I soon realized that I must either leave the metropolis and rusticate
-somewhere in the country, or that I must make a complete alteration in
-my style of living. Choosing the latter alternative, I began by making
-up my mind to leave the hotel, and to take up my quarters in some less
-pretentious and less expensive domicile.
-
-On the very day that I had come to this conclusion, I was standing at
-the Criterion Bar, when some one tapped me on the shoulder, and turning
-round I recognized young Stamford, who had been a dresser under me at
-Barts. The sight of a friendly face in the great wilderness of London is
-a pleasant thing indeed to a lonely man. In old days Stamford had never
-been a particular crony of mine, but now I hailed him with enthusiasm,
-and he, in his turn, appeared to be delighted to see me. In the
-exuberance of my joy, I asked him to lunch with me at the Holborn, 

Re: [mmh] Accept header lines of exactly 998 characters

2018-07-19 Thread markus schnalke
Our replies interleaved ...


[2018-07-19 09:38] Vasilii Kolobkov 
>
> Thanks for the comments, Philipp!
> 
> [2018-07-19 03:24 +0200] Philipp Takacs 
> > [2018-07-18 23:13] Vasilii Kolobkov 
> > > diff --git a/test/runtest b/test/runtest
> > > index 9f35ade..37a23ac 100755
> > > --- a/test/runtest
> > > +++ b/test/runtest
> > > @@ -1,13 +1,15 @@
> > >  #!/bin/sh
> > >  
> > >  set -e
> > >  
> > >  export MH_TEST_COMMON="$PWD/common.sh"
> > >  
> > > +. ${MH_TEST_COMMON}
> > > +
> > 
> > Would be nice if this patch would also remove the source in
> > the single tests.
> 
> I do like it that way it is for it makes this dependency a bit more
> explicit.  Let me know if you see no merit in it and i'll dump
> sourcing in each test.

As written in the other message: I'd favor to just have these helper
functions available in all tests (like we have all of sbr/ available
in all of uip/). It's a library thing ...


> > > diff --git a/test/tests/mhsign/test-mhsign b/test/tests/mhsign/test-mhsign
> > > index 3c2bb97..4f24b09 100755
> > > --- a/test/tests/mhsign/test-mhsign
> > > +++ b/test/tests/mhsign/test-mhsign
> > > @@ -3,14 +3,21 @@
> > >  #
> > >  # Test mhsign (correct alias expansion with -enc)
> > >  #
> > >  ##
> > >  
> > >  . "$MH_TEST_COMMON"
> > >  
> > > +phostname()
> > > +{
> > > + case `uname -s` in
> > > + OpenBSD) hostname ;;
> > > + *) hostname -f ;;
> > > + esac
> > > +}
> > 
> > oh hostname, markus has summarised[3] this very good. I wouldn't
> > change the test, because it does exact the same as mhsing. Maybe
> > after fixing mhsign.
> 
> I missed the mhsign(1) discussion, but do agree here. Though it'd
> have to be `hostname -f 2>/dev/null | uname -n` so no to fill the
> output with errors about unrecognized flag.

Yes, do so, but put the second pipe symbol in place again! ;-)


meillo



Re: [mmh] Dig into MIME! (was: Accept header lines of exactly 998 characters)

2018-07-19 Thread markus schnalke
Hoi.

[2018-07-19 10:52] Vasilii Kolobkov 
> [2018-07-19 10:02 +0200] markus schnalke 
> > [2018-07-19 03:24] Philipp Takacs 
> > > [2018-07-18 23:13] Vasilii Kolobkov 
> > > > The other broken part is second to last case in test/send/test-mimeify.
> > > > The sizes reported for multipart/... types differ from expected
> > > > values. I'll be looking further into it, but wonder if it's broken
> > > > on your systems as well?
> > > 
> > > This also a known bug and behaves realy strange, because sometimes
> > > the numbers differ. I have looked at this some time ago, but because
> > > the mime implementation is realy complex I coldn't find it.
> > 
> > These could have been my words as well. ;-)
> > 
> > If one could track that down, that would be great.
> 
> You got me intrigued guys, but not scared. I'll give it a try -
> heard a lot about how mime was notorious for complex code, but
> haven't experienced that myself yet.

It's an experience worthwhile to have ... once in your life! ;-D


But seriously, MH's MIME stuff is really interesting to have a
look at, in regards of MIME's coming to life. AFAIK, MH was the
first implementation of MIME. It goes closely with the concepts
of the RFCs. The idea of MIME as a means to encode all sorts of
contents (like newspaper articles and such stuff) is visible in
MH's MIME implementation, which I guess is different if you
look at other mail software. MH can present MIME messages as a
multimedia performance, invoking all sorts of commands to handle
specific parts, and, the other way round, you can create most
complex MIME messages -- stuff that most mail clients would not
regard as mail messages at all.

True that, MIME implementations have complex code -- MH's has
all the downsides of any complex code -- but also true, that
MH's MIME implementation is worth a closer look. If you have
the time and the brain capacity to lay out all those data
structures and program flows, then do dig into it! (You know,
m_getfld was much worse, and still, it tought great lessons!)


meillo



Re: [mmh] Accept header lines of exactly 998 characters

2018-07-19 Thread Vasilii Kolobkov
Thanks for the comments, Philipp!

[2018-07-19 03:24 +0200] Philipp Takacs 
> [2018-07-18 23:13] Vasilii Kolobkov 
> > +pseq() {
> 
> I'm not sure, if we realy nead this funktion, because it's used on
> two places. In the one place it's easy to remove. On the other place
> I would remove the hole test.

Yep, if we are to remove the inc(1) test, i'm all for just having
a hardcoded list.

> > diff --git a/test/runtest b/test/runtest
> > index 9f35ade..37a23ac 100755
> > --- a/test/runtest
> > +++ b/test/runtest
> > @@ -1,13 +1,15 @@
> >  #!/bin/sh
> >  
> >  set -e
> >  
> >  export MH_TEST_COMMON="$PWD/common.sh"
> >  
> > +. ${MH_TEST_COMMON}
> > +
> 
> Would be nice if this patch would also remove the source in
> the single tests.

I do like it that way it is for it makes this dependency a bit more
explicit.  Let me know if you see no merit in it and i'll dump
sourcing in each test.

> > diff --git a/test/tests/mhsign/test-mhsign b/test/tests/mhsign/test-mhsign
> > index 3c2bb97..4f24b09 100755
> > --- a/test/tests/mhsign/test-mhsign
> > +++ b/test/tests/mhsign/test-mhsign
> > @@ -3,14 +3,21 @@
> >  #
> >  # Test mhsign (correct alias expansion with -enc)
> >  #
> >  ##
> >  
> >  . "$MH_TEST_COMMON"
> >  
> > +phostname()
> > +{
> > +   case `uname -s` in
> > +   OpenBSD) hostname ;;
> > +   *) hostname -f ;;
> > +   esac
> > +}
> 
> oh hostname, markus has summarised[3] this very good. I wouldn't
> change the test, because it does exact the same as mhsing. Maybe
> after fixing mhsign.

I missed the mhsign(1) discussion, but do agree here. Though it'd
have to be `hostname -f 2>/dev/null | uname -n` so no to fill the
output with errors about unrecognized flag.

> > diff --git a/test/tests/mhstore/test-filenames 
> > b/test/tests/mhstore/test-filenames
> > index a1d3c3d..4cfedd3 100755
> > --- a/test/tests/mhstore/test-filenames
> > +++ b/test/tests/mhstore/test-filenames
> > @@ -7,15 +7,15 @@
> >  
> >  . "$MH_TEST_COMMON"
> >  
> >  require_locale en_US.utf-8 en_US.utf8
> >  LC_ALL=en_US.UTF-8
> >  export LC_ALL
> >  
> > -tempdir=`TMPDIR=$MH_TEST_DIR mktemp -d -t "X"`
> > +tempdir=`TMPDIR=$MH_TEST_DIR mktemp -d -t "XX"`
> 
> Why not just ``mktemp -d''?

Guess it's because i just patched it without giving it a proper
thought :) Will fix.

> [3] https://www.mail-archive.com/mmh@marmaro.de/msg00559.html



Re: [mmh] Accept header lines of exactly 998 characters

2018-07-19 Thread Vasilii Kolobkov
[2018-07-19 10:02 +0200] markus schnalke 
> [2018-07-19 03:24] Philipp Takacs 
> > [2018-07-18 23:13] Vasilii Kolobkov 
> > > Yet two of them do fail, but that'd be another patch. The ali tests
> > > for the blind lists fail - it's the first time i came to know of
> > > this feature and frankly don't know if i'd want to work on fixing
> > > that. Does anybody use them?
> > 
> > If you talk about the test which fails on markus nightly tests[0],
> > it's a known bug, but down on the priority list. I don't know if
> > someone use this feature[1], but I would like to have this sane
> > implemented.
> 
> My view is the same.

Noted, with a miniscule priority though :)

> > > The other broken part is second to last case in test/send/test-mimeify.
> > > The sizes reported for multipart/... types differ from expected
> > > values. I'll be looking further into it, but wonder if it's broken
> > > on your systems as well?
> > 
> > This also a known bug and behaves realy strange, because sometimes
> > the numbers differ. I have looked at this some time ago, but because
> > the mime implementation is realy complex I coldn't find it.
> 
> These could have been my words as well. ;-)
> 
> If one could track that down, that would be great.

You got me intrigued guys, but not scared. I'll give it a try -
heard a lot about how mime was notorious for complex code, but
haven't experienced that myself yet.

> > In general I like your patch, but I have some comments:
> > 
> > > p.s. i prefixed all the portable functions with p* so to not shadown
> > > the system ones just in case.
> 
> Now that I thought about that, I wonder if we should name the
> compat functions in the shell scripts the same way as we name
> them in the C code: by prefixing them with ``mh''. But OTOH, these
> functions in the C code usually don't provide 1:1 functionality
> but rather slightly adjusted functionality. Still, the ``mh'' or
> ``mh_'' prefix shows quicker what's going on, IMO.
> 
> Your oppinion on this?

Guess it makes some sense, at least as indicators of them being
workarounds for platform specific issues. And 'mh_' just greps
better )

Cheers, vasilii