From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/68953 Path: news.gmane.org!not-for-mail From: Dmitri Paduchikh Newsgroups: gmane.emacs.gnus.general Subject: Re: application/octet-stream sent as 7bit Date: Thu, 03 Sep 2009 21:59:08 +0600 Message-ID: <87ws4gnho3.fsf@paduch.telenet.ru> References: <87zl9hpgeu.fsf@paduch.telenet.ru> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1251993622 15075 80.91.229.12 (3 Sep 2009 16:00:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 3 Sep 2009 16:00:22 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M17371@lists.math.uh.edu Thu Sep 03 18:00:14 2009 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.50) id 1MjEjN-0005W3-Ne for ding-account@gmane.org; Thu, 03 Sep 2009 18:00:14 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1MjEiS-0005qc-1I; Thu, 03 Sep 2009 10:59:16 -0500 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1MjEiO-0005qN-Ql for ding@lists.math.uh.edu; Thu, 03 Sep 2009 10:59:12 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.69) (envelope-from ) id 1MjEiM-0005eD-CV for ding@lists.math.uh.edu; Thu, 03 Sep 2009 10:59:12 -0500 Original-Received: from k66.ru ([87.224.128.21]) by quimby.gnus.org with esmtp (Exim 3.36 #1 (Debian)) id 1MjEix-0005O9-00 for ; Thu, 03 Sep 2009 17:59:47 +0200 Original-Received: from paduch.telenet.ru (account dpaduch [90.157.67.22] verified) by k66.ru (CommuniGate Pro SMTP 5.1.13) with ESMTPSA id 338758519 for ding@gnus.org; Thu, 03 Sep 2009 21:59:08 +0600 In-Reply-To: (Katsumi Yamaoka's message of "Thu, 03 Sep 2009 20:28:04 +0900") User-Agent: Gnus/5.13 (Gnus v5.13) X-Spam-Score: -2.6 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:68953 Archived-At: --=-=-= Katsumi Yamaoka: >>>>>> Dmitri Paduchikh wrote: >> In some cases Gnus sends application/octet-stream attachments in >> unencoded form: >> ,---- >>| --=-=-= >>| Content-Type: application/octet-stream >>| Content-Disposition: attachment; filename=test.sh >>| >>| #!/bin/sh >>| echo test >> `---- >> I am concerned that contents can change when transferring a message. >> Think of EOL conversions, ">From " stuff, etc. Such changes can corrupt >> shell script, for example. >> In general, RFC 2046 says that application/octet-stream denotes >> arbitrary binary data. For arbitrary binary data I would expect that it >> is transferred exactly as is, even if it looks like a 7-bit text. > Agreed. Aren't there any other application/* types that should > not be forced to be encoded by 7bit? Otherwise, is it better not > to force the 7bit encoding to all application/* types? Hmm... It is unclear to me whether other application/* (or audio/*, image/*, video/*) require protection from this behavior. Although binary data most likely isn't 7-bit, it may be 7-bit in principle. IMO, in such case it would be preferable to provide safe default behavior and means to change it if user wants to. 7bit enforcement breaks both of these principles (safe default and user control) thus I would rather remove it completely as in the patch below. Are there any situations when it is desirable to enforce 7bit? > Here are two patches; one is for excluding application/octet-stream, > the other is for excluding application/*. Thank you. The following patch is a variation of your patches. -- Dmitri Paduchikh --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/lisp/mm-encode.el b/lisp/mm-encode.el index 39b83ff..963936d 100644 --- a/lisp/mm-encode.el +++ b/lisp/mm-encode.el @@ -145,13 +145,7 @@ The encoding used is returned." (encoding (or (and (listp type) (cadr (assq 'encoding type))) - (mm-content-transfer-encoding mime-type))) - (bits (mm-body-7-or-8))) - ;; We force buffers that are 7bit to be unencoded, no matter - ;; what the preferred encoding is. - ;; Only if the buffers don't contain lone lines. - (when (and (eq bits '7bit) (not (mm-long-lines-p 76))) - (setq encoding bits)) + (mm-content-transfer-encoding mime-type)))) (mm-encode-content-transfer-encoding encoding mime-type) encoding)) --=-=-=--