From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#18116: 24.3.92; url-http calls CALLBACK recursively with malformed CBARGS if the former calls `delete-process' Date: Thu, 11 Sep 2014 05:52:33 +0400 Message-ID: <54110061.1060908@yandex.ru> References: <86ppgr4hqe.fsf@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1410400407 23841 80.91.229.3 (11 Sep 2014 01:53:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 11 Sep 2014 01:53:27 +0000 (UTC) Cc: 18116@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Sep 11 03:53:20 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XRtZW-0008PQ-B4 for geb-bug-gnu-emacs@m.gmane.org; Thu, 11 Sep 2014 03:53:18 +0200 Original-Received: from localhost ([::1]:59599 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRtZV-0002hd-Qu for geb-bug-gnu-emacs@m.gmane.org; Wed, 10 Sep 2014 21:53:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52240) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRtZM-0002gZ-IJ for bug-gnu-emacs@gnu.org; Wed, 10 Sep 2014 21:53:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XRtZG-00029H-EK for bug-gnu-emacs@gnu.org; Wed, 10 Sep 2014 21:53:08 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:45597) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRtZG-00029D-AW for bug-gnu-emacs@gnu.org; Wed, 10 Sep 2014 21:53:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XRtZF-00011M-Se for bug-gnu-emacs@gnu.org; Wed, 10 Sep 2014 21:53:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 11 Sep 2014 01:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18116 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18116-submit@debbugs.gnu.org id=B18116.14104003623883 (code B ref 18116); Thu, 11 Sep 2014 01:53:01 +0000 Original-Received: (at 18116) by debbugs.gnu.org; 11 Sep 2014 01:52:42 +0000 Original-Received: from localhost ([127.0.0.1]:37161 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XRtYv-00010W-45 for submit@debbugs.gnu.org; Wed, 10 Sep 2014 21:52:41 -0400 Original-Received: from mail-la0-f54.google.com ([209.85.215.54]:38230) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XRtYs-00010N-Iq for 18116@debbugs.gnu.org; Wed, 10 Sep 2014 21:52:39 -0400 Original-Received: by mail-la0-f54.google.com with SMTP id ge10so1397565lab.41 for <18116@debbugs.gnu.org>; Wed, 10 Sep 2014 18:52:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=rMBxAXK8AKYaLyvr+xBz8QayG6suhxQFVzBxSWmKjyQ=; b=BGI1iWPQTp5A9oFddqPOV6Fk6N6LghayBuuucw69NdY0AFt5OU5jR81PCxf7AcT89s l6wSwLyNeVmVVX12yDZDMA2iYnW7BzCiHSwntd5Aye4bU+lE+0h/oSf58HvyRtzyVyYJ QopG3d0Oh5Sfj49nn0PD5re0Ijhp632BdX4TYhIogIjHSwAdsXL0K7ymp5KvooTxFAy5 oU1z6Q20bLODIUcZgpxpUNQrhklHygSOkpCmIK0cy18bkjJqmiqSJM/6ya0hoctGftQA 1w187SM48n1q2w4044KbgbQWjMGlgQpTm7wauaapSM0KwiR4XTzo95j1PTpAdm3w/9WT KLuA== X-Received: by 10.112.158.170 with SMTP id wv10mr2282555lbb.66.1410400356926; Wed, 10 Sep 2014 18:52:36 -0700 (PDT) Original-Received: from [192.168.1.3] ([178.252.98.87]) by mx.google.com with ESMTPSA id xc7sm6200765lbb.21.2014.09.10.18.52.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Sep 2014 18:52:35 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:93255 Archived-At: On 09/10/2014 06:24 AM, Stefan Monnier wrote: > The problem is that calling `delete-process' may run the sentinel (and > since this is code run from the sentinel, it may end up calling the > sentinel recursively). I can observe a definite change in behavior, which I cannot reason about (when connection fails, the external process dies in Emacs 24.3, but still lives for some time in 24.4). Someone else should judge whether this is a bug or an intended change. > So if you don't want the sentinel to be called recursively, you'll want > to (set-process-sentinel url-http-process nil) before calling > delete-process Yes, that's more or less what we did in Tern: https://github.com/marijnh/tern/commit/21245d5b901e6dc9cfb7c8ea55220a11104a5efc >> If the callback expects STATUS to contain some specific data structure, >> that can cause breakage, see https://github.com/marijnh/tern/issues/350 >> for an example. > > The format looks normal: the STATUS is expected to be a plist holding > the "history" of the connection. It can contain various ":error FOO" > and ":redirect BAR" entries. Indeed. Looks like my misunderstanding stemmed from Tern not handling this value exactly right: it expected STATUS to have a certain length in case of an error, and when called recursively, the callback received STATUS of different length, prepended with new history. I guess there's no bug there, then. Sorry. > I think the problem comes from a doc error, where url-http points to > url-retrieve for the doc of CBARGS, whereas it uses the format of > url-retrieve-internal instead. Guess so. And both `url-http' and `url-retrieve-internal' are pretty confusing when it comes to describing the arguments that will be passed to CALLBACK. To me, "When retrieval is completed, execute the function CALLBACK, using the arguments listed in CBARGS." means that it will be called exactly with the value of CBARGS passed to `url-http', whereas instead the list gets prepended with stuff before it's passed to CALLBACK.