From unknown Sat Sep 06 14:24:26 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#6762 <6762@debbugs.gnu.org> To: bug#6762 <6762@debbugs.gnu.org> Subject: Status: 23.2; Eshell bug in detecting read-only file (patch included) Reply-To: bug#6762 <6762@debbugs.gnu.org> Date: Sat, 06 Sep 2025 21:24:26 +0000 retitle 6762 23.2; Eshell bug in detecting read-only file (patch included) reassign 6762 emacs submitter 6762 Leo severity 6762 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 30 06:13:53 2010 Received: (at submit) by debbugs.gnu.org; 30 Jul 2010 10:13:53 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OembB-0004Rn-G6 for submit@debbugs.gnu.org; Fri, 30 Jul 2010 06:13:53 -0400 Received: from mx10.gnu.org ([199.232.76.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oemb9-0004Ri-4z for submit@debbugs.gnu.org; Fri, 30 Jul 2010 06:13:51 -0400 Received: from lists.gnu.org ([199.232.76.165]:57975) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OembO-0006zy-Et for submit@debbugs.gnu.org; Fri, 30 Jul 2010 06:14:06 -0400 Received: from [140.186.70.92] (port=46102 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OembM-0003vO-Gr for bug-gnu-emacs@gnu.org; Fri, 30 Jul 2010 06:14:05 -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,FREEMAIL_FROM, RCVD_IN_DNSWL_MED,T_RP_MATCHES_RCVD,T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OembI-0005h4-C2 for bug-gnu-emacs@gnu.org; Fri, 30 Jul 2010 06:14:04 -0400 Received: from ppsw-32.csi.cam.ac.uk ([131.111.8.132]:44732) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OembI-0005gs-86 for bug-gnu-emacs@gnu.org; Fri, 30 Jul 2010 06:14:00 -0400 X-Cam-AntiVirus: no malware found X-Cam-SpamDetails: not scanned X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Received: from cpc1-cmbg13-0-0-cust596.cmbg.cable.ntl.com ([86.9.122.85]:59267 helo=Victoria.local) by ppsw-32.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.158]:587) with esmtpsa (PLAIN:sl392) (TLSv1:DHE-RSA-AES128-SHA:128) id 1OembH-0001PA-12 (Exim 4.72) (return-path ); Fri, 30 Jul 2010 11:13:59 +0100 From: Leo To: bug-gnu-emacs@gnu.org Subject: 23.2; Eshell bug in detecting read-only file (patch included) Date: Fri, 30 Jul 2010 11:13:58 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -6.3 (------) X-Debbugs-Envelope-To: submit Cc: John Wiegley 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: -6.3 (------) I have diff-default-read-only set to t and this prevents eshell from writing to diff files i.e. ESHELL$ git diff x..y > file.diff fails due to its use of buffer-read-only, which doesn't necessary reflects the read-only state of a file. The following patch tries to fix this. Leo commit b1dc6a427e43470981d4700b0c98aa21ecb03052 Author: sdl.web@gmail.com Date: Sat May 1 17:50:21 2010 +0100 Better detection of read-only file in eshell-get-target Modified lisp/eshell/esh-io.el diff --git a/lisp/eshell/esh-io.el b/lisp/eshell/esh-io.el index 1bcfe2b..3aa785c 100644 --- a/lisp/eshell/esh-io.el +++ b/lisp/eshell/esh-io.el @@ -343,8 +343,9 @@ it defaults to `insert'." (let* ((exists (get-file-buffer target)) (buf (find-file-noselect target t))) (with-current-buffer buf - (if buffer-read-only + (if buffer-file-read-only (error "Cannot write to read-only file `%s'" target)) + (setq buffer-read-only nil) (set (make-local-variable 'eshell-output-file-buffer) (if (eq exists buf) 0 t)) (cond ((eq mode 'overwrite) From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 30 06:15:48 2010 Received: (at submit) by debbugs.gnu.org; 30 Jul 2010 10:15:48 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oemd1-0004TH-Op for submit@debbugs.gnu.org; Fri, 30 Jul 2010 06:15:47 -0400 Received: from mx10.gnu.org ([199.232.76.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oemcy-0004TB-RR for submit@debbugs.gnu.org; Fri, 30 Jul 2010 06:15:45 -0400 Received: from lists.gnu.org ([199.232.76.165]:38546) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OemdE-000711-BH for submit@debbugs.gnu.org; Fri, 30 Jul 2010 06:16:00 -0400 Received: from [140.186.70.92] (port=46659 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OemdC-0004v5-RC for bug-gnu-emacs@gnu.org; Fri, 30 Jul 2010 06:15:59 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_00,FREEMAIL_FROM, FREEMAIL_REPLY, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OemdB-00063g-AV for bug-gnu-emacs@gnu.org; Fri, 30 Jul 2010 06:15:58 -0400 Received: from mail-pv0-f169.google.com ([74.125.83.169]:54537) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OemdB-00063E-6C for bug-gnu-emacs@gnu.org; Fri, 30 Jul 2010 06:15:57 -0400 Received: by pvc30 with SMTP id 30so887297pvc.0 for ; Fri, 30 Jul 2010 03:15:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:mime-version :content-type:from:in-reply-to:date:cc:content-transfer-encoding :message-id:references:to:x-mailer; bh=QFEjvr7tXMTHVdhCzhNMeiAFsc/B0OcJHrY6Hf0sb8g=; b=VEg6oN54Q3Do51y7IdR/vpp0M46NoNcJEvTsShwb18wM1UO2fQg+dCTaUxwI7E7HFW CUQQyztaEzeZAJiVHCEqFTZ4s/0uYRZP4NSypGDSjYt9KUrucLHO0k145zMr243ZV6Ry cNxBzFJTIMrjCWPmKOhKy7J8lOeLvkJ4lFG5U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; b=E3ejWiFyhfl1GJyDAQkgiX4V8t9LObUVElWtFVsnr13kpkFZ6DB/cQruMy4OzySk/U EyaXERivCNdmkvVCtDczTo6AP5BBdEWA46E4NHQ8fz44SiecuY1C8penVlyzfFes5nAo DDQFwggcy1UcOkUBPneUfNXWKpLD2AKP1uMGo= Received: by 10.114.111.9 with SMTP id j9mr1958541wac.2.1280484955405; Fri, 30 Jul 2010 03:15:55 -0700 (PDT) Received: from [192.168.9.141] (pool-74-105-230-191.nwrknj.fios.verizon.net [74.105.230.191]) by mx.google.com with ESMTPS id fb41sm2371333qcb.27.2010.07.30.03.15.53 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 30 Jul 2010 03:15:54 -0700 (PDT) Subject: Re: 23.2; Eshell bug in detecting read-only file (patch included) Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii From: John Wiegley In-Reply-To: Date: Fri, 30 Jul 2010 06:15:52 -0400 Content-Transfer-Encoding: 7bit Message-Id: <9725718A-C8F6-4D99-8B60-507A82AC0FE9@gmail.com> References: To: Leo X-Mailer: Apple Mail (2.1081) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -4.8 (----) X-Debbugs-Envelope-To: submit Cc: bug-gnu-emacs@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: -5.0 (-----) Looks like a great patch to me. John On Jul 30, 2010, at 6:13 AM, Leo wrote: > I have diff-default-read-only set to t and this prevents eshell from > writing to diff files i.e. > > ESHELL$ git diff x..y > file.diff > > fails due to its use of buffer-read-only, which doesn't necessary > reflects the read-only state of a file. > > The following patch tries to fix this. > > Leo > > commit b1dc6a427e43470981d4700b0c98aa21ecb03052 > Author: sdl.web@gmail.com > Date: Sat May 1 17:50:21 2010 +0100 > > Better detection of read-only file in eshell-get-target > > Modified lisp/eshell/esh-io.el > diff --git a/lisp/eshell/esh-io.el b/lisp/eshell/esh-io.el > index 1bcfe2b..3aa785c 100644 > --- a/lisp/eshell/esh-io.el > +++ b/lisp/eshell/esh-io.el > @@ -343,8 +343,9 @@ it defaults to `insert'." > (let* ((exists (get-file-buffer target)) > (buf (find-file-noselect target t))) > (with-current-buffer buf > - (if buffer-read-only > + (if buffer-file-read-only > (error "Cannot write to read-only file `%s'" target)) > + (setq buffer-read-only nil) > (set (make-local-variable 'eshell-output-file-buffer) > (if (eq exists buf) 0 t)) > (cond ((eq mode 'overwrite) > From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 30 19:25:29 2010 Received: (at 6762-done) by debbugs.gnu.org; 30 Jul 2010 23:25:29 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OeyxE-0002BJ-9J for submit@debbugs.gnu.org; Fri, 30 Jul 2010 19:25:28 -0400 Received: from pantheon-po44.its.yale.edu ([130.132.50.78]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OeyxD-0002BC-4x for 6762-done@debbugs.gnu.org; Fri, 30 Jul 2010 19:25:27 -0400 Received: from furry (dhcp128036014221.central.yale.edu [128.36.14.221]) (authenticated bits=0) by pantheon-po44.its.yale.edu (8.12.11.20060308/8.12.11) with ESMTP id o6UNPhpW015141 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 30 Jul 2010 19:25:43 -0400 Received: by furry (Postfix, from userid 1000) id 15E5EC013; Fri, 30 Jul 2010 19:25:44 -0400 (EDT) From: Chong Yidong To: John Wiegley Subject: Re: bug#6762: 23.2; Eshell bug in detecting read-only file (patch included) References: <9725718A-C8F6-4D99-8B60-507A82AC0FE9@gmail.com> Date: Fri, 30 Jul 2010 19:25:44 -0400 In-Reply-To: <9725718A-C8F6-4D99-8B60-507A82AC0FE9@gmail.com> (John Wiegley's message of "Fri, 30 Jul 2010 06:15:52 -0400") Message-ID: <87d3u4eemf.fsf@stupidchicken.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-YaleITSMailFilter: Version 1.2c (attachment(s) not renamed) X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 6762-done Cc: Leo , 6762-done@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: -2.7 (--) John Wiegley writes: > Looks like a great patch to me. Checked in. Thanks. > On Jul 30, 2010, at 6:13 AM, Leo wrote: > >> I have diff-default-read-only set to t and this prevents eshell from >> writing to diff files i.e. >> >> ESHELL$ git diff x..y > file.diff >> >> fails due to its use of buffer-read-only, which doesn't necessary >> reflects the read-only state of a file. >> >> The following patch tries to fix this. From unknown Sat Sep 06 14:24:26 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 28 Aug 2010 11:24:03 +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