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

From: Eli Zaretskii <[email-masked]>
Date: Fri, 18 Aug 2017 12:20:49 +0300

> 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?

Thanks.