Porting MailDrop to Alpine

Bengt Thuree <[email protected]> Tue, 20 Jun 2023 17:26:41 +1000
Newsgroups gmane.mail.maildrop
Message-ID <CAB8vGXb-XtahcEp68QhxjiyGzbYKOgSjOaE+qD-_a4an4k6ueA@mail.gmail.com>
--===============8270349409605243195==
Content-Type: multipart/alternative; boundary="000000000000510a0205fe8a93c5"

--000000000000510a0205fe8a93c5
Content-Type: text/plain; charset="UTF-8"

Hello everyone

I am trying to port maildrop to Alpine, mainly because I need the reformail
command.

But maildrop needed courier-unicode, so I need to port this one first.
But I am running into one issue which I am not sure what to do with.
So I am just checking here to see if there are any dependencies that I am
not aware of.

Configure works fine
Make works fine
make check fails

12345678alpinedev:~/aports/testing/courier-unicode/src/courier-unicode-2.2.6$
make check
make  check-am
make[1]: Entering directory
'/home/bengt/aports/testing/courier-unicode/src/courier-unicode-2.2.6'
./unicodetest
Unexpected result from convert()
make[1]: *** [Makefile:1651: check-am] Error 1
make[1]: Leaving directory
'/home/bengt/aports/testing/courier-unicode/src/courier-unicode-2.2.6'
make: *** [Makefile:1333: check] Error 2

And when I try the unicodetest by itself, sure enough, that error
message popped up.

I added some extra printouts, and I got the following output

$ ./unicodetest
1cb.cnt: 0
cb.ptr:
checkflag: 0
2cb.cnt: 0
cb.ptr:
checkflag: 0
3cb.cnt: 0
cb.ptr:
checkflag: 0
4cb.cnt: 4
cb.ptr: A**B
checkflag: 0
Unexpected result from convert()
5cb.cnt: 4
cb.ptr: A**B
checkflag: 0


and the code looks like this

static void test1()
{
        static const char teststr[]= {
                0x00, 0x00, 0x00, 0x41,
                0x00, 0x00, 0x04, 0x14,
                0x00, 0x00, 0x04, 0x30,
                0x00, 0x00, 0x00, 0x42};
        char outputbuf[12];
        struct collect_buf cb;
        unicode_convert_handle_t h;
        int checkflag;

        cb.ptr=outputbuf;
        cb.cnt=0;
        cb.size=sizeof(outputbuf);
fprintf(stderr, "1cb.cnt: %zu\n", cb.cnt);   // Print cb.cnt value
fprintf(stderr, "cb.ptr: %.*s\n", (int)cb.cnt, cb.ptr);   // Print cb.ptr value
fprintf(stderr, "checkflag: %d\n", checkflag);   // Print checkflag value

        if ((h=unicode_convert_init("UCS-4BE", "ISO-8859-1",
                                      save_output, &cb)) == NULL)
        {
                perror("unicode_convert_init");
                exit(1);
        }
fprintf(stderr, "2cb.cnt: %zu\n", cb.cnt);   // Print cb.cnt value
fprintf(stderr, "cb.ptr: %.*s\n", (int)cb.cnt, cb.ptr);   // Print cb.ptr value
fprintf(stderr, "checkflag: %d\n", checkflag);   // Print checkflag value

        unicode_convert(h, teststr, sizeof(teststr));
fprintf(stderr, "3cb.cnt: %zu\n", cb.cnt);   // Print cb.cnt value
fprintf(stderr, "cb.ptr: %.*s\n", (int)cb.cnt, cb.ptr);   // Print cb.ptr value
fprintf(stderr, "checkflag: %d\n", checkflag);   // Print checkflag value

        if (unicode_convert_deinit(h, &checkflag))
        {
                perror("unicode_convert_deinit");
                exit(1);
        }
fprintf(stderr, "4cb.cnt: %zu\n", cb.cnt);   // Print cb.cnt value
fprintf(stderr, "cb.ptr: %.*s\n", (int)cb.cnt, cb.ptr);   // Print cb.ptr value
fprintf(stderr, "checkflag: %d\n", checkflag);   // Print checkflag value


        if (cb.cnt != 2 || memcmp(cb.ptr, "AB", 2) || !checkflag)
        {
                fprintf(stderr, "Unexpected result from convert()\n");
                fprintf(stderr, "5cb.cnt: %zu\n", cb.cnt);   // Print
cb.cnt value
                fprintf(stderr, "cb.ptr: %.*s\n", (int)cb.cnt,
cb.ptr);   // Print cb.ptr value
                fprintf(stderr, "checkflag: %d\n", checkflag);   //
Print checkflag value
                exit(1);
        }
}

I also started an ubuntu server in a virtual box, and on this server,
the make check command works like a charm.

So there are some differences between Alpine and Ubuntu here,
but I'm not sure where I should start.

locale -a gives the same (C, and C.UTF-8, but ubuntu also has POSIX)

I tried with bash (instead of default ash), but no difference

Would anyone have any thoughts, or suggestions on this issue?

Cheers

Bengt

--000000000000510a0205fe8a93c5
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hello everyone</div><div></div><div><br></div><div>I =
am trying to port maildrop to Alpine, mainly because I need the reformail c=
ommand.</div><div><br></div><div>But maildrop needed courier-unicode, so I =
need to port this one first.</div><div>But I am running into one issue whic=
h I am not sure what to do with.</div><div>So I am just checking here to se=
e if there are any dependencies that I am not aware of.</div><div><br></div=
><div>Configure works fine</div><div>Make works fine</div><div>make check f=
ails <br><span class=3D"gmail-mx_EventTile_body gmail-markdown-body" dir=3D=
"auto"><pre class=3D"gmail-mx_EventTile_collapsedCodeBlock"><span class=3D"=
gmail-mx_EventTile_lineNumbers"><span>1</span><span>2</span><span>3</span><=
span>4</span><span>5</span><span>6</span><span>7</span><span>8</span></span=
><code>alpinedev:~/aports/testing/courier-unicode/src/courier-unicode-2.2.6=
$ make check
make  check-am
make[1]: Entering directory &#39;/home/bengt/aports/testing/courier-unicode=
/src/courier-unicode-2.2.6&#39;
./unicodetest
Unexpected result from convert()
make[1]: *** [Makefile:1651: check-am] Error 1
make[1]: Leaving directory &#39;/home/bengt/aports/testing/courier-unicode/=
src/courier-unicode-2.2.6&#39;
make: *** [Makefile:1333: check] Error 2<br><br></code></pre><pre class=3D"=
gmail-mx_EventTile_collapsedCodeBlock"><code>And when I try the unicodetest=
 by itself, sure enough, that error message popped up.<br></code></pre><pre=
 class=3D"gmail-mx_EventTile_collapsedCodeBlock"><code>I added some extra p=
rintouts, and I got the following output<br><br></code>$ ./unicodetest<br>1=
cb.cnt: 0<br>cb.ptr:<br>checkflag: 0<br>2cb.cnt: 0<br>cb.ptr:<br>checkflag:=
 0<br>3cb.cnt: 0<br>cb.ptr:<br>checkflag: 0<br>4cb.cnt: 4<br>cb.ptr: A**B<b=
r>checkflag: 0<br>Unexpected result from convert()<br>5cb.cnt: 4<br>cb.ptr:=
 A**B<br>checkflag: 0<br><br><br></pre><pre class=3D"gmail-mx_EventTile_col=
lapsedCodeBlock">and the code looks like this<br><br>static void test1()<br=
>{<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 static const char teststr[]=3D {<br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 0x00, 0x00, 0x00, 0x41=
,<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 0x00, 0x00, 0x=
04, 0x14,<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 0x00, =
0x00, 0x04, 0x30,<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 0x00, 0x00, 0x00, 0x42};<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 char outputbuf[=
12];<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 struct collect_buf cb;<br>=C2=A0 =C2=A0=
 =C2=A0 =C2=A0 unicode_convert_handle_t h;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 i=
nt checkflag;<br><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 cb.ptr=3Doutputbuf;<br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 cb.cnt=3D0;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 cb.size=
=3Dsizeof(outputbuf);<br>fprintf(stderr, &quot;1cb.cnt: %zu\n&quot;, cb.cnt=
); =C2=A0 // Print cb.cnt value<br>fprintf(stderr, &quot;cb.ptr: %.*s\n&quo=
t;, (int)cb.cnt, cb.ptr); =C2=A0 // Print cb.ptr value<br>fprintf(stderr, &=
quot;checkflag: %d\n&quot;, checkflag); =C2=A0 // Print checkflag value<br>=
<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 if ((h=3Dunicode_convert_init(&quot;UCS-4BE=
&quot;, &quot;ISO-8859-1&quot;,<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 save_output, &amp;cb)) =3D=3D NULL)<br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 {<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
perror(&quot;unicode_convert_init&quot;);<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 exit(1);<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>fp=
rintf(stderr, &quot;2cb.cnt: %zu\n&quot;, cb.cnt); =C2=A0 // Print cb.cnt v=
alue<br>fprintf(stderr, &quot;cb.ptr: %.*s\n&quot;, (int)cb.cnt, cb.ptr); =
=C2=A0 // Print cb.ptr value<br>fprintf(stderr, &quot;checkflag: %d\n&quot;=
, checkflag); =C2=A0 // Print checkflag value<br><br>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 unicode_convert(h, teststr, sizeof(teststr));<br>fprintf(stderr, &qu=
ot;3cb.cnt: %zu\n&quot;, cb.cnt); =C2=A0 // Print cb.cnt value<br>fprintf(s=
tderr, &quot;cb.ptr: %.*s\n&quot;, (int)cb.cnt, cb.ptr); =C2=A0 // Print cb=
.ptr value<br>fprintf(stderr, &quot;checkflag: %d\n&quot;, checkflag); =C2=
=A0 // Print checkflag value<br><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (unicode=
_convert_deinit(h, &amp;checkflag))<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 {<br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 perror(&quot;unicode_c=
onvert_deinit&quot;);<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 exit(1);<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>fprintf(stderr, &quot;4=
cb.cnt: %zu\n&quot;, cb.cnt); =C2=A0 // Print cb.cnt value<br>fprintf(stder=
r, &quot;cb.ptr: %.*s\n&quot;, (int)cb.cnt, cb.ptr); =C2=A0 // Print cb.ptr=
 value<br>fprintf(stderr, &quot;checkflag: %d\n&quot;, checkflag); =C2=A0 /=
/ Print checkflag value<br><br><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (cb.cnt !=
=3D 2 || memcmp(cb.ptr, &quot;AB&quot;, 2) || !checkflag)<br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 {<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
fprintf(stderr, &quot;Unexpected result from convert()\n&quot;);<br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 fprintf(stderr, &quot;5cb.=
cnt: %zu\n&quot;, cb.cnt); =C2=A0 // Print cb.cnt value<br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 fprintf(stderr, &quot;cb.ptr: %.*=
s\n&quot;, (int)cb.cnt, cb.ptr); =C2=A0 // Print cb.ptr value<br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 fprintf(stderr, &quot;checkfl=
ag: %d\n&quot;, checkflag); =C2=A0 // Print checkflag value<br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 exit(1);<br>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 }<br>}<br><br></pre><pre class=3D"gmail-mx_EventTile_collapsedCo=
deBlock">I also started an ubuntu server in a virtual box, and on this serv=
er, <br>the make check command works like a charm.<br></pre><pre class=3D"g=
mail-mx_EventTile_collapsedCodeBlock">So there are some differences between=
 Alpine and Ubuntu here, <br>but I&#39;m not sure where I should start.<br>=
</pre><pre class=3D"gmail-mx_EventTile_collapsedCodeBlock">locale -a gives =
the same (C, and C.UTF-8, but ubuntu also has POSIX)<br></pre><pre class=3D=
"gmail-mx_EventTile_collapsedCodeBlock">I tried with bash (instead of defau=
lt ash), but no difference<br></pre><pre class=3D"gmail-mx_EventTile_collap=
sedCodeBlock">Would anyone have any thoughts, or suggestions on this issue?=
<br><br></pre><pre class=3D"gmail-mx_EventTile_collapsedCodeBlock">Cheers<b=
r><br></pre><pre class=3D"gmail-mx_EventTile_collapsedCodeBlock">Bengt<br><=
/pre><pre class=3D"gmail-mx_EventTile_collapsedCodeBlock"><code><br></code>=
</pre></span></div></div>

--000000000000510a0205fe8a93c5--


--===============8270349409605243195==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============8270349409605243195==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Courier-maildrop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/courier-maildrop

--===============8270349409605243195==--