From mboxrd@z Thu Jan 1 00:00:00 1970
Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail
From: Philipp Stephani
Newsgroups: gmane.emacs.bugs
Subject: bug#40576: call-process-region does not accept nil as first argument
Date: Sun, 12 Apr 2020 19:07:59 +0200
Message-ID:
References:
<83zhbgk74d.fsf@gnu.org>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202";
logging-data="29839"; mail-complaints-to="usenet@ciao.gmane.io"
Cc: 40576@debbugs.gnu.org, Pietro Giorgianni
To: Eli Zaretskii
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 12 19:09:16 2020
Return-path:
Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.92)
(envelope-from )
id 1jNg6d-0007gG-QV
for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Apr 2020 19:09:15 +0200
Original-Received: from localhost ([::1]:35332 helo=lists1p.gnu.org)
by lists.gnu.org with esmtp (Exim 4.90_1)
(envelope-from )
id 1jNg6c-0004XD-TS
for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Apr 2020 13:09:14 -0400
Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47598)
by lists.gnu.org with esmtp (Exim 4.90_1)
(envelope-from ) id 1jNg6R-0004WP-En
for bug-gnu-emacs@gnu.org; Sun, 12 Apr 2020 13:09:04 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from ) id 1jNg6Q-0003R8-Ac
for bug-gnu-emacs@gnu.org; Sun, 12 Apr 2020 13:09:03 -0400
Original-Received: from debbugs.gnu.org ([209.51.188.43]:47216)
by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
(Exim 4.71) (envelope-from )
id 1jNg6Q-0003Qv-6s
for bug-gnu-emacs@gnu.org; Sun, 12 Apr 2020 13:09:02 -0400
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
(envelope-from ) id 1jNg6Q-0005sV-3S
for bug-gnu-emacs@gnu.org; Sun, 12 Apr 2020 13:09:02 -0400
X-Loop: help-debbugs@gnu.org
Resent-From: Philipp Stephani
Original-Sender: "Debbugs-submit"
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Sun, 12 Apr 2020 17:09:02 +0000
Resent-Message-ID:
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 40576
X-GNU-PR-Package: emacs
Original-Received: via spool by 40576-submit@debbugs.gnu.org id=B40576.158671129722530
(code B ref 40576); Sun, 12 Apr 2020 17:09:02 +0000
Original-Received: (at 40576) by debbugs.gnu.org; 12 Apr 2020 17:08:17 +0000
Original-Received: from localhost ([127.0.0.1]:58762 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1jNg5h-0005rK-Bx
for submit@debbugs.gnu.org; Sun, 12 Apr 2020 13:08:17 -0400
Original-Received: from mail-ot1-f54.google.com ([209.85.210.54]:40884)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from ) id 1jNg5g-0005r6-AB
for 40576@debbugs.gnu.org; Sun, 12 Apr 2020 13:08:16 -0400
Original-Received: by mail-ot1-f54.google.com with SMTP id i27so4046137ota.7
for <40576@debbugs.gnu.org>; Sun, 12 Apr 2020 10:08:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to
:cc; bh=WNIzZM/HGNVuCHPySS85yQsDDzeztT5gAummDuPnBNw=;
b=SLNwEKs/y5ZlzV46nx+9WRcwHs1QC1duIAS2Etc95wrVeXEHVSmPyA+4NTufa46W+C
764Go7oZgu/3rIUP4/4C6lQxhsGsKvOQsvBkCtJtsI/D4w4qabmv3y791m/Kqwnqe0a8
Cd4qY7A51Tq+2J6cV+WKTaQFWk8BMiNdNl0kUCXJbEOlPFzgzvgosVGQjOeP9sSfy4Cb
kQxHB/TNKRWbbVIBcAatGcaq4J0CpAVugcDsH+Ro0htiTSGZcXXWaUbOxD7mkTBhFbLD
YIQyxeWuH/mMyzqwBfos3sEzROuiyoGZfCv4qDS4Y5uN7mtZj9nq4Ii0HsTPwxqKMSFY
mILA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to:cc;
bh=WNIzZM/HGNVuCHPySS85yQsDDzeztT5gAummDuPnBNw=;
b=A8FCkuXo+zgLKSEfPhKFmXAz2xVnxN/reVgbnEUH0sqeboyG6rWfFN9TFrrDdBh+oE
13ieONltGP4Pn0/YgFn7wlMG4ux1ORhyUIFEApAnO5L7/BNEsFR6egsOqd9r31FmFAh0
ZUmWymiMqE5m35xuOXHJt5hnvIcjodSaGy0xxLKScEe2rIJO0nj/PH0AghtqvD0dsEnS
jGeizdVsBFPnij7EKoWQ/9cCpR58NVf0cdED8zxEqMcTIW5AfionYyeIaajdVGS+fM+9
WFE3Dw8M7S5hPkVlForOAWwDQYpUr+SIVkIwmh24i8yzqK9+63iL/EZMj5SqEWlc+B/S
9P9A==
X-Gm-Message-State: AGi0Puasw4EcL8dpEx/buRmrAAE/AnaD0nW1ZRl4xzL+F533N+ibVHPS
rdYWcJSX2sebhaKMqqvGaYsDLkwlDGB+l6tA/Y4=
X-Google-Smtp-Source: APiQypLRT36TrcCo8XKWHaSQ+A/HWm6qfDS38BiOKMuSdj29ORebm7DehHJzy/8TtnmEoBR0AMsbAc7m/7447r11tco=
X-Received: by 2002:a9d:2948:: with SMTP id d66mr9285437otb.174.1586711290793;
Sun, 12 Apr 2020 10:08:10 -0700 (PDT)
In-Reply-To:
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 209.51.188.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-mx.org@gnu.org
Original-Sender: "bug-gnu-emacs"
Xref: news.gmane.io gmane.emacs.bugs:178264
Archived-At:
Am So., 12. Apr. 2020 um 18:44 Uhr schrieb Philipp Stephani
:
>
> Am So., 12. Apr. 2020 um 18:21 Uhr schrieb Eli Zaretskii :
> >
> > > From: Philipp Stephani
> > > Date: Sun, 12 Apr 2020 18:01:40 +0200
> > > Cc: 40576@debbugs.gnu.org
> > >
> > > > According to the documentation of call-process-region,
> > > > If START is nil, that means to use the entire buffer contents; END is
> > > > ignored.
> > > >
> > > > But when I run:
> > > > (call-process-region nil nil "/bin/cat" t (current-buffer))
> > > > I get:
> > > > Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
> > > > call-process-region(nil nil "/bin/cat" t #)
> > > > eval((call-process-region nil nil "/bin/cat" t (current-buffer)) nil)
> > > > elisp--eval-last-sexp(t)
> > > > eval-last-sexp(t)
> > > > eval-print-last-sexp(nil)
> > > > funcall-interactively(eval-print-last-sexp nil)
> > > > call-interactively(eval-print-last-sexp nil nil)
> > > > command-execute(eval-print-last-sexp)
> > > >
> > > > If, instead, I run:
> > > > (call-process-region (point-min) (point-max) "/bin/cat" t (current-buffer))
> > > >
> > > > It works.
> > > >
> > > > Am I interpreting the documentation wrong?
> > >
> > > Nope, looks like a genuine bug (that happens only if DELETE is non-nil).
> >
> > Right. But there's more here than meets the eye, because the change
> > after which we started advertising the special meaning of nil for
> > START exposed a problem: write_region, called from create_temp_file,
> > has special meaning for START = nil: it widens the buffer and writes
> > the entire buffer contents to the temp file. Which isn't right when
> > write_region is called from call-process-region, as it allows access
> > to inaccessible portion of the buffer, something we shouldn't do.
>
> I think that's pretty much intentional. The documentation says
>
> "If START is nil, that means to use the entire buffer contents"
>
> It specifically doesn't say to only use the accessible portion of the
> buffer. Given that this behavior probably has been in place since
> commit 561cb8e159e7eff7a6487a45a1cfab47ba456030 from 1994, it would be
> rather unwise to introduce such a breaking change.
While the behavior of call-process-region and write-region is
unfortunate in this respect, I think it's way too late to change it
now. We should rather explicitly call out in the docstrings that
buffer restrictions are ignored.