From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 08 19:36:06 2011 Received: (at submit) by debbugs.gnu.org; 8 Jun 2011 23:36:06 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QUSI9-0004wD-Cy for submit@debbugs.gnu.org; Wed, 08 Jun 2011 19:36:05 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QUSI7-0004vk-0A for submit@debbugs.gnu.org; Wed, 08 Jun 2011 19:36:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QUSI0-00006S-J5 for submit@debbugs.gnu.org; Wed, 08 Jun 2011 19:35:57 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:56123) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUSI0-00006O-Al for submit@debbugs.gnu.org; Wed, 08 Jun 2011 19:35:56 -0400 Received: from eggs.gnu.org ([140.186.70.92]:59012) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUSHy-0002Fw-Mf for bug-gnu-emacs@gnu.org; Wed, 08 Jun 2011 19:35:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QUSHt-00005g-9j for bug-gnu-emacs@gnu.org; Wed, 08 Jun 2011 19:35:54 -0400 Received: from g1t0028.austin.hp.com ([15.216.28.35]:12453) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUSHs-00005M-KV for bug-gnu-emacs@gnu.org; Wed, 08 Jun 2011 19:35:48 -0400 Received: from g1t0038.austin.hp.com (g1t0038.austin.hp.com [16.236.32.44]) by g1t0028.austin.hp.com (Postfix) with ESMTP id 96DD71C700; Wed, 8 Jun 2011 23:35:46 +0000 (UTC) Received: from alphaville.americas.hpqcorp.net (alphaville.americas.hpqcorp.net [16.117.225.242]) by g1t0038.austin.hp.com (Postfix) with ESMTP id 1EE0C3047A; Wed, 8 Jun 2011 23:35:45 +0000 (UTC) Received: by alphaville.americas.hpqcorp.net (Postfix, from userid 1000) id 5E71EE114B; Wed, 8 Jun 2011 19:35:45 -0400 (EDT) Received: from alphaville.americas.hpqcorp.net (localhost [127.0.0.1]) by alphaville.americas.hpqcorp.net (Postfix) with ESMTP id 4A722E0B82; Wed, 8 Jun 2011 19:35:45 -0400 (EDT) From: Nick Dokos To: bug-gnu-emacs@gnu.org Subject: Problem in url-cache X-Mailer: MH-E 8.2; nmh 1.3; GNU Emacs 24.0.50 Date: Wed, 08 Jun 2011 19:35:45 -0400 Message-ID: <24461.1307576145@alphaville.americas.hpqcorp.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -6.6 (------) X-Debbugs-Envelope-To: submit Cc: Julien Danjou , nicholas.dokos@hp.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: nicholas.dokos@hp.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.6 (------) I was chasing down some problems I was having with Julien Danjou's google-weather. The blow-by-blow description can be found in the following threads on the emacs and orgmode mailing lists: http://thread.gmane.org/gmane.emacs.help/81302 http://thread.gmane.org/gmane.emacs.orgmode/42565 This bug report (and possible patch) concern one aspect of this: google-weather uses the url package to retrieve icons in GIF format (but the problem may arise from any kind of binary data) from the server and caches them locally for 12 hours by default. It does that by calling url-store-in-cache: (defun url-store-in-cache (&optional buff) "Store buffer BUFF in the cache." (with-current-buffer (get-buffer (or buff (current-buffer))) (let ((fname (url-cache-create-filename (url-view-url t)))) (if (url-cache-prepare fname) (let ((coding-system-for-write 'binary)) (write-region (point-min) (point-max) fname nil 5)))))) While the cache is valid, it then fetches the cached data by calling url-cache-extract: (defun url-cache-extract (fnam) "Extract FNAM from the local disk cache." (erase-buffer) (insert-file-contents-literally fnam)) But it seems that in a multibyte context, what url-store-in-cache stores and what url-cache-extract retrieves are not identical: the former stores a sequence of bytes as they come from the network and the latter may combine individual bytes into multibyte entities. My workaround for this problem is --8<---------------cut here---------------start------------->8--- diff --git a/lisp/url/url-cache.el b/lisp/url/url-cache.el index 1615920..80d7702 100644 --- a/lisp/url/url-cache.el +++ b/lisp/url/url-cache.el @@ -192,6 +192,7 @@ Very fast if you have an `md5' primitive function, suitably fast otherwise." (defun url-cache-extract (fnam) "Extract FNAM from the local disk cache." (erase-buffer) + (set-buffer-multibyte nil) (insert-file-contents-literally fnam)) (defun url-cache-expired (url &optional expire-time) --8<---------------cut here---------------end--------------->8--- It seems to work satisfactorily for google-weather. I don't know whether it causes problems in other ways. Thanks, Nick From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 09 03:37:45 2011 Received: (at 8827) by debbugs.gnu.org; 9 Jun 2011 07:37:45 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QUZoG-0006pX-Ty for submit@debbugs.gnu.org; Thu, 09 Jun 2011 03:37:45 -0400 Received: from mtaout21.012.net.il ([80.179.55.169]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QUZoE-0006pK-FV for 8827@debbugs.gnu.org; Thu, 09 Jun 2011 03:37:44 -0400 Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0LMI00400IH34X00@a-mtaout21.012.net.il> for 8827@debbugs.gnu.org; Thu, 09 Jun 2011 10:37:35 +0300 (IDT) Received: from HOME-C4E4A596F7 ([84.229.223.140]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LMI004QWIIL4Q00@a-mtaout21.012.net.il>; Thu, 09 Jun 2011 10:37:35 +0300 (IDT) Date: Thu, 09 Jun 2011 10:37:37 +0300 From: Eli Zaretskii Subject: Re: bug#8827: Problem in url-cache In-reply-to: <24461.1307576145@alphaville.americas.hpqcorp.net> X-012-Sender: halo1@inter.net.il To: nicholas.dokos@hp.com Message-id: <83sjrjbgla.fsf@gnu.org> References: <24461.1307576145@alphaville.americas.hpqcorp.net> X-Spam-Score: -2.0 (--) X-Debbugs-Envelope-To: 8827 Cc: julien@danjou.info, nicholas.dokos@hp.com, 8827@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.0 (--) > From: Nick Dokos > Date: Wed, 08 Jun 2011 19:35:45 -0400 > Cc: Julien Danjou , nicholas.dokos@hp.com > > (defun url-cache-extract (fnam) > "Extract FNAM from the local disk cache." > (erase-buffer) > (insert-file-contents-literally fnam)) > > But it seems that in a multibyte context, what url-store-in-cache > stores and what url-cache-extract retrieves are not identical: > the former stores a sequence of bytes as they come from the network > and the latter may combine individual bytes into multibyte entities. > > My workaround for this problem is > > --8<---------------cut here---------------start------------->8--- > diff --git a/lisp/url/url-cache.el b/lisp/url/url-cache.el > index 1615920..80d7702 100644 > --- a/lisp/url/url-cache.el > +++ b/lisp/url/url-cache.el > @@ -192,6 +192,7 @@ Very fast if you have an `md5' primitive function, suitably fast otherwise." > (defun url-cache-extract (fnam) > "Extract FNAM from the local disk cache." > (erase-buffer) > + (set-buffer-multibyte nil) > (insert-file-contents-literally fnam)) That's not a workaround, that's exactly the fix for this bug. Inserting binary data into a multibyte buffer does not leave the binary data unaltered. The buffer must be unibyte. From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 06 03:49:29 2011 Received: (at 8827) by debbugs.gnu.org; 6 Jul 2011 07:49:30 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QeMrR-0004rY-67 for submit@debbugs.gnu.org; Wed, 06 Jul 2011 03:49:29 -0400 Received: from prometheus.naquadah.org ([212.85.154.174] helo=mx1.naquadah.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QeMrP-0004rH-Cq; Wed, 06 Jul 2011 03:49:28 -0400 Received: from cigue.easter-eggs.fr (unknown [IPv6:2a01:e35:2eb3:b690:2::3a]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mx1.naquadah.org (Postfix) with ESMTPSA id 863245C0CF; Wed, 6 Jul 2011 09:49:20 +0200 (CEST) From: Julien Danjou To: nicholas.dokos@hp.com Subject: Re: Problem in url-cache References: <24461.1307576145@alphaville.americas.hpqcorp.net> Date: Wed, 06 Jul 2011 09:49:15 +0200 In-Reply-To: <24461.1307576145@alphaville.americas.hpqcorp.net> (Nick Dokos's message of "Wed, 08 Jun 2011 19:35:45 -0400") Message-ID: User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Spam-Score: -3.2 (---) X-Debbugs-Envelope-To: 8827 Cc: control@debbugs.gnu.org, 8827@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.1 (---) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable close 8827 thanks I've pushed your fix into the trunk. =2D-=20 Julien Danjou =E2=9D=B1 http://julien.danjou.info --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAEBAgAGBQJOFBN8AAoJEGEbqVCLeKXCeXUQAIS0xfHhf5ZHtWAqXVAyzbHe 3HUxtJbKAMxjwFuIPTb8nnXoEJTlVuoq4AOVpwkyDgyGsL82Oc7WBR/VQHtxyBfk IZk36XDwfVn2nuQniXsgeYd1byFD9vZjghRSo0A/9MFiE6/idZh4aWDvt+onbFwp n76hgIKzfH0Ri7JZDgZALzIxS7KPCZdN/Moqhy+5ir2vxMu05Lgk4xVvUfkyuS4F ZFgLXIOzmHhPtFv8gv46yVsmPmEAkCB9VkRay/Cu3d7QZnRjIEqspWZ96v9skyug RdJnCVBZ1xdfRWEXZJh/Tk40b+Ud/FllxwtBTjRMPcN64dMsWe7fv9R7dXPQ02xh oIa+bxNw4DHmfM7p8hhYjGIQmTmNG6bPsXF+fialf9+6oLtci4Ot3rhIK+34bs3r /4bn3o4j343Zj+zY4z/R2aRYlA2vjZv0c8cTOsD2wtf8IUSzFpeTeE4KsNpt4W/T 4wVkTbF2WGGFuKEBKFdok6ldAAFNASeKX0WN9A5n1IH+sWZHOjOFHLVoV3Trv9Lu 9bi9GCoTz0L2zR8RiPy4y8eGe9B6CPWvaP5pdWFGYuV2oe0daxipkhpD/rRufC3T ToCA1LZrZWbR+4HdU8FLt2VEELVux/j0Fol+vm09zNz0huKmkN/6CqZqr7pnlFNw p8kVznu0qI05LQadPVm3 =G6Ny -----END PGP SIGNATURE----- --=-=-=-- From unknown Mon Jun 23 18:29:34 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 03 Aug 2011 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator