Subject: bug#28114: 25.2; plstore decrypt erroneous on Windows due to carriage return characters

From: Daiki Ueno <[email-masked]>
Date: Mon, 28 Aug 2017 14:30:01 +0200

Hello,

Eli Zaretskii <[email-masked]> writes:

>> From: "Rainer Gemulla" <[email-masked]>
>> Date: Wed, 16 Aug 2017 20:09:46 +0000
>> 
>> When I use plstore with gnupg (from either Cygwin or directly the
>> Windows version), plstore does not
>> correctly decrypt. 
>> 
>> The reason seems to be that spurious carriage return characters are
>> added when encrypting the plstore file.
>> When later decrypting it, these carriage returns make gnupg fail.
>> 
>> This issue can be reproduced by opening a plstore file in
>> plstore-mode and encrypting and decrypting it
>> repeatedly via C-c C-c. The added carriage returns are directly visible.
>> 
>> The error also affects other packages that use the plstore.
>> 
>> A quick workaround for me was to add an advice that removes the
>> carriage returns (here ^M needs to be
>> replaced by the carriage return character):
>
> Daiki, could you please look into this?  AFAICT, the problem is that
> plstore.el uses insert-file-contents-literally to read the files,
> which leaves the CR characters intact.  Why does plstore.el needs to
> use that function?  Can it instead bind coding-system-for-read to
> raw-text, and then use insert-file-contents?  Or even just use
> insert-file-contents?

Sorry for the late response.  I barely remember the detail, but I
suppose it is a leftover when I made plstore editable.  It sounds good
to just use insert-file-contents here.

Regards,
-- 
Daiki Ueno