unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#17666: 24.3.91; [regression] call-process in read-only buffers
@ 2014-06-02 15:01 Roland Winkler
  2014-06-02 16:18 ` Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Roland Winkler @ 2014-06-02 15:01 UTC (permalink / raw)
  To: 17666


evaluate the following with emacs -Q

;; running a process with no output via call-process
;; in any read-only buffer will do
(with-temp-buffer
  (let ((buffer-read-only t))
    (call-process "true" nil t)))

No problem with emacs 24.3

24.3.91:  Buffer is read-only: #<killed buffer>



In GNU Emacs 24.3.91.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.4.2)
 of 2014-05-12 on regnitz
Windowing system distributor `The X.Org Foundation', version 11.0.11103000
System Description:	Ubuntu 12.04.4 LTS

Important settings:
  value of $LC_COLLATE: C
  value of $LANG: en_US.ISO-8859-15
  locale-coding-system: iso-latin-9-unix

Major mode: Lisp Interaction





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#17666: 24.3.91; [regression] call-process in read-only buffers
  2014-06-02 15:01 bug#17666: 24.3.91; [regression] call-process in read-only buffers Roland Winkler
@ 2014-06-02 16:18 ` Stefan Monnier
  2014-06-02 16:25   ` Roland Winkler
  2014-06-02 18:42   ` Stefan Monnier
  0 siblings, 2 replies; 9+ messages in thread
From: Stefan Monnier @ 2014-06-02 16:18 UTC (permalink / raw)
  To: Roland Winkler; +Cc: 17666

> evaluate the following with emacs -Q

> ;; running a process with no output via call-process
> ;; in any read-only buffer will do
> (with-temp-buffer
>   (let ((buffer-read-only t))
>     (call-process "true" nil t)))

> No problem with emacs 24.3

I do not remember this being changed consciously, but the change does
sound like a bug fix: you should bind inhibit-read-only if you want to
insert text into a read-only buffer, and call-process shouldn't be
an exception.


        Stefan





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#17666: 24.3.91; [regression] call-process in read-only buffers
  2014-06-02 16:18 ` Stefan Monnier
@ 2014-06-02 16:25   ` Roland Winkler
  2014-06-02 17:37     ` Glenn Morris
  2014-06-02 17:57     ` Stefan Monnier
  2014-06-02 18:42   ` Stefan Monnier
  1 sibling, 2 replies; 9+ messages in thread
From: Roland Winkler @ 2014-06-02 16:25 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 17666

On Mon Jun 2 2014 Stefan Monnier wrote:
> > evaluate the following with emacs -Q
> 
> > ;; running a process with no output via call-process
> > ;; in any read-only buffer will do
> > (with-temp-buffer
> >   (let ((buffer-read-only t))
> >     (call-process "true" nil t)))
> 
> > No problem with emacs 24.3
> 
> I do not remember this being changed consciously, but the change does
> sound like a bug fix: you should bind inhibit-read-only if you want to
> insert text into a read-only buffer, and call-process shouldn't be
> an exception.

But what is the problem if a process does not have any output?
(Certainly, throwing an error makes sense for processes which do
create output in a read-only buffer.)

Roland





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#17666: 24.3.91; [regression] call-process in read-only buffers
  2014-06-02 16:25   ` Roland Winkler
@ 2014-06-02 17:37     ` Glenn Morris
  2014-06-02 17:45       ` Glenn Morris
  2014-06-02 18:14       ` Roland Winkler
  2014-06-02 17:57     ` Stefan Monnier
  1 sibling, 2 replies; 9+ messages in thread
From: Glenn Morris @ 2014-06-02 17:37 UTC (permalink / raw)
  To: Roland Winkler; +Cc: 17666

"Roland Winkler" wrote:

>> > (with-temp-buffer
>> >   (let ((buffer-read-only t))
>> >     (call-process "true" nil t)))
[...]
> But what is the problem if a process does not have any output?

If you know it isn't going to produce any output, why don't you just
discard the output instead of sending it to a read-only buffer (which is
something that really doesn't make sense)?

(with-temp-buffer
   (let ((buffer-read-only t))
     (call-process "true" nil nil)))





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#17666: 24.3.91; [regression] call-process in read-only buffers
  2014-06-02 17:37     ` Glenn Morris
@ 2014-06-02 17:45       ` Glenn Morris
  2014-06-02 18:34         ` Eli Zaretskii
  2014-06-02 18:14       ` Roland Winkler
  1 sibling, 1 reply; 9+ messages in thread
From: Glenn Morris @ 2014-06-02 17:45 UTC (permalink / raw)
  To: Roland Winkler; +Cc: 17666


Anyway, it's the prepare_to_modify_buffer in call_process what does it.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#17666: 24.3.91; [regression] call-process in read-only buffers
  2014-06-02 16:25   ` Roland Winkler
  2014-06-02 17:37     ` Glenn Morris
@ 2014-06-02 17:57     ` Stefan Monnier
  1 sibling, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2014-06-02 17:57 UTC (permalink / raw)
  To: Roland Winkler; +Cc: 17666

>> > evaluate the following with emacs -Q
>> > ;; running a process with no output via call-process
>> > ;; in any read-only buffer will do
>> > (with-temp-buffer
>> >   (let ((buffer-read-only t))
>> >     (call-process "true" nil t)))
>> > No problem with emacs 24.3
>> I do not remember this being changed consciously, but the change does
>> sound like a bug fix: you should bind inhibit-read-only if you want to
>> insert text into a read-only buffer, and call-process shouldn't be
>> an exception.
> But what is the problem if a process does not have any output?

Ah.. eh.. hmm.. yeah.. that case!
Well, then better make sure your process does output something!


        Stefan "who skipped the "true" part, obviously.  Sorry"





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#17666: 24.3.91; [regression] call-process in read-only buffers
  2014-06-02 17:37     ` Glenn Morris
  2014-06-02 17:45       ` Glenn Morris
@ 2014-06-02 18:14       ` Roland Winkler
  1 sibling, 0 replies; 9+ messages in thread
From: Roland Winkler @ 2014-06-02 18:14 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 17666-done

On Mon Jun 2 2014 Glenn Morris wrote:
> If you know it isn't going to produce any output, why don't you
> just discard the output instead of sending it to a read-only
> buffer (which is something that really doesn't make sense)?

Certainly, there are various ways around this.

In my case, I cannot remember anymore in all detail why I wrote the
code the way I did.  I expect that I was really *expecting* to have
no output.  Also, in my case, the call of call-process is associated
with a buffer that is most often read-only. So using a read-only
buffer for the process output was probably my cheap solution to keep
track of "really no output".





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#17666: 24.3.91; [regression] call-process in read-only buffers
  2014-06-02 17:45       ` Glenn Morris
@ 2014-06-02 18:34         ` Eli Zaretskii
  0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2014-06-02 18:34 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 17666, winkler

> Date: Mon, 02 Jun 2014 13:45:25 -0400
> Cc: 17666@debbugs.gnu.org
> 
> Anyway, it's the prepare_to_modify_buffer in call_process what does it.

Actually, I think the problem is that the code there calls
decode_coding_c_string even if we read zero bytes from the process.
With some coding-systems, this will insert something into the buffer,
so the call to prepare_to_modify_buffer is justified.

But I agree that the previous behavior was sweeping a subtle bug under
the carpet.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#17666: 24.3.91; [regression] call-process in read-only buffers
  2014-06-02 16:18 ` Stefan Monnier
  2014-06-02 16:25   ` Roland Winkler
@ 2014-06-02 18:42   ` Stefan Monnier
  1 sibling, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2014-06-02 18:42 UTC (permalink / raw)
  To: Roland Winkler; +Cc: 17666

>> evaluate the following with emacs -Q
>> ;; running a process with no output via call-process
>> ;; in any read-only buffer will do
>> (with-temp-buffer
>> (let ((buffer-read-only t))
>> (call-process "true" nil t)))
>> No problem with emacs 24.3

This should be fixed in emacs-24 now, thank you,


        Stefan





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-06-02 18:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-02 15:01 bug#17666: 24.3.91; [regression] call-process in read-only buffers Roland Winkler
2014-06-02 16:18 ` Stefan Monnier
2014-06-02 16:25   ` Roland Winkler
2014-06-02 17:37     ` Glenn Morris
2014-06-02 17:45       ` Glenn Morris
2014-06-02 18:34         ` Eli Zaretskii
2014-06-02 18:14       ` Roland Winkler
2014-06-02 17:57     ` Stefan Monnier
2014-06-02 18:42   ` Stefan Monnier

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).