unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: don@donarmstrong.com (Emacs bug Tracking System)
To: Chong Yidong <cyd@stupidchicken.com>
Subject: bug#472: marked as done (pgg-gpg.el - pgg-gpg-process-region  timing problem)
Date: Sat, 2 Aug 2008 12:15:08 -0700	[thread overview]
Message-ID: <handler.472.D465.121770410330054.ackdone@emacsbugs.donarmstrong.com> (raw)
In-Reply-To: 2cd46e7f0806231044w6410b825s9611ba713e9ac353@mail.gmail.com

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


Your message dated Sat, 02 Aug 2008 15:08:30 -0400
with message-id <873aln2q1d.fsf@stupidchicken.com>
and subject line Re: pgg-gpg.el - pgg-gpg-process-region timing problem
has caused the Emacs bug report #465,
regarding pgg-gpg.el - pgg-gpg-process-region timing problem
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact don@donarmstrong.com
immediately.)


-- 
465: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=465
Emacs Bug Tracking System
Contact don@donarmstrong.com with problems

[-- Attachment #2: Type: message/rfc822, Size: 8828 bytes --]

From: "ken manheimer" <ken.manheimer@gmail.com>
To: "Thien-Thi Nguyen" <ttn@gnuvola.org>
Cc: wilde@sha-bang.de, emacs-pretest-bug@gnu.org, ueno@unixuser.org, emacs-devel <emacs-devel@gnu.org>
Subject: Re: pgg-gpg.el - pgg-gpg-process-region timing problem
Date: Mon, 23 Jun 2008 13:44:52 -0400
Message-ID: <2cd46e7f0806231044w6410b825s9611ba713e9ac353@mail.gmail.com>

hi, thi.  thanks for the responses - i'm glad to see investigation into this.

i've tried both the patches, and both hang for me on the pggprob.el
test.  the hang is interruptable with Ctl-G keyboard quit.  i tried
stepping through the second patched version with edebug (including
disabling the '(inhibit-redisplay t)' let-binding, which thwarts
edebug stepping), and found the hang happens at the first
'(accept-process-output process)'.  (it hangs at the second one if i
don't provide a passphrase.)

i'm not sure what's happening.  in case it helps, gpg 1.4.6 is what's
running on my system.
-- 
ken
http://myriadicity.net



On Mon, Jun 23, 2008 at 9:17 AM, Thien-Thi Nguyen <ttn@gnuvola.org> wrote:
> Delving into this, i got a little carried away... full func below.
> This adds GOOD_PASSPHRASE checking (necessary for GNUPG 1.4.6, at
> least) and some other coding-system related finessing, but removes
> the sentinel proposed in the first attempt.  In its place, we zonk
> the baleful `process-adaptive-read-buffering' and remove timeout
> parameters from `accept-process-output' calls.
>
> With this func things seem to work fine for `pgg-sign' on a small
> buffer, and mostly for large buffers (270KB), but sometimes (~10%)
> with large buffers, i see a "file error: bad address *GnuPG*".  Hmmm...
>
> thi
>
> ______________________________________________________________________
> (defun pgg-gpg-process-region (start end passphrase program args)
>  (let* ((use-agent (and (null passphrase) (pgg-gpg-use-agent-p)))
>         (output-file-name (pgg-make-temp-file "pgg-output"))
>         (args
>          `("--status-fd" "2"
>            ,@(if use-agent '("--use-agent")
>                (if passphrase '("--passphrase-fd" "0")))
>            "--yes" ; overwrite
>            "--output" ,output-file-name
>            ,@pgg-gpg-extra-args ,@args))
>         (output-buffer pgg-output-buffer)
>         (errors-buffer pgg-errors-buffer)
>         (orig-mode (default-file-modes))
>         (inhibit-redisplay t))
>    (with-current-buffer (get-buffer-create errors-buffer)
>      (buffer-disable-undo)
>      (erase-buffer))
>    (unwind-protect
>        (let* ((coding-system-for-write 'binary)
>               ;; GNUPG 1.4.6 does not terminate on bad passphrase, eg:
>               ;;   [GNUPG:] BAD_PASSPHRASE (long hex # here)
>               ;;   gpg: skipped "ttn": bad passphrase
>               ;;   gpg: [stdin]: clearsign failed: bad passphrase
>               ;; so we need to check that condition ourselves and bail out.
>               ;;
>               ;; To check if the passphrase is accepted, we need to parse the
>               ;; errors-buffer, but `process-adaptive-read-buffering' non-nil
>               ;; sometimes prevents it from filling.  So turn it off.
>               (process-adaptive-read-buffering (not passphrase))
>               (process (progn
>                          (set-default-file-modes 448)
>                          (apply #'start-process "*GnuPG*"
>                                 errors-buffer program args)))
>               (status (process-status process))
>
>               exit-status)
>          (set-process-sentinel process nil)
>          (when passphrase
>            (let ((coding-system-for-write (or pgg-passphrase-coding-system
>                                               'binary)))
>              (process-send-string process passphrase))
>            (process-send-string process "\n")
>            ;; Bail out if passphrase is not accepted.
>            ;; MAINTAIN ME: Tested against GNUPG 1.4.6.
>            (let (result)
>              (while (not result)
>                (accept-process-output process)
>                (with-current-buffer errors-buffer
>                  (save-excursion
>                    (goto-char (point-min))
>                    (when (re-search-forward
>                           ;; BGM: BAD, GOOD, MISSING.
>                           "^.GNUPG:. \\([BGM][A-Z]+\\)_PASSPHRASE"
>                           nil t)
>                      (setq result (match-string 1))))))
>              (unless (string= "GOOD" result)
>                (error "Passphrase no good"))))
>          (process-send-region process start end)
>          (process-send-eof process)
>          ;; TODO: Re-enable `process-adaptive-read-buffering' here.
>          (while (eq 'run (setq status (process-status process)))
>            (accept-process-output process))
>          (delete-process process)
>          (setq exit-status (process-exit-status process))
>          (with-current-buffer (get-buffer-create output-buffer)
>            (buffer-disable-undo)
>            (erase-buffer)
>            (if (file-exists-p output-file-name)
>                (let ((coding-system-for-read (if pgg-text-mode
>                                                  'raw-text
>                                                'binary)))
>                  (insert-file-contents output-file-name)))
>            (set-buffer errors-buffer)
>            (if (memq status '(stop signal))
>                (error "%s exited abnormally: '%s'" program exit-status))
>            (if (= 127 exit-status)
>                (error "%s could not be found" program))))
>      (if (file-exists-p output-file-name)
>          (delete-file output-file-name))
>      (when (get-process "*GnuPG*")
>        (kill-process "*GnuPG*"))
>      (set-default-file-modes orig-mode))))



[-- Attachment #3: Type: message/rfc822, Size: 1087 bytes --]

From: Chong Yidong <cyd@stupidchicken.com>
To: 465-done@emacsbugs.donarmstrong.com
Subject: Re: pgg-gpg.el - pgg-gpg-process-region timing problem
Date: Sat, 02 Aug 2008 15:08:30 -0400
Message-ID: <873aln2q1d.fsf@stupidchicken.com>

I've checked in a fix for this (verified by Ken Manheimer via private
email).  This fix is in pgg-gpg.el, which I think was calling
accept-process-output in a slightly incorrect way.


  parent reply	other threads:[~2008-08-02 19:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <873aln2q1d.fsf@stupidchicken.com>
     [not found] ` <2cd46e7f0806221037h6d16839bp567eb5b901313375@mail.gmail.com>
2008-06-23  8:17   ` bug#470: pgg-gpg.el - pgg-gpg-process-region timing problem Thien-Thi Nguyen
     [not found]   ` <87zlpc8t00.fsf@ambire.localdomain>
2008-06-23  8:43     ` bug#469: " Thien-Thi Nguyen
     [not found]     ` <87r6ao8rty.fsf@ambire.localdomain>
2008-06-23 13:17       ` bug#471: " Thien-Thi Nguyen
     [not found]       ` <873an4b898.fsf@ambire.localdomain>
2008-06-23 17:44         ` bug#472: " ken manheimer
     [not found]         ` <2cd46e7f0806231044w6410b825s9611ba713e9ac353@mail.gmail.com>
2008-06-24 10:42           ` bug#474: " Thien-Thi Nguyen
2008-08-02 19:15           ` Emacs bug Tracking System [this message]
     [not found]           ` <87mylb2jxt.fsf@ambire.localdomain>
2008-06-24 12:30             ` bug#476: " Stefan Monnier
2008-08-02 19:15             ` bug#474: marked as done (pgg-gpg.el - pgg-gpg-process-region timing problem) Emacs bug Tracking System
2008-08-02 19:15         ` bug#471: " Emacs bug Tracking System
2008-08-02 19:15       ` bug#469: " Emacs bug Tracking System
2008-08-02 19:15     ` bug#470: " Emacs bug Tracking System
2008-06-26 16:16   ` bug#486: pgg-gpg.el - pgg-gpg-process-region timing problem ken manheimer
2008-08-02 19:15   ` bug#465: marked as done (pgg-gpg.el - pgg-gpg-process-region timing problem) Emacs bug Tracking System
     [not found]   ` <2cd46e7f0806260916y39870423ge4bda26f97d6d504@mail.gmail.com>
2008-06-26 16:32     ` bug#487: pgg-gpg.el - pgg-gpg-process-region timing problem Chong Yidong
2008-08-02 19:15     ` bug#486: marked as done (pgg-gpg.el - pgg-gpg-process-region timing problem) Emacs bug Tracking System
     [not found] ` <jwviqvznhja.fsf-monnier+emacs@gnu.org>
2008-08-02 19:15   ` bug#476: " Emacs bug Tracking System
     [not found] ` <87fxr040oq.fsf@stupidchicken.com>
2008-08-02 19:15   ` bug#487: " Emacs bug Tracking System

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=handler.472.D465.121770410330054.ackdone@emacsbugs.donarmstrong.com \
    --to=don@donarmstrong.com \
    --cc=cyd@stupidchicken.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).