unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16679: 24.3.50; can't create a newly encrypted gpg file with easypg in cygwin emacs
@ 2014-02-07  4:45 Jason Lewis
  2014-02-08  1:42 ` Glenn Morris
  0 siblings, 1 reply; 13+ messages in thread
From: Jason Lewis @ 2014-02-07  4:45 UTC (permalink / raw)
  To: 16679


[-- Attachment #1.1: Type: text/plain, Size: 1038 bytes --]

Creating a new file that is to be encrypted in emacs with easypg fails
with the error: Opening output file: stringp, nil

Steps to reproduce:

emacs -Q

(require 'epa-file)
(epa-file-enable)

C-x C-f somefile.gpg <enter>

type some text and try and save the file with C-x C-s

observe error: Opening output file: stringp, nil
and file is not saved.

I expect it should ask me which gpg key I want to encrypt the file for
rather than throwing an error.

I tested this with emacs -Q under cygwin and got the error
emacs compiled today from git. version "24.3.50.1"
checkout: fa431ad4a3f3040f6cc4535627c4d6f48ede9a94


I also tested on linux emacs v. 24.3.50.1
where it seems to work as expected.

backtrace seems to include some control characters, i presume because
the el files are compiled to elc
unfortunately I was unable to determine which files I should change to
.el files so it would have a proper backtrace

included here in case that's of use?






Jason Lewis
http://emacstragic.net


[-- Attachment #1.2: easypg-backtrace.gz --]
[-- Type: application/x-gzip, Size: 402 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 834 bytes --]

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

* bug#16679: 24.3.50; can't create a newly encrypted gpg file with easypg in cygwin emacs
  2014-02-07  4:45 bug#16679: 24.3.50; can't create a newly encrypted gpg file with easypg in cygwin emacs Jason Lewis
@ 2014-02-08  1:42 ` Glenn Morris
  2014-02-08  8:54   ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Glenn Morris @ 2014-02-08  1:42 UTC (permalink / raw)
  To: Jason Lewis; +Cc: 16679

Jason Lewis wrote:

> backtrace seems to include some control characters, i presume because
> the el files are compiled to elc
> unfortunately I was unable to determine which files I should change to
> .el files so it would have a proper backtrace

Thanks. Loading the uncompiled version of epa-file first may give a more
informative backtrace:

  M-x load-file path/to/lisp/epa-file.el

The fact that the file is actually on drive c but pretends to be on
drive d (?) seems odd to me, but may be totally normal for all I know of
Cygwin:

  write-region(nil nil "/cygdrive/c/Users/jason/test.gpg" nil t "/cygdrive/d/Users/jason/test.gpg")





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

* bug#16679: 24.3.50; can't create a newly encrypted gpg file with easypg in cygwin emacs
  2014-02-08  1:42 ` Glenn Morris
@ 2014-02-08  8:54   ` Eli Zaretskii
  2014-02-08 10:05     ` Jason Lewis
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2014-02-08  8:54 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 16679, jason

> From: Glenn Morris <rgm@gnu.org>
> Date: Fri, 07 Feb 2014 20:42:25 -0500
> Cc: 16679@debbugs.gnu.org
> 
> The fact that the file is actually on drive c but pretends to be on
> drive d (?) seems odd to me, but may be totally normal for all I know of
> Cygwin:
> 
>   write-region(nil nil "/cygdrive/c/Users/jason/test.gpg" nil t "/cygdrive/d/Users/jason/test.gpg")

No, it isn't normal.  "cygdrive/x" is the Cygwin incarnation of the
Windows "x:" reference to a drive letter.  So I guess there's some
problem somewhere, since I can hardly believe the OP has a d:/Users
directory.





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

* bug#16679: 24.3.50; can't create a newly encrypted gpg file with easypg in cygwin emacs
  2014-02-08  8:54   ` Eli Zaretskii
@ 2014-02-08 10:05     ` Jason Lewis
  2014-02-08 14:18       ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Jason Lewis @ 2014-02-08 10:05 UTC (permalink / raw)
  To: Eli Zaretskii, Glenn Morris; +Cc: 16679


[-- Attachment #1.1: Type: text/plain, Size: 1448 bytes --]

On 8/02/2014 7:54 pm, Eli Zaretskii wrote:
>> From: Glenn Morris <rgm@gnu.org>
>> Date: Fri, 07 Feb 2014 20:42:25 -0500
>> Cc: 16679@debbugs.gnu.org
>>
>> The fact that the file is actually on drive c but pretends to be on
>> drive d (?) seems odd to me, but may be totally normal for all I know of
>> Cygwin:
>>
>>   write-region(nil nil "/cygdrive/c/Users/jason/test.gpg" nil t "/cygdrive/d/Users/jason/test.gpg")
> No, it isn't normal.  "cygdrive/x" is the Cygwin incarnation of the
> Windows "x:" reference to a drive letter.  So I guess there's some
> problem somewhere, since I can hardly believe the OP has a d:/Users
> directory.
>
Ah, I didn't notice that in the backtrace, that was well spotted by Glen.

Because I like to live life on the edge, I decided to mount my user
directory from my drive D:, following a procedure much like this one:

http://caskater4.blogspot.com.au/2007/09/moving-your-data-where-you-want-in.html

something like this:

 1. xcopy /E /H /O /X /Y /I C:\Users D:\Users
 2. rmdir /S /Q C:\Users
 3. rmdir "C:\Documents and Settings"
 4. mklink /J C:\Users D:\Users
 5. mklink /J "C:\Documents and Settings" D:\Users

I'm not in front of that computer right now but that sounds as though it
has something to do with it.

could it be that there is two ways the path is expanded in easypg? and
they return different results?

Jason


-- 
Jason Lewis
http://emacstragic.net


[-- Attachment #1.2: Type: text/html, Size: 3213 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 898 bytes --]

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

* bug#16679: 24.3.50; can't create a newly encrypted gpg file with easypg in cygwin emacs
  2014-02-08 10:05     ` Jason Lewis
@ 2014-02-08 14:18       ` Eli Zaretskii
  2014-02-10 23:04         ` Jason Lewis
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2014-02-08 14:18 UTC (permalink / raw)
  To: Jason Lewis; +Cc: 16679

> Date: Sat, 08 Feb 2014 21:05:21 +1100
> From: Jason Lewis <jason@dickson.st>
> CC: 16679@debbugs.gnu.org
> 
> Because I like to live life on the edge, I decided to mount my user
> directory from my drive D:, following a procedure much like this one:
> 
> http://caskater4.blogspot.com.au/2007/09/moving-your-data-where-you-want-in.html
> 
> something like this:
> 
>  1. xcopy /E /H /O /X /Y /I C:\Users D:\Users
>  2. rmdir /S /Q C:\Users
>  3. rmdir "C:\Documents and Settings"
>  4. mklink /J C:\Users D:\Users
>  5. mklink /J "C:\Documents and Settings" D:\Users
> 
> I'm not in front of that computer right now but that sounds as though it
> has something to do with it.

Are you sure every program you use, starting with Emacs, fully
supports directory junction points created like that?





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

* bug#16679: 24.3.50; can't create a newly encrypted gpg file with easypg in cygwin emacs
  2014-02-08 14:18       ` Eli Zaretskii
@ 2014-02-10 23:04         ` Jason Lewis
  2014-02-11  3:46           ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Jason Lewis @ 2014-02-10 23:04 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 16679

[-- Attachment #1: Type: text/plain, Size: 6437 bytes --]


Eli Zaretskii wrote, On 9/02/2014 1:18 AM:
>> Date: Sat, 08 Feb 2014 21:05:21 +1100
>> From: Jason Lewis <jason@dickson.st>
>> CC: 16679@debbugs.gnu.org
>>
>> Because I like to live life on the edge, I decided to mount my user
>> directory from my drive D:, following a procedure much like this one:
>>
>> http://caskater4.blogspot.com.au/2007/09/moving-your-data-where-you-want-in.html
>>
>> something like this:
>>
>>  1. xcopy /E /H /O /X /Y /I C:\Users D:\Users
>>  2. rmdir /S /Q C:\Users
>>  3. rmdir "C:\Documents and Settings"
>>  4. mklink /J C:\Users D:\Users
>>  5. mklink /J "C:\Documents and Settings" D:\Users
>>
>> I'm not in front of that computer right now but that sounds as though it
>> has something to do with it.
> Are you sure every program you use, starting with Emacs, fully
> supports directory junction points created like that?
>

I've not encountered any problems with directory junctions yet. I've
been running it like this for at least 6 months.

I tested again by trying to creating a file on /cygdrive/c/Temp which is
not on the junctioned drive and received the same error.

backtrace:

Debugger entered--Lisp error: (file-error "Opening output file" stringp nil)
  signal(file-error ("Opening output file" stringp nil))
  (condition-case error (setq string (epg-encrypt-string context (if
(stringp start) (epa-file--encode-coding-string start coding-system) (if
start nil (setq start (point-min) end (point-max))) (setq buffer
(current-buffer)) (let ((temp-buffer (generate-new-buffer " *temp*")))
(save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn ...
... ...) (and ... ...))))) (if (or (eq epa-file-select-keys t) (and
(null epa-file-select-keys) (not (local-variable-p ... ...))))
(epa-select-keys context "Select recipients for encryption.\nIf no one
is selected, symmetric encryption will be performed.  " recipients) (if
epa-file-encrypt-to (epg-list-keys context recipients))))) (error (if
(setq entry (assoc file epa-file-passphrase-alist)) (setcdr entry nil))
(signal (quote file-error) (cons "Opening output file" (cdr error)))))
  (let* ((coding-system (or coding-system-for-write (if (fboundp (quote
select-safe-coding-system)) (let ((buffer-file-name ...))
(select-safe-coding-system (point-min) (point-max)))
buffer-file-coding-system))) (context (epg-make-context))
(coding-system-for-write (quote binary)) string entry (recipients (cond
((listp epa-file-encrypt-to) epa-file-encrypt-to) ((stringp
epa-file-encrypt-to) (list epa-file-encrypt-to)))) buffer)
(epg-context-set-passphrase-callback context (cons (function
epa-file-passphrase-callback-function) file))
(epg-context-set-progress-callback context (cons (function
epa-progress-callback-function) (format "Encrypting %s" file)))
(epg-context-set-armor context epa-armor) (condition-case error (setq
string (epg-encrypt-string context (if (stringp start)
(epa-file--encode-coding-string start coding-system) (if start nil (setq
start (point-min) end (point-max))) (setq buffer (current-buffer)) (let
((temp-buffer ...)) (save-current-buffer (set-buffer temp-buffer)
(unwind-protect ... ...)))) (if (or (eq epa-file-select-keys t) (and
(null epa-file-select-keys) (not ...))) (epa-select-keys context "Select
recipients for encryption.\nIf no one is selected, symmetric encryption
will be performed.  " recipients) (if epa-file-encrypt-to (epg-list-keys
context recipients))))) (error (if (setq entry (assoc file
epa-file-passphrase-alist)) (setcdr entry nil)) (signal (quote
file-error) (cons "Opening output file" (cdr error)))))
(epa-file-run-real-handler (function write-region) (list string nil file
append visit lockname mustbenew)) (if (boundp (quote
last-coding-system-used)) (setq last-coding-system-used coding-system))
(if (eq visit t) (progn (setq buffer-file-name file)
(set-visited-file-modtime)) (if (stringp visit) (progn
(set-visited-file-modtime) (setq buffer-file-name visit)))) (if (or (eq
visit t) (eq visit nil) (stringp visit)) (message "Wrote %s"
buffer-file-name)))
  epa-file-write-region(nil nil "/cygdrive/c/Temp/test.gpg" nil t)
  apply(epa-file-write-region (nil nil "/cygdrive/c/Temp/test.gpg" nil t))
  (if op (apply op args) (epa-file-run-real-handler operation args))
  (let ((op (get operation (quote epa-file)))) (if op (apply op args)
(epa-file-run-real-handler operation args)))
  (progn (let ((op (get operation (quote epa-file)))) (if op (apply op
args) (epa-file-run-real-handler operation args))))
  (unwind-protect (progn (let ((op (get operation (quote epa-file))))
(if op (apply op args) (epa-file-run-real-handler operation args))))
(set-match-data save-match-data-internal (quote evaporate)))
  (let ((save-match-data-internal (match-data))) (unwind-protect (progn
(let ((op (get operation (quote epa-file)))) (if op (apply op args)
(epa-file-run-real-handler operation args)))) (set-match-data
save-match-data-internal (quote evaporate))))
  epa-file-handler(write-region nil nil "/cygdrive/c/Temp/test.gpg" nil t)
  write-region(nil nil "/cygdrive/c/Temp/test.gpg" nil t
"/cygdrive/c/Temp/test.gpg")
  basic-save-buffer-2()
  basic-save-buffer-1()
  basic-save-buffer()
  save-buffer(1)
  #<subr call-interactively>(save-buffer nil nil)
  funcall(#<subr call-interactively> save-buffer nil nil)
  (with-no-warnings (funcall ad--addoit-function function record-flag keys))
  (setq ad-return-value (with-no-warnings (funcall ad--addoit-function
function record-flag keys)))
  (let ((ido-ubiquitous-next-override
(ido-ubiquitous-get-command-override function))) (setq ad-return-value
(with-no-warnings (funcall ad--addoit-function function record-flag keys))))
  (ido-ubiquitous-with-override (ido-ubiquitous-get-command-override
function) (setq ad-return-value (with-no-warnings (funcall
ad--addoit-function function record-flag keys))))
  (let (ad-return-value) (ido-ubiquitous-with-override
(ido-ubiquitous-get-command-override function) (setq ad-return-value
(with-no-warnings (funcall ad--addoit-function function record-flag
keys)))) ad-return-value)
  ad-Advice-call-interactively(#<subr call-interactively> save-buffer
nil nil)
  apply(ad-Advice-call-interactively #<subr call-interactively>
(save-buffer nil nil))
  call-interactively(save-buffer nil nil)
  command-execute(save-buffer)


-- 
Jason Lewis
http://emacstragic.net



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 834 bytes --]

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

* bug#16679: 24.3.50; can't create a newly encrypted gpg file with easypg in cygwin emacs
  2014-02-10 23:04         ` Jason Lewis
@ 2014-02-11  3:46           ` Eli Zaretskii
  2014-02-11  5:15             ` Jason Lewis
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2014-02-11  3:46 UTC (permalink / raw)
  To: Jason Lewis; +Cc: 16679

> Date: Tue, 11 Feb 2014 10:04:50 +1100
> From: Jason Lewis <jason@dickson.st>
> CC: rgm@gnu.org, 16679@debbugs.gnu.org
> 
> I tested again by trying to creating a file on /cygdrive/c/Temp which is
> not on the junctioned drive and received the same error.

Please step in Edebug through epa-file-write-region, and tell which
part of the condition-case fails with file-error, and why.  I see
nothing telltale in the backtrace which would suggest any ideas.

Thanks.





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

* bug#16679: 24.3.50; can't create a newly encrypted gpg file with easypg in cygwin emacs
  2014-02-11  3:46           ` Eli Zaretskii
@ 2014-02-11  5:15             ` Jason Lewis
  2014-02-11 16:05               ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Jason Lewis @ 2014-02-11  5:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 16679

[-- Attachment #1: Type: text/plain, Size: 10586 bytes --]



Eli Zaretskii wrote, On 11/02/2014 2:46 PM:
> Please step in Edebug through epa-file-write-region, and tell which
> part of the condition-case fails with file-error, and why. I see
> nothing telltale in the backtrace which would suggest any ideas. Thanks. 

I think it fails on:


line: 250
           (epa-select-keys
            context
            "Select recipients for encryption.
If no one is selected, symmetric encryption will be performed.  "
            recipients)


That call seems to take quite a few seconds and then execution jumps to
the error part on line 257.

Digging deeper with edebug, I have found the error happens in the
epa-list-keys call and I can make the error happen just by calling
epa-list-keys directly.

I stepped through a whole lot but I couldn't work out where it happens
exactly. it seems to be while its stepping through the gpg keys to
produce the list.

Backtrace:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  string-match("\"" nil 0)
  (while (string-match "\"" string index) (setq string (replace-match
"\\\"" t t string) index (1+ (match-end 0))))
  (cond ((member (aref (car lines) 0) (quote ("pub" "sec" "crt" "crs")))
(setq cert (member (aref (car lines) 0) (quote ("crt" "crs"))) keys
(cons (epg-make-key (if (aref (car lines) 8) (cdr (assq ...
epg-key-validity-alist)))) keys)) (epg-key-set-sub-key-list (car keys)
(cons (epg--make-sub-key-1 (car lines)) (epg-key-sub-key-list (car
keys))))) ((member (aref (car lines) 0) (quote ("sub" "ssb")))
(epg-key-set-sub-key-list (car keys) (cons (epg--make-sub-key-1 (car
lines)) (epg-key-sub-key-list (car keys))))) ((equal (aref (car lines)
0) "uid") (setq string (copy-sequence (aref (car lines) 9)) index 0)
(while (string-match "\"" string index) (setq string (replace-match
"\\\"" t t string) index (1+ (match-end 0)))) (condition-case nil (setq
string (epg--decode-coding-string (car (read-from-string (concat "\""
string "\""))) (quote utf-8))) (error (setq string (aref (car lines)
9)))) (epg-key-set-user-id-list (car keys) (cons (epg-make-user-id (if
(aref (car lines) 1) (cdr (assq ... epg-key-validity-alist))) (if cert
(condition-case nil (epg-dn-from-string string) (error string)) string))
(epg-key-user-id-list (car keys))))) ((equal (aref (car lines) 0) "fpr")
(epg-sub-key-set-fingerprint (car (epg-key-sub-key-list (car keys)))
(aref (car lines) 9))) ((equal (aref (car lines) 0) "sig")
(epg-user-id-set-signature-list (car (epg-key-user-id-list (car keys)))
(cons (epg-make-key-signature (if (aref (car lines) 1) (cdr (assq ...
epg-key-validity-alist))) (string-to-number (aref (car lines) 3)) (aref
(car lines) 4) (epg--time-from-seconds (aref (car lines) 5))
(epg--time-from-seconds (aref (car lines) 6)) (aref (car lines) 9)
(string-to-number (aref (car lines) 10) 16) (eq (aref (aref ... 10) 2)
120)) (epg-user-id-signature-list (car (epg-key-user-id-list (car
keys))))))))
  (while lines (cond ((member (aref (car lines) 0) (quote ("pub" "sec"
"crt" "crs"))) (setq cert (member (aref (car lines) 0) (quote ("crt"
"crs"))) keys (cons (epg-make-key (if (aref ... 8) (cdr ...))) keys))
(epg-key-set-sub-key-list (car keys) (cons (epg--make-sub-key-1 (car
lines)) (epg-key-sub-key-list (car keys))))) ((member (aref (car lines)
0) (quote ("sub" "ssb"))) (epg-key-set-sub-key-list (car keys) (cons
(epg--make-sub-key-1 (car lines)) (epg-key-sub-key-list (car keys)))))
((equal (aref (car lines) 0) "uid") (setq string (copy-sequence (aref
(car lines) 9)) index 0) (while (string-match "\"" string index) (setq
string (replace-match "\\\"" t t string) index (1+ (match-end 0))))
(condition-case nil (setq string (epg--decode-coding-string (car
(read-from-string ...)) (quote utf-8))) (error (setq string (aref (car
lines) 9)))) (epg-key-set-user-id-list (car keys) (cons
(epg-make-user-id (if (aref ... 1) (cdr ...)) (if cert (condition-case
nil ... ...) string)) (epg-key-user-id-list (car keys))))) ((equal (aref
(car lines) 0) "fpr") (epg-sub-key-set-fingerprint (car
(epg-key-sub-key-list (car keys))) (aref (car lines) 9))) ((equal (aref
(car lines) 0) "sig") (epg-user-id-set-signature-list (car
(epg-key-user-id-list (car keys))) (cons (epg-make-key-signature (if
(aref ... 1) (cdr ...)) (string-to-number (aref ... 3)) (aref (car
lines) 4) (epg--time-from-seconds (aref ... 5)) (epg--time-from-seconds
(aref ... 6)) (aref (car lines) 9) (string-to-number (aref ... 10) 16)
(eq (aref ... 2) 120)) (epg-user-id-signature-list (car
(epg-key-user-id-list ...))))))) (setq lines (cdr lines)))
  (let ((lines (epg--list-keys-1 context name mode)) keys cert pointer
pointer-1 index string) (while lines (cond ((member (aref (car lines) 0)
(quote ("pub" "sec" "crt" "crs"))) (setq cert (member (aref (car lines)
0) (quote ("crt" "crs"))) keys (cons (epg-make-key (if ... ...)) keys))
(epg-key-set-sub-key-list (car keys) (cons (epg--make-sub-key-1 (car
lines)) (epg-key-sub-key-list (car keys))))) ((member (aref (car lines)
0) (quote ("sub" "ssb"))) (epg-key-set-sub-key-list (car keys) (cons
(epg--make-sub-key-1 (car lines)) (epg-key-sub-key-list (car keys)))))
((equal (aref (car lines) 0) "uid") (setq string (copy-sequence (aref
(car lines) 9)) index 0) (while (string-match "\"" string index) (setq
string (replace-match "\\\"" t t string) index (1+ (match-end 0))))
(condition-case nil (setq string (epg--decode-coding-string (car ...)
(quote utf-8))) (error (setq string (aref ... 9))))
(epg-key-set-user-id-list (car keys) (cons (epg-make-user-id (if ...
...) (if cert ... string)) (epg-key-user-id-list (car keys))))) ((equal
(aref (car lines) 0) "fpr") (epg-sub-key-set-fingerprint (car
(epg-key-sub-key-list (car keys))) (aref (car lines) 9))) ((equal (aref
(car lines) 0) "sig") (epg-user-id-set-signature-list (car
(epg-key-user-id-list (car keys))) (cons (epg-make-key-signature (if ...
...) (string-to-number ...) (aref ... 4) (epg--time-from-seconds ...)
(epg--time-from-seconds ...) (aref ... 9) (string-to-number ... 16) (eq
... 120)) (epg-user-id-signature-list (car ...)))))) (setq lines (cdr
lines))) (setq keys (nreverse keys) pointer keys) (while pointer
(epg-key-set-sub-key-list (car pointer) (nreverse (epg-key-sub-key-list
(car pointer)))) (setq pointer-1 (epg-key-set-user-id-list (car pointer)
(nreverse (epg-key-user-id-list (car pointer))))) (while pointer-1
(epg-user-id-set-signature-list (car pointer-1) (nreverse
(epg-user-id-signature-list (car pointer-1)))) (setq pointer-1 (cdr
pointer-1))) (setq pointer (cdr pointer))) keys)
  epg-list-keys((epg-context . [OpenPGP "/usr/bin/gpg" nil nil nil nil
nil nil nil (epg-passphrase-callback-function) nil nil nil nil nil nil
nil nil]) nil nil)
  (epa--insert-keys (epg-list-keys context name secret))
  (let ((inhibit-read-only t) buffer-read-only (point (point-min))
(context (epg-make-context epa-protocol))) (if (get-text-property point
(quote epa-list-keys)) nil (setq point (next-single-property-change
point (quote epa-list-keys)))) (if point (progn (delete-region point (or
(next-single-property-change point (quote epa-list-keys)) (point-max)))
(goto-char point))) (epa--insert-keys (epg-list-keys context name
secret)) (widget-setup) (set-keymap-parent (current-local-map)
widget-keymap))
  epa--list-keys(nil nil)
  epa-list-keys(nil)
  #<subr call-interactively>(epa-list-keys record nil)
  funcall(#<subr call-interactively> epa-list-keys record nil)
  (with-no-warnings (funcall ad--addoit-function function record-flag keys))
  (setq ad-return-value (with-no-warnings (funcall ad--addoit-function
function record-flag keys)))
  (let ((ido-ubiquitous-next-override
(ido-ubiquitous-get-command-override function))) (setq ad-return-value
(with-no-warnings (funcall ad--addoit-function function record-flag keys))))
  (ido-ubiquitous-with-override (ido-ubiquitous-get-command-override
function) (setq ad-return-value (with-no-warnings (funcall
ad--addoit-function function record-flag keys))))
  (let (ad-return-value) (ido-ubiquitous-with-override
(ido-ubiquitous-get-command-override function) (setq ad-return-value
(with-no-warnings (funcall ad--addoit-function function record-flag
keys)))) ad-return-value)
  ad-Advice-call-interactively(#<subr call-interactively> epa-list-keys
record nil)
  apply(ad-Advice-call-interactively #<subr call-interactively>
(epa-list-keys record nil))
  call-interactively(epa-list-keys record nil)
  command-execute(epa-list-keys record)
  execute-extended-command(nil "epa-list-keys")
  smex-read-and-run(("eval-buffer" "epa-list-keys" "sp-next-sexp"
"toggle-debug-on-error" "edebug-trace-mode" "package-list-packages"
"load-file" "replace-string" "ttl" "calc" "html-mode" "grep" "dired"
"whitespace-mode" "emacs-version" "org-mode" "orgtbl-mode"
"set-buffer-file-coding-system" "load-library" "indent-region"
"smartparens-mode" "auto-fill-mode" "customize-group"
"customize-variable" "hl-line-mode" "eww" "version" "kill-rectangle"
"sp-cheat-sheet" "auto-revert-tail-mode" "csv-mode" "hexl-mode"
"auto-complete" "eval-expression" "org-beamer-mode" "weechat-connect"
"visual-line-mode" "org-submit-bug-report"
"org-table-create-or-convert-from-region" "mail" "rgrep" "shell"
"sql-mode" "esk-lorem" "zap-to-char" "count-matches" "shell-command"
"moz-minor-mode" "org-indent-item" "org-table-export" ...))
  smex()
  #<subr call-interactively>(smex nil nil)
  funcall(#<subr call-interactively> smex nil nil)
  (with-no-warnings (funcall ad--addoit-function function record-flag keys))
  (setq ad-return-value (with-no-warnings (funcall ad--addoit-function
function record-flag keys)))
  (let ((ido-ubiquitous-next-override
(ido-ubiquitous-get-command-override function))) (setq ad-return-value
(with-no-warnings (funcall ad--addoit-function function record-flag keys))))
  (ido-ubiquitous-with-override (ido-ubiquitous-get-command-override
function) (setq ad-return-value (with-no-warnings (funcall
ad--addoit-function function record-flag keys))))
  (let (ad-return-value) (ido-ubiquitous-with-override
(ido-ubiquitous-get-command-override function) (setq ad-return-value
(with-no-warnings (funcall ad--addoit-function function record-flag
keys)))) ad-return-value)
  ad-Advice-call-interactively(#<subr call-interactively> smex nil nil)
  apply(ad-Advice-call-interactively #<subr call-interactively> (smex
nil nil))
  call-interactively(smex nil nil)
  command-execute(smex)






-- 
Jason Lewis
http://emacstragic.net



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 834 bytes --]

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

* bug#16679: 24.3.50; can't create a newly encrypted gpg file with easypg in cygwin emacs
  2014-02-11  5:15             ` Jason Lewis
@ 2014-02-11 16:05               ` Eli Zaretskii
  2014-02-12  2:38                 ` Jason Lewis
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2014-02-11 16:05 UTC (permalink / raw)
  To: Jason Lewis; +Cc: 16679

> Date: Tue, 11 Feb 2014 16:15:08 +1100
> From: Jason Lewis <jason@dickson.st>
> CC: rgm@gnu.org, 16679@debbugs.gnu.org
> 
> > Please step in Edebug through epa-file-write-region, and tell which
> > part of the condition-case fails with file-error, and why. I see
> > nothing telltale in the backtrace which would suggest any ideas. Thanks. 
> 
> I think it fails on:
> 
> 
> line: 250
>            (epa-select-keys
>             context
>             "Select recipients for encryption.
> If no one is selected, symmetric encryption will be performed.  "
>             recipients)
> 
> 
> That call seems to take quite a few seconds and then execution jumps to
> the error part on line 257.
> 
> Digging deeper with edebug, I have found the error happens in the
> epa-list-keys call and I can make the error happen just by calling
> epa-list-keys directly.
> 
> I stepped through a whole lot but I couldn't work out where it happens
> exactly. it seems to be while its stepping through the gpg keys to
> produce the list.
> 
> Backtrace:
> 
> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>   string-match("\"" nil 0)
>   (while (string-match "\"" string index) (setq string (replace-match
> "\\\"" t t string) index (1+ (match-end 0))))
>   (cond ((member (aref (car lines) 0) (quote ("pub" "sec" "crt" "crs")))
> (setq cert (member (aref (car lines) 0) (quote ("crt" "crs"))) keys

Thanks.  Please show the values of 'string' and '(car lines)' right
before the while loop indicated below (which is part of epg-list-keys):

       ((equal (aref (car lines) 0) "uid")
	;; Decode the UID name as a backslash escaped UTF-8 string,
	;; generated by GnuPG/GpgSM.
	(setq string (copy-sequence (aref (car lines) 9))
	      index 0)
	(while (string-match "\"" string index) <<<<<<<<<<<<<<<<<<
	  (setq string (replace-match "\\\"" t t string)
		index (1+ (match-end 0))))





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

* bug#16679: 24.3.50; can't create a newly encrypted gpg file with easypg in cygwin emacs
  2014-02-11 16:05               ` Eli Zaretskii
@ 2014-02-12  2:38                 ` Jason Lewis
  2019-08-30 10:59                   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 13+ messages in thread
From: Jason Lewis @ 2014-02-12  2:38 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 16679

[-- Attachment #1: Type: text/plain, Size: 1091 bytes --]

Hi Eli,



Eli Zaretskii wrote, On 12/02/2014 3:05 AM:
> Thanks. Please show the values of 'string' and '(car lines)' right
> before the while loop indicated below (which is part of
> epg-list-keys): ((equal (aref (car lines) 0) "uid") ;; Decode the UID
> name as a backslash escaped UTF-8 string, ;; generated by GnuPG/GpgSM.
> (setq string (copy-sequence (aref (car lines) 9)) index 0) (while
> (string-match "\"" string index) <<<<<<<<<<<<<<<<<< (setq string
> (replace-match "\\\"" t t string) index (1+ (match-end 0)))) 

I put a (message "(car lines): %S" (car lines)) right before string is
assigned in epg-list-keys, resulting in lots of messages culminating in:

<lots of lines snipped>
(car lines): ["uid" "-" nil nil nil "1330660041" nil
"02F15375A7024F55715364D1E540EADAA09785E5" nil "ssh\\x3a//gnuradical.su"
nil nil nil nil nil]
(car lines): ["uid" "-" nil nil nil "1369245874" nil
"9C1185A5C5E9FC54612808977EE8F548B2258D31" nil nil nil nil nil nil nil]
while: Wrong type argument: stringp, nil


Jason

-- 
Jason Lewis
http://emacstragic.net



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 834 bytes --]

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

* bug#16679: 24.3.50; can't create a newly encrypted gpg file with easypg in cygwin emacs
  2014-02-12  2:38                 ` Jason Lewis
@ 2019-08-30 10:59                   ` Lars Ingebrigtsen
  2019-08-30 11:44                     ` Jason Lewis
  0 siblings, 1 reply; 13+ messages in thread
From: Lars Ingebrigtsen @ 2019-08-30 10:59 UTC (permalink / raw)
  To: Jason Lewis; +Cc: 16679

Jason Lewis <jason@dickson.st> writes:

> I put a (message "(car lines): %S" (car lines)) right before string is
> assigned in epg-list-keys, resulting in lots of messages culminating in:
>
> <lots of lines snipped>
> (car lines): ["uid" "-" nil nil nil "1330660041" nil
> "02F15375A7024F55715364D1E540EADAA09785E5" nil "ssh\\x3a//gnuradical.su"
> nil nil nil nil nil]
> (car lines): ["uid" "-" nil nil nil "1369245874" nil
> "9C1185A5C5E9FC54612808977EE8F548B2258D31" nil nil nil nil nil nil nil]
> while: Wrong type argument: stringp, nil

Are you still seeing this problem in more modern versions of Emacs?

Looking at the code, it looks like it should be pretty easy to fix -- it
looks like this key doesn't have a UID name, which is unusual, but could
be guarded against if it's still a problem with something like the
below:

diff --git a/lisp/epg.el b/lisp/epg.el
index 6d377d07e2..850bbac0db 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -1326,7 +1326,8 @@ epg-list-keys
        ((member (aref (car lines) 0) '("sub" "ssb"))
         (push (epg--make-sub-key-1 (car lines))
               (epg-key-sub-key-list (car keys))))
-       ((equal (aref (car lines) 0) "uid")
+       ((and (equal (aref (car lines) 0) "uid")
+             (aref (car lines) 9))
 	;; Decode the UID name as a backslash escaped UTF-8 string,
 	;; generated by GnuPG/GpgSM.
 	(setq string (copy-sequence (aref (car lines) 9))


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#16679: 24.3.50; can't create a newly encrypted gpg file with easypg in cygwin emacs
  2019-08-30 10:59                   ` Lars Ingebrigtsen
@ 2019-08-30 11:44                     ` Jason Lewis
  2019-09-04 13:00                       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 13+ messages in thread
From: Jason Lewis @ 2019-08-30 11:44 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 16679

I’m sorry I don’t use emacs under Cygwin anymore so I can’t test it

Jason

> On 30 Aug 2019, at 8:59 pm, Lars Ingebrigtsen <larsi@gnus.org> wrote:
> 
> Jason Lewis <jason@dickson.st> writes:
> 
>> I put a (message "(car lines): %S" (car lines)) right before string is
>> assigned in epg-list-keys, resulting in lots of messages culminating in:
>> 
>> <lots of lines snipped>
>> (car lines): ["uid" "-" nil nil nil "1330660041" nil
>> "02F15375A7024F55715364D1E540EADAA09785E5" nil "ssh\\x3a//gnuradical.su"
>> nil nil nil nil nil]
>> (car lines): ["uid" "-" nil nil nil "1369245874" nil
>> "9C1185A5C5E9FC54612808977EE8F548B2258D31" nil nil nil nil nil nil nil]
>> while: Wrong type argument: stringp, nil
> 
> Are you still seeing this problem in more modern versions of Emacs?
> 
> Looking at the code, it looks like it should be pretty easy to fix -- it
> looks like this key doesn't have a UID name, which is unusual, but could
> be guarded against if it's still a problem with something like the
> below:
> 
> diff --git a/lisp/epg.el b/lisp/epg.el
> index 6d377d07e2..850bbac0db 100644
> --- a/lisp/epg.el
> +++ b/lisp/epg.el
> @@ -1326,7 +1326,8 @@ epg-list-keys
>        ((member (aref (car lines) 0) '("sub" "ssb"))
>         (push (epg--make-sub-key-1 (car lines))
>               (epg-key-sub-key-list (car keys))))
> -       ((equal (aref (car lines) 0) "uid")
> +       ((and (equal (aref (car lines) 0) "uid")
> +             (aref (car lines) 9))
>    ;; Decode the UID name as a backslash escaped UTF-8 string,
>    ;; generated by GnuPG/GpgSM.
>    (setq string (copy-sequence (aref (car lines) 9))
> 
> 
> -- 
> (domestic pets only, the antidote for overdose, milk.)
>   bloggy blog: http://lars.ingebrigtsen.no
> 






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

* bug#16679: 24.3.50; can't create a newly encrypted gpg file with easypg in cygwin emacs
  2019-08-30 11:44                     ` Jason Lewis
@ 2019-09-04 13:00                       ` Lars Ingebrigtsen
  0 siblings, 0 replies; 13+ messages in thread
From: Lars Ingebrigtsen @ 2019-09-04 13:00 UTC (permalink / raw)
  To: Jason Lewis; +Cc: 16679

Jason Lewis <jason@dickson.st> writes:

> I’m sorry I don’t use emacs under Cygwin anymore so I can’t test it

OK; I guess we won't be able to proceed further with this bug report, so
I'm closing it.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2019-09-04 13:00 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-07  4:45 bug#16679: 24.3.50; can't create a newly encrypted gpg file with easypg in cygwin emacs Jason Lewis
2014-02-08  1:42 ` Glenn Morris
2014-02-08  8:54   ` Eli Zaretskii
2014-02-08 10:05     ` Jason Lewis
2014-02-08 14:18       ` Eli Zaretskii
2014-02-10 23:04         ` Jason Lewis
2014-02-11  3:46           ` Eli Zaretskii
2014-02-11  5:15             ` Jason Lewis
2014-02-11 16:05               ` Eli Zaretskii
2014-02-12  2:38                 ` Jason Lewis
2019-08-30 10:59                   ` Lars Ingebrigtsen
2019-08-30 11:44                     ` Jason Lewis
2019-09-04 13:00                       ` Lars Ingebrigtsen

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).