unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#18811: 25.0.50; Saving or visitting files with ".gpg" extension
@ 2014-10-23 18:45 Dani Moncayo
  2014-11-02 21:32 ` Ted Zlatanov
  2014-11-03  2:40 ` Stefan Monnier
  0 siblings, 2 replies; 11+ messages in thread
From: Dani Moncayo @ 2014-10-23 18:45 UTC (permalink / raw)
  To: 18811

Recipe 1:
  emacs -Q
  C-x C-w f . g p g RET

The file is not saved.  Generated Messages:
  Saving file c:/mingw/bin/f.gpg...
  Opening output file: Searching for program, no such file or directory, gpg

Recipe 2:
  echo hello > f.gpg
  emacs -Q
  C-x C-f f . g p g RET

The file is not visited.  Generated Message:
  epa-file--find-file-not-found-function: Opening input file:
Searching for program, no such file or directory, gpg


In GNU Emacs 25.0.50.1 (i686-pc-mingw32)
 of 2014-10-20 on LEG570
Repository revision: 118168 rgm@gnu.org-20141020195941-icp42t8ttcnud09g
Windowing system distributor `Microsoft Corp.', version 6.3.9600
Configured using:
 `configure --enable-checking=yes,glyphs CPPFLAGS=-DGLYPH_DEBUG=1'

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB

Important settings:
  value of $LANG: ENU
  locale-coding-system: cp1252


-- 
Dani Moncayo





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#18811: 25.0.50; Saving or visitting files with ".gpg" extension
  2014-10-23 18:45 bug#18811: 25.0.50; Saving or visitting files with ".gpg" extension Dani Moncayo
@ 2014-11-02 21:32 ` Ted Zlatanov
  2014-11-04  6:28   ` Daiki Ueno
  2014-11-03  2:40 ` Stefan Monnier
  1 sibling, 1 reply; 11+ messages in thread
From: Ted Zlatanov @ 2014-11-02 21:32 UTC (permalink / raw)
  To: Dani Moncayo, Daiki Ueno; +Cc: 18811

On Thu, 23 Oct 2014 20:45:46 +0200 Dani Moncayo <dmoncayo@gmail.com> wrote: 

DM> Recipe 1:
DM>   emacs -Q
DM>   C-x C-w f . g p g RET

DM> The file is not saved.  Generated Messages:
DM>   Saving file c:/mingw/bin/f.gpg...
DM>   Opening output file: Searching for program, no such file or directory, gpg

DM> Recipe 2:
DM>   echo hello > f.gpg
DM>   emacs -Q
DM>   C-x C-f f . g p g RET

DM> The file is not visited.  Generated Message:
DM>   epa-file--find-file-not-found-function: Opening input file:
DM> Searching for program, no such file or directory, gpg

I can confirm the bug. I don't know if the right place to fix this is in
the EPA handlers themselves or one level up (partly it depends on how
tightly Emacs wants to be integrated with EPA/EPG by default).

CC to Daiki Ueno. I have refrained from digging deeper until we hear
from him.

Thanks
Ted





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#18811: 25.0.50; Saving or visitting files with ".gpg" extension
  2014-10-23 18:45 bug#18811: 25.0.50; Saving or visitting files with ".gpg" extension Dani Moncayo
  2014-11-02 21:32 ` Ted Zlatanov
@ 2014-11-03  2:40 ` Stefan Monnier
  2014-11-03  7:23   ` Dani Moncayo
  2014-11-03 12:04   ` Ted Zlatanov
  1 sibling, 2 replies; 11+ messages in thread
From: Stefan Monnier @ 2014-11-03  2:40 UTC (permalink / raw)
  To: Dani Moncayo; +Cc: 18811

>   emacs -Q
>   C-x C-w f . g p g RET

> The file is not saved.  Generated Messages:
>   Saving file c:/mingw/bin/f.gpg...
>   Opening output file: Searching for program, no such file or directory, gpg

What behavior did you expect?

> Recipe 2:
>   echo hello > f.gpg
>   emacs -Q
>   C-x C-f f . g p g RET

> The file is not visited.  Generated Message:
>   epa-file--find-file-not-found-function: Opening input file:
> Searching for program, no such file or directory, gpg

Same here: what behavior did you expect?

Do you expect auto-encryption-mode to be disabled when gpg is not in
exec-path?


        Stefan





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#18811: 25.0.50; Saving or visitting files with ".gpg" extension
  2014-11-03  2:40 ` Stefan Monnier
@ 2014-11-03  7:23   ` Dani Moncayo
  2014-11-03  7:36     ` Dani Moncayo
                       ` (2 more replies)
  2014-11-03 12:04   ` Ted Zlatanov
  1 sibling, 3 replies; 11+ messages in thread
From: Dani Moncayo @ 2014-11-03  7:23 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 18811

Hi Stefan,

>>   emacs -Q
>>   C-x C-w f . g p g RET
>
>> The file is not saved.  Generated Messages:
>>   Saving file c:/mingw/bin/f.gpg...
>>   Opening output file: Searching for program, no such file or directory, gpg
>
> What behavior did you expect?

See below.

>> Recipe 2:
>>   echo hello > f.gpg
>>   emacs -Q
>>   C-x C-f f . g p g RET
>
>> The file is not visited.  Generated Message:
>>   epa-file--find-file-not-found-function: Opening input file:
>> Searching for program, no such file or directory, gpg
>
> Same here: what behavior did you expect?
>
> Do you expect auto-encryption-mode to be disabled when gpg is not in
> exec-path?

I didn't know about that mode, but yes, I don't think it is reasonable
to have that mode enabled when it will certainly fail (preventing the
user from visiting/saving a file/buffer).

Also, I'd say that, whenever the encryption/decryption fails (for any
reason), it should never prevent the user from visiting/saving a file.
Instead, in that case the operation should proceed as if no
encryption/decryption was requested, showing a warning in the echo
area.

-- 
Dani Moncayo





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#18811: 25.0.50; Saving or visitting files with ".gpg" extension
  2014-11-03  7:23   ` Dani Moncayo
@ 2014-11-03  7:36     ` Dani Moncayo
  2014-11-03  8:06     ` Dani Moncayo
  2014-11-03 14:57     ` Stefan Monnier
  2 siblings, 0 replies; 11+ messages in thread
From: Dani Moncayo @ 2014-11-03  7:36 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 18811

> Also, I'd say that, whenever the encryption/decryption fails (for any
> reason), it should never prevent the user from visiting/saving a file.
> Instead, in that case the operation should proceed as if no
> encryption/decryption was requested, showing a warning in the echo
> area.

Well, on second thought, I'm not sure about this part.  So I take it back.

-- 
Dani Moncayo





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#18811: 25.0.50; Saving or visitting files with ".gpg" extension
  2014-11-03  7:23   ` Dani Moncayo
  2014-11-03  7:36     ` Dani Moncayo
@ 2014-11-03  8:06     ` Dani Moncayo
  2014-11-03 14:57     ` Stefan Monnier
  2 siblings, 0 replies; 11+ messages in thread
From: Dani Moncayo @ 2014-11-03  8:06 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 18811

>> Do you expect auto-encryption-mode to be disabled when gpg is not in
>> exec-path?
>
> I didn't know about that mode, but yes, I don't think it is reasonable
> to have that mode enabled when it will certainly fail (preventing the
> user from visiting/saving a file/buffer).

Therefore, perhaps we should disable 'auto-encryption-mode' by
default, because it doesn't work on environments where "gpg" is not
available (and the default value should be clearly defined, and not
depend on runtime conditions).

-- 
Dani Moncayo





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#18811: 25.0.50; Saving or visitting files with ".gpg" extension
  2014-11-03  2:40 ` Stefan Monnier
  2014-11-03  7:23   ` Dani Moncayo
@ 2014-11-03 12:04   ` Ted Zlatanov
  1 sibling, 0 replies; 11+ messages in thread
From: Ted Zlatanov @ 2014-11-03 12:04 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 18811

On Sun, 02 Nov 2014 21:40:03 -0500 Stefan Monnier <monnier@iro.umontreal.ca> wrote: 

>> emacs -Q
>> C-x C-w f . g p g RET

>> The file is not saved.  Generated Messages:
>> Saving file c:/mingw/bin/f.gpg...
>> Opening output file: Searching for program, no such file or directory, gpg

SM> What behavior did you expect?

Maybe a message?

"This looks like a GnuPG encrypted file, but we couldn't find the gpg
executable while saving it. Do you want to save it as plaintext, rename,
disable auto-encryption-mode, or abort (p, r, d, a)?"

>> Recipe 2:
>> echo hello > f.gpg
>> emacs -Q
>> C-x C-f f . g p g RET

>> The file is not visited.  Generated Message:
>> epa-file--find-file-not-found-function: Opening input file:
>> Searching for program, no such file or directory, gpg

SM> Same here: what behavior did you expect?

Maybe a message?

"This looks like a GnuPG encrypted file, but we couldn't find the gpg
executable. Aborting."

SM> Do you expect auto-encryption-mode to be disabled when gpg is not in
SM> exec-path?

I think it's good to have it enabled by default.

Ted





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#18811: 25.0.50; Saving or visitting files with ".gpg" extension
  2014-11-03  7:23   ` Dani Moncayo
  2014-11-03  7:36     ` Dani Moncayo
  2014-11-03  8:06     ` Dani Moncayo
@ 2014-11-03 14:57     ` Stefan Monnier
  2014-11-03 16:02       ` Dani Moncayo
  2 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2014-11-03 14:57 UTC (permalink / raw)
  To: Dani Moncayo; +Cc: 18811

>>> emacs -Q
>>> C-x C-w f . g p g RET
>>> The file is not saved.  Generated Messages:
>>> Saving file c:/mingw/bin/f.gpg...
>>> Opening output file: Searching for program, no such file or directory, gpg
>> What behavior did you expect?
> See below.

The .gpg extension is normally used for encrypted files, so C-x C-w
foo.gpg RET *should* either encrypt the file or signal an error.
Saving the file in plain text would be a major security error, I think.

When visiting a .gpg file it would be acceptable to open it as "plain
text" and show the corresponding binary "garbage", but I'm not sure how
useful that would be.  You can always use `find-file-literally' for that.

> I didn't know about that mode, but yes, I don't think it is reasonable
> to have that mode enabled when it will certainly fail (preventing the
> user from visiting/saving a file/buffer).

I guess for writing purposes, we could offer a write-file-literally command.
But I think it's best not to enable/disable auto-encryption-mode based
on the presence of `gpg', since there'd the be the risk that the user
saves a file as foo.gpg expecting it to be encrypted and then be very
disappointed later on to discover that for some reason Emacs failed to
find `gpg' at that time and just saved it in plain text instead.

As for whether it should be enabled or disabled by default, we've had it
enabled for a long time with almost no complaints so far (other than
yours, obviously), so I think it's a good default.


        Stefan





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#18811: 25.0.50; Saving or visitting files with ".gpg" extension
  2014-11-03 14:57     ` Stefan Monnier
@ 2014-11-03 16:02       ` Dani Moncayo
  0 siblings, 0 replies; 11+ messages in thread
From: Dani Moncayo @ 2014-11-03 16:02 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 18811

On Mon, Nov 3, 2014 at 3:57 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>>>> emacs -Q
>>>> C-x C-w f . g p g RET
>>>> The file is not saved.  Generated Messages:
>>>> Saving file c:/mingw/bin/f.gpg...
>>>> Opening output file: Searching for program, no such file or directory, gpg
>>> What behavior did you expect?
>> See below.
>
> The .gpg extension is normally used for encrypted files, so C-x C-w
> foo.gpg RET *should* either encrypt the file or signal an error.
> Saving the file in plain text would be a major security error, I think.
>
> When visiting a .gpg file it would be acceptable to open it as "plain
> text" and show the corresponding binary "garbage", but I'm not sure how
> useful that would be.  You can always use `find-file-literally' for that.
>
>> I didn't know about that mode, but yes, I don't think it is reasonable
>> to have that mode enabled when it will certainly fail (preventing the
>> user from visiting/saving a file/buffer).
>
> I guess for writing purposes, we could offer a write-file-literally command.
> But I think it's best not to enable/disable auto-encryption-mode based
> on the presence of `gpg', since there'd the be the risk that the user
> saves a file as foo.gpg expecting it to be encrypted and then be very
> disappointed later on to discover that for some reason Emacs failed to
> find `gpg' at that time and just saved it in plain text instead.
>
> As for whether it should be enabled or disabled by default, we've had it
> enabled for a long time with almost no complaints so far (other than
> yours, obviously), so I think it's a good default.

Well, I actually hit this problem by accident, because I stored the
output of "gpg --export --armor my_key_id" in a file with .gpg
extension.

It was a surprise for me not being able to visit that file from Emacs,
but IIUC, I chose a *bad* extension for the file, and I could have
visited my file just disabling auto-encryption-mode.

So, I think this bug report can be closed.

Thank you.

-- 
Dani Moncayo





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#18811: 25.0.50; Saving or visitting files with ".gpg" extension
  2014-11-02 21:32 ` Ted Zlatanov
@ 2014-11-04  6:28   ` Daiki Ueno
  2014-11-04  7:37     ` Dani Moncayo
  0 siblings, 1 reply; 11+ messages in thread
From: Daiki Ueno @ 2014-11-04  6:28 UTC (permalink / raw)
  To: Dani Moncayo; +Cc: 18811

Ted Zlatanov <tzz@lifelogs.com> writes:

> On Thu, 23 Oct 2014 20:45:46 +0200 Dani Moncayo <dmoncayo@gmail.com> wrote: 
>
> DM> Recipe 1:
> DM>   emacs -Q
> DM>   C-x C-w f . g p g RET
>
> DM> The file is not saved.  Generated Messages:
> DM>   Saving file c:/mingw/bin/f.gpg...
> DM>   Opening output file: Searching for program, no such file or directory, gpg
>
> DM> Recipe 2:
> DM>   echo hello > f.gpg
> DM>   emacs -Q
> DM>   C-x C-f f . g p g RET
>
> DM> The file is not visited.  Generated Message:
> DM>   epa-file--find-file-not-found-function: Opening input file:
> DM> Searching for program, no such file or directory, gpg

Those are basically the same behavior as jka-compr, when gzip is not
installed.  One difference is that epa-file doesn't open an empty buffer
(it is intentional: see bug#6568).

> I can confirm the bug. I don't know if the right place to fix this is in
> the EPA handlers themselves or one level up (partly it depends on how
> tightly Emacs wants to be integrated with EPA/EPG by default).
>
> CC to Daiki Ueno. I have refrained from digging deeper until we hear
> from him.

I don't think this is a bug.  For 2, you can use M-x
find-file-literally.  For 1, oh, I don't know how to inhibit file
handlers when saving.





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#18811: 25.0.50; Saving or visitting files with ".gpg" extension
  2014-11-04  6:28   ` Daiki Ueno
@ 2014-11-04  7:37     ` Dani Moncayo
  0 siblings, 0 replies; 11+ messages in thread
From: Dani Moncayo @ 2014-11-04  7:37 UTC (permalink / raw)
  To: Daiki Ueno; +Cc: 18811

> I don't think this is a bug.  For 2, you can use M-x
> find-file-literally.  For 1, oh, I don't know how to inhibit file
> handlers when saving.

Or, even simpler: just disable auto-encryption-mode.

Perhaps, the error messages could be a bit more helpful, but as
I said, I'm ok with closing this bug now.

-- 
Dani Moncayo





^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-11-04  7:37 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-23 18:45 bug#18811: 25.0.50; Saving or visitting files with ".gpg" extension Dani Moncayo
2014-11-02 21:32 ` Ted Zlatanov
2014-11-04  6:28   ` Daiki Ueno
2014-11-04  7:37     ` Dani Moncayo
2014-11-03  2:40 ` Stefan Monnier
2014-11-03  7:23   ` Dani Moncayo
2014-11-03  7:36     ` Dani Moncayo
2014-11-03  8:06     ` Dani Moncayo
2014-11-03 14:57     ` Stefan Monnier
2014-11-03 16:02       ` Dani Moncayo
2014-11-03 12:04   ` Ted Zlatanov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).