MIME::QuotedPrint encode_qp emits LF instead of requested CRLF
还没有人认领这个 Issue。
评估
调研方向
从 MIMEQuotedPrint.encodeQuotedPrintable 开始,该处会输出普通输入换行,并将其处理方式与现有使用 eol 处理软换行的方式进行比较。为 CRLF 输入和请求的 CRLF 输出添加有针对性的覆盖,然后分别使用 ./jperl 和 ./jperl --interpreter 运行 upstream 的 t/basic.t 测试套件;当字节完全为 CRLF 且全部 13 项测试通过时即表示完成。
由索引模型根据 Issue 内容生成。
描述
Summary
PerlOnJava's bundled MIME::QuotedPrint provider emits LF line endings when
encode_qp is asked to use CRLF. This breaks Email::MIME::Encodings's
quoted-printable encoder, which is required to preserve RFC email line
endings.
Reproduction
Run the upstream Email::MIME::Encodings 1.317 test suite:
./jperl t/basic.t
./jperl --interpreter t/basic.t
The suite reports one failure in enc qp:
not ok 8 - enc qp
got: 'This is a test\nof various MIME=3Dstuff.=\n'
expected: 'This is a test\r\nof various MIME=3Dstuff.=\r\n'
The failure reproduces on both the JVM and interpreter backends. System Perl
passes the complete upstream suite: 13 tests successful.
A minimal provider-level reproducer is:
./jperl -MMIME::QuotedPrint -e 'my $x="a\r\nb"; my $y=encode_qp($x,"\r\n"); print unpack("H*",$y),"\n"'
The expected encoded bytes begin with 610d0a (a\\r\\n), but PerlOnJava
returns 610a (a\\n).
CPAN failure
The CPAN random-tester run 20260910-101908-8428 recorded FAIL for
Email::MIME::Encodings 1.317:
1/13 subtests failed; 1/2 test programs failed
The failing test is the distribution's stable t/basic.t test, assertion 8.
The distribution itself is pure Perl and has no external service or native
library prerequisite.
Technical cause
Email::MIME::Encodings::codec passes the requested EOL to
MIME::QuotedPrint::encode_qp:
return $sub->($what, $eol);
The PerlOnJava implementation in MIMEQuotedPrint.encodeQuotedPrintable
hardcodes LF when it encounters an input newline:
output.append(currentLine).append("\\n");
It should preserve the requested eol value (CRLF in this case). The same
implementation already uses eol for soft line breaks, so handling ordinary
newlines consistently with that parameter appears to be the missing piece.
Impact
Email and MIME libraries using PerlOnJava's quoted-printable provider can
produce non-conforming line endings even when explicitly requesting CRLF.
This can affect message serialization, canonicalization, signatures, and
interoperability with MIME consumers.
Suggested fix and regression coverage
Update MIMEQuotedPrint.encodeQuotedPrintable to append the requested EOL for
preserved newlines, while retaining existing binary-mode and CRLF-normalizing
behavior. Add a focused regression test that checks the exact bytes returned
by encode_qp for CRLF input and requested CRLF output, and run the
Email::MIME::Encodings test under both execution backends.
- 主要语言
- Perl
- 星标
- 64
- 派生
- 6
- 平均合并
- 5 小时 25 分钟
- 30 天内合并 PR
- 157
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
fglock/PerlOnJava 的其他 Issue
-
area:cpan-port bug
难度 4/5 3-5 天 新手友好度 44/100
fglock/PerlOnJava#1459 ·
-
area:cpan-port bug
难度 3/5 1-2 天 新手友好度 72/100
fglock/PerlOnJava#1457 ·
-
bug high-impact
难度 3/5 1-2 天 新手友好度 67/100
fglock/PerlOnJava#1456 · 1 条评论 ·
-
bug
难度 4/5 3-5 天 新手友好度 72/100
fglock/PerlOnJava#1455 ·
-
bug
难度 4/5 3-5 天 新手友好度 68/100
fglock/PerlOnJava#1454 ·
查看 fglock/PerlOnJava 的全部 Issue
相似的 Issue
-
1.severity: security
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 82/100
api7/lua-resty-saml#63 ·
-
难度 1/5 1 小时以内 新手友好度 68/100
-
难度 1/5 1 小时以内 新手友好度 82/100
-
难度 1/5 1 小时以内 新手友好度 72/100