* test debug @ 2022-03-06 10:49 Alviro Iskandar Setiawan 2022-03-06 10:53 ` Ammar Faizi ` (2 more replies) 0 siblings, 3 replies; 17+ messages in thread From: Alviro Iskandar Setiawan @ 2022-03-06 10:49 UTC (permalink / raw) To: Ammar Faizi; +Cc: GNU/Weeb Mailing List test aja -- Viro ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: test debug 2022-03-06 10:49 test debug Alviro Iskandar Setiawan @ 2022-03-06 10:53 ` Ammar Faizi 2022-03-06 11:01 ` Ammar Faizi 2022-03-06 11:03 ` Alviro Iskandar Setiawan 2 siblings, 0 replies; 17+ messages in thread From: Ammar Faizi @ 2022-03-06 10:53 UTC (permalink / raw) To: Alviro Iskandar Setiawan; +Cc: GNU/Weeb Mailing List Got your email. On Mar 6, 2022, 5:50 PM, at 5:50 PM, Alviro Iskandar Setiawan <[email protected]> wrote: >test aja > >-- Viro ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: test debug 2022-03-06 10:49 test debug Alviro Iskandar Setiawan 2022-03-06 10:53 ` Ammar Faizi @ 2022-03-06 11:01 ` Ammar Faizi 2022-03-06 11:03 ` Alviro Iskandar Setiawan 2 siblings, 0 replies; 17+ messages in thread From: Ammar Faizi @ 2022-03-06 11:01 UTC (permalink / raw) To: Alviro Iskandar Setiawan; +Cc: GNU/Weeb Mailing List On 3/6/22 5:49 PM, Alviro Iskandar Setiawan wrote: > test aja OK, it seems something went wrong when the request is piped to the public-inbox-tg.php. The raw data looks like this: gz + base64: H4sIAAAAAAACA61UXXeqOBR9Lr8ij+2yKN8iLV1F/EJBLX7WWfchQsQ ogg1B0V8/wZnb2941M0/DAwtOcvbZOydnd0h6APBwgGQD8RVLr1GSnx FaV1MSATDJE+BBAoAGRMFQZUPVgSRIEucjmpOEH0O6NcDzv+S/sG0Bw icUGmBT1vlDFKpqVZLVqqhoP8B9nuyT9JywuC5VparWqIqq/OOBu1tf wFce9+M0oxtcPIAzplvQnnjT8cQCOARN3VLleltr6k/cHWP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HoBqqAMbeI4D01/c/CDS5bxIZ1u8iWaisCs6EddHgXm5tgDv IvXAvPA/mLIvj/gR0I3F5OwYAAA== -- Ammar Faizi ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: test debug 2022-03-06 10:49 test debug Alviro Iskandar Setiawan 2022-03-06 10:53 ` Ammar Faizi 2022-03-06 11:01 ` Ammar Faizi @ 2022-03-06 11:03 ` Alviro Iskandar Setiawan 2022-03-06 11:04 ` Ammar Faizi 2 siblings, 1 reply; 17+ messages in thread From: Alviro Iskandar Setiawan @ 2022-03-06 11:03 UTC (permalink / raw) To: Ammar Faizi; +Cc: GNU/Weeb Mailing List, Alviro Iskandar Setiawan test again -- Viro ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: test debug 2022-03-06 11:03 ` Alviro Iskandar Setiawan @ 2022-03-06 11:04 ` Ammar Faizi 2022-03-06 11:08 ` Alviro Iskandar Setiawan 0 siblings, 1 reply; 17+ messages in thread From: Ammar Faizi @ 2022-03-06 11:04 UTC (permalink / raw) To: Alviro Iskandar Setiawan; +Cc: GNU/Weeb Mailing List, Alviro Iskandar Setiawan On 3/6/22 6:03 PM, Alviro Iskandar Setiawan wrote: > test again Got your email! -- Ammar Faizi ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: test debug 2022-03-06 11:04 ` Ammar Faizi @ 2022-03-06 11:08 ` Alviro Iskandar Setiawan 2022-03-06 11:12 ` Ammar Faizi 0 siblings, 1 reply; 17+ messages in thread From: Alviro Iskandar Setiawan @ 2022-03-06 11:08 UTC (permalink / raw) To: Ammar Faizi; +Cc: GNU/Weeb Mailing List, Alviro Iskandar Setiawan On Sun, Mar 6, 2022 at 6:04 PM Ammar Faizi wrote: > On 3/6/22 6:03 PM, Alviro Iskandar Setiawan wrote: > > test again > > Got your email! > I think this regex is wrong sir, if the message-id is located at the end of the header, we will not have double LF, because it's already split by the explode. if (!preg_match("/(?:^|\\n)message-id:\s+?(.+?)(?:\\n\S+\:|\\n\\n)/si", $hdr, $m)) { $err = "Cannot get the \"message-id\" line"; goto out; } maybe we should use this: "/(?:^|\\n)message-id:\s+?(.+?)(?:\\n\S+\:|$)/si" -- Viro ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: test debug 2022-03-06 11:08 ` Alviro Iskandar Setiawan @ 2022-03-06 11:12 ` Ammar Faizi 2022-03-06 11:15 ` Alviro Iskandar Setiawan 0 siblings, 1 reply; 17+ messages in thread From: Ammar Faizi @ 2022-03-06 11:12 UTC (permalink / raw) To: Alviro Iskandar Setiawan; +Cc: GNU/Weeb Mailing List, Alviro Iskandar Setiawan On 3/6/22 6:08 PM, Alviro Iskandar Setiawan wrote: > On Sun, Mar 6, 2022 at 6:04 PM Ammar Faizi wrote: >> On 3/6/22 6:03 PM, Alviro Iskandar Setiawan wrote: >>> test again >> >> Got your email! >> > > I think this regex is wrong sir, if the message-id is located at the > end of the header, we will not have double LF, because it's already > split by the explode. > > if (!preg_match("/(?:^|\\n)message-id:\s+?(.+?)(?:\\n\S+\:|\\n\\n)/si", > $hdr, $m)) { > $err = "Cannot get the \"message-id\" line"; > goto out; > } Oh right, I forgot that we've already split it before parsing. > maybe we should use this: > > "/(?:^|\\n)message-id:\s+?(.+?)(?:\\n\S+\:|$)/si" That one looks good to me, we should also fix other headers too. -- Ammar Faizi ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: test debug 2022-03-06 11:12 ` Ammar Faizi @ 2022-03-06 11:15 ` Alviro Iskandar Setiawan 2022-03-06 13:00 ` Alviro Iskandar Setiawan 0 siblings, 1 reply; 17+ messages in thread From: Alviro Iskandar Setiawan @ 2022-03-06 11:15 UTC (permalink / raw) To: Ammar Faizi; +Cc: GNU/Weeb Mailing List, Alviro Iskandar Setiawan On Sun, Mar 6, 2022 at 6:12 PM Ammar Faizi wrote: > On 3/6/22 6:08 PM, Alviro Iskandar Setiawan wrote: > > On Sun, Mar 6, 2022 at 6:04 PM Ammar Faizi wrote: > > > On 3/6/22 6:03 PM, Alviro Iskandar Setiawan wrote: > > > > test again > > > > > > Got your email! > > > > > > > I think this regex is wrong sir, if the message-id is located at the > > end of the header, we will not have double LF, because it's already > > split by the explode. > > > > if (!preg_match("/(?:^|\\n)message-id:\s+?(.+?)(?:\\n\S+\:|\\n\\n)/si", > > $hdr, $m)) { > > $err = "Cannot get the \"message-id\" line"; > > goto out; > > } > > Oh right, I forgot that we've already split it before parsing. > > > maybe we should use this: > > > > "/(?:^|\\n)message-id:\s+?(.+?)(?:\\n\S+\:|$)/si" > > That one looks good to me, we should also fix other headers too. I will send a patch to fix this, maybe tonight -- Viro ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: test debug 2022-03-06 11:15 ` Alviro Iskandar Setiawan @ 2022-03-06 13:00 ` Alviro Iskandar Setiawan 2022-03-06 13:06 ` Ammar Faizi 0 siblings, 1 reply; 17+ messages in thread From: Alviro Iskandar Setiawan @ 2022-03-06 13:00 UTC (permalink / raw) To: Ammar Faizi Cc: Alviro Iskandar Setiawan, GNU/Weeb Mailing List, Faris Suryanto, Alviro Iskandar Setiawan Subject: [PATCH pit v1] bin/public-inbox-tg: Fix regex pattern for headers From: Alviro Iskandar Setiawan <[email protected]> When testing email with Faris, we found that Faris' emails don't get processed. They appear on the lore, but don't appear on Telegram. Sir Ammar debugged this bug and the log said: "Cannot get the \"message-id\" line". It turned out that the regex pattern for headers was wrong, if the header to be matched happens to be at the end of the headers, it will not have a double LF because previously we have already split the double LF with explode(). Fix this by changing the pattern to match the header if it happens to be at the end of the headers. Cc: Faris Suryanto <[email protected]> Debugged-by: Ammar Faizi <[email protected]> Signed-off-by: Alviro Iskandar Setiawan <[email protected]> --- bin/public-inbox-tg.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/public-inbox-tg.php b/bin/public-inbox-tg.php index 9d5771f..2e611ec 100644 --- a/bin/public-inbox-tg.php +++ b/bin/public-inbox-tg.php @@ -145,27 +145,27 @@ function fx(string $input): int } $body = trim($hdr[1]); - $hdr = $hdr[0]; + $hdr = trim($hdr[0]); - if (!preg_match("/(?:^|\\n)subject:\s+?(.+?)(?:\\n\S+\:|\\n\\n)/si", $hdr, $m)) { + if (!preg_match("/(?:^|\\n)subject:\s+?(.+?)(?:\\n\S+\:|$)/si", $hdr, $m)) { $err = "Cannot get the \"subject\" line"; goto out; } $subject = clean_header_val($m[1]); - if (!preg_match("/(?:^|\\n)from:\s+?(.+?)(?:\\n\S+\:|\\n\\n)/si", $hdr, $m)) { + if (!preg_match("/(?:^|\\n)from:\s+?(.+?)(?:\\n\S+\:|$)/si", $hdr, $m)) { $err = "Cannot get the \"from\" line"; goto out; } $from = clean_header_val($m[1]); - if (!preg_match("/(?:^|\\n)date:\s+?(.+?)(?:\\n\S+\:|\\n\\n)/si", $hdr, $m)) { + if (!preg_match("/(?:^|\\n)date:\s+?(.+?)(?:\\n\S+\:|$)/si", $hdr, $m)) { $err = "Cannot get the \"date\" line"; goto out; } $date = clean_header_val($m[1]); - if (!preg_match("/(?:^|\\n)message-id:\s+?(.+?)(?:\\n\S+\:|\\n\\n)/si", $hdr, $m)) { + if (!preg_match("/(?:^|\\n)message-id:\s+?(.+?)(?:\\n\S+\:|$)/si", $hdr, $m)) { $err = "Cannot get the \"message-id\" line"; goto out; } @@ -173,7 +173,7 @@ function fx(string $input): int if ($msgId[0] === '<' && $msgId[strlen($msgId) - 1] === '>') $msgId = substr(clean_header_val($msgId), 1, -1); - if (preg_match("/(?:^|\\n)in-reply-to:\s+?(.+?)(?:\\n\S+\:|\\n\\n)/si", $hdr, $m)) { + if (preg_match("/(?:^|\\n)in-reply-to:\s+?(.+?)(?:\\n\S+\:|$)/si", $hdr, $m)) { $inReplyTo = $m[1]; if ($inReplyTo[0] === '<' && $inReplyTo[strlen($inReplyTo) - 1] === '>') $inReplyTo = substr(clean_header_val($inReplyTo), 1, -1); @@ -182,7 +182,7 @@ function fx(string $input): int } $err = ""; - if (preg_match("/(?:^|\\n)to:\s+?(.+?)(?:\\n\S+\:|\\n\\n)/si", $hdr, $m)) { + if (preg_match("/(?:^|\\n)to:\s+?(.+?)(?:\\n\S+\:|$)/si", $hdr, $m)) { $toList = extractList(clean_header_val($m[1])); $toListStr = buildList($toList, "To"); } else { base-commit: 667913decf1869fde55d8fd17d66b4a294670617 -- 2.32.0 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: test debug 2022-03-06 13:00 ` Alviro Iskandar Setiawan @ 2022-03-06 13:06 ` Ammar Faizi 2022-03-06 13:10 ` Alviro Iskandar Setiawan 0 siblings, 1 reply; 17+ messages in thread From: Ammar Faizi @ 2022-03-06 13:06 UTC (permalink / raw) To: Alviro Iskandar Setiawan Cc: Alviro Iskandar Setiawan, GNU/Weeb Mailing List, Faris Suryanto On 3/6/22 8:00 PM, Alviro Iskandar Setiawan wrote: > Subject: [PATCH pit v1] bin/public-inbox-tg: Fix regex pattern for headers > From: Alviro Iskandar Setiawan <[email protected]> > > When testing email with Faris, we found that Faris' emails don't get > processed. They appear on the lore, but don't appear on Telegram. Sir > Ammar debugged this bug and the log said: "Cannot get the \"message-id\" > line". > > It turned out that the regex pattern for headers was wrong, if the > header to be matched happens to be at the end of the headers, it will > not have a double LF because previously we have already split the > double LF with explode(). Fix this by changing the pattern to match the > header if it happens to be at the end of the headers. Applied, thanks! -- Ammar Faizi ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: test debug 2022-03-06 13:06 ` Ammar Faizi @ 2022-03-06 13:10 ` Alviro Iskandar Setiawan 2022-03-06 13:13 ` Faris Suryanto 0 siblings, 1 reply; 17+ messages in thread From: Alviro Iskandar Setiawan @ 2022-03-06 13:10 UTC (permalink / raw) To: Faris Suryanto Cc: GNU/Weeb Mailing List, Ammar Faizi, Alviro Iskandar Setiawan On Sun, Mar 6, 2022 at 8:06 PM Ammar Faizi wrote: > Applied, thanks! gud. faris, test again, reply to this email plz -- Viro ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: test debug 2022-03-06 13:10 ` Alviro Iskandar Setiawan @ 2022-03-06 13:13 ` Faris Suryanto 2022-03-06 13:14 ` Alviro Iskandar Setiawan 0 siblings, 1 reply; 17+ messages in thread From: Faris Suryanto @ 2022-03-06 13:13 UTC (permalink / raw) To: alviro iskandar@gnuweeb. org Cc: GNU/Weeb Mailing List, Ammar Faizi, Alviro Iskandar Setiawan Test....... 👍 On 6 Mar 2022 20.11, at 20.11, Alviro Iskandar Setiawan <[email protected]> wrote: >On Sun, Mar 6, 2022 at 8:06 PM Ammar Faizi wrote: >> Applied, thanks! > >gud. >faris, test again, reply to this email plz > >-- Viro ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: test debug 2022-03-06 13:13 ` Faris Suryanto @ 2022-03-06 13:14 ` Alviro Iskandar Setiawan 2022-03-06 13:17 ` Alviro Iskandar Setiawan 0 siblings, 1 reply; 17+ messages in thread From: Alviro Iskandar Setiawan @ 2022-03-06 13:14 UTC (permalink / raw) To: Faris Suryanto Cc: GNU/Weeb Mailing List, Ammar Faizi, Alviro Iskandar Setiawan On Sun, Mar 6, 2022 at 8:13 PM Faris Suryanto wrote: > Test....... 👍 mantep msuk -- Viro ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: test debug 2022-03-06 13:14 ` Alviro Iskandar Setiawan @ 2022-03-06 13:17 ` Alviro Iskandar Setiawan 2022-03-06 13:20 ` Ammar Faizi 0 siblings, 1 reply; 17+ messages in thread From: Alviro Iskandar Setiawan @ 2022-03-06 13:17 UTC (permalink / raw) To: Faris Suryanto Cc: GNU/Weeb Mailing List, Ammar Faizi, Alviro Iskandar Setiawan On Sun, Mar 6, 2022 at 8:14 PM Alviro Iskandar Setiawan wrote: > On Sun, Mar 6, 2022 at 8:13 PM Faris Suryanto wrote: > > Test....... 👍 > > mantep msuk > something still goes wrong when the sender uses "Content-Transfer-Encoding: quoted-printable" the raw email shows =XX for unprintable chars XX is a hex representation of the unprintable char -- Viro ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: test debug 2022-03-06 13:17 ` Alviro Iskandar Setiawan @ 2022-03-06 13:20 ` Ammar Faizi 2022-03-06 13:25 ` Alviro Iskandar Setiawan 0 siblings, 1 reply; 17+ messages in thread From: Ammar Faizi @ 2022-03-06 13:20 UTC (permalink / raw) To: Alviro Iskandar Setiawan Cc: GNU/Weeb Mailing List, Faris Suryanto, Alviro Iskandar Setiawan On 3/6/22 8:17 PM, Alviro Iskandar Setiawan wrote: > something still goes wrong when the sender uses > "Content-Transfer-Encoding: quoted-printable" > the raw email shows =XX for unprintable chars > > XX is a hex representation of the unprintable char > This one a bit harder to do it manually, maybe we should start using external library for this? I don't feel strongly to write our own parser for this kind of encoding. -- Ammar Faizi ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: test debug 2022-03-06 13:20 ` Ammar Faizi @ 2022-03-06 13:25 ` Alviro Iskandar Setiawan 2022-03-06 13:33 ` Ammar Faizi 0 siblings, 1 reply; 17+ messages in thread From: Alviro Iskandar Setiawan @ 2022-03-06 13:25 UTC (permalink / raw) To: Ammar Faizi Cc: GNU/Weeb Mailing List, Faris Suryanto, Alviro Iskandar Setiawan On Sun, Mar 6, 2022 at 8:20 PM Ammar Faizi wrote: > On 3/6/22 8:17 PM, Alviro Iskandar Setiawan wrote: > > something still goes wrong when the sender uses > > "Content-Transfer-Encoding: quoted-printable" > > the raw email shows =XX for unprintable chars > > > > XX is a hex representation of the unprintable char > > > > This one a bit harder to do it manually, maybe we should start > using external library for this? yes, i think we better use an external library if there exists such a library, but idk, me never parse this encoding > I don't feel strongly to write our own parser for this kind of > encoding. me too, but if we have to, we should do it!!!!!! -- Viro ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: test debug 2022-03-06 13:25 ` Alviro Iskandar Setiawan @ 2022-03-06 13:33 ` Ammar Faizi 0 siblings, 0 replies; 17+ messages in thread From: Ammar Faizi @ 2022-03-06 13:33 UTC (permalink / raw) To: Alviro Iskandar Setiawan Cc: GNU/Weeb Mailing List, Faris Suryanto, Alviro Iskandar Setiawan, Dhiky Cancerio On 3/6/22 8:25 PM, Alviro Iskandar Setiawan wrote: > On Sun, Mar 6, 2022 at 8:20 PM Ammar Faizi wrote: >> On 3/6/22 8:17 PM, Alviro Iskandar Setiawan wrote: >>> something still goes wrong when the sender uses >>> "Content-Transfer-Encoding: quoted-printable" >>> the raw email shows =XX for unprintable chars >>> >>> XX is a hex representation of the unprintable char >>> >> >> This one a bit harder to do it manually, maybe we should start >> using external library for this? > > yes, i think we better use an external library if there exists such a > library, but idk, me never parse this encoding We can defer this until we have good enough time for fixing it. I think there are still more important works to be done. For example, finishing the server migration, which is much more urgent than Telegram notification. + Added Dhiky to CC list. >> I don't feel strongly to write our own parser for this kind of >> encoding. > > me too, but if we have to, we should do it!!!!!! Sure we can do it, shouldn't be too hard for a competent programmer like you :p -- Ammar Faizi ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2022-03-06 13:33 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-03-06 10:49 test debug Alviro Iskandar Setiawan 2022-03-06 10:53 ` Ammar Faizi 2022-03-06 11:01 ` Ammar Faizi 2022-03-06 11:03 ` Alviro Iskandar Setiawan 2022-03-06 11:04 ` Ammar Faizi 2022-03-06 11:08 ` Alviro Iskandar Setiawan 2022-03-06 11:12 ` Ammar Faizi 2022-03-06 11:15 ` Alviro Iskandar Setiawan 2022-03-06 13:00 ` Alviro Iskandar Setiawan 2022-03-06 13:06 ` Ammar Faizi 2022-03-06 13:10 ` Alviro Iskandar Setiawan 2022-03-06 13:13 ` Faris Suryanto 2022-03-06 13:14 ` Alviro Iskandar Setiawan 2022-03-06 13:17 ` Alviro Iskandar Setiawan 2022-03-06 13:20 ` Ammar Faizi 2022-03-06 13:25 ` Alviro Iskandar Setiawan 2022-03-06 13:33 ` Ammar Faizi
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox