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 18:44:58 +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="67478"; 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 18:46:11 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 1jNfkJ-000HSZ-90 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Apr 2020 18:46:11 +0200 Original-Received: from localhost ([::1]:35168 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jNfkH-0006cY-Vm for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Apr 2020 12:46:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45858) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jNfkB-0006cG-8y for bug-gnu-emacs@gnu.org; Sun, 12 Apr 2020 12:46:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jNfkA-0000oT-8c for bug-gnu-emacs@gnu.org; Sun, 12 Apr 2020 12:46:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47177) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jNfkA-0000oL-4H for bug-gnu-emacs@gnu.org; Sun, 12 Apr 2020 12:46:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jNfk9-0005Gy-RQ for bug-gnu-emacs@gnu.org; Sun, 12 Apr 2020 12:46: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 16:46:01 +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.158670991620201 (code B ref 40576); Sun, 12 Apr 2020 16:46:01 +0000 Original-Received: (at 40576) by debbugs.gnu.org; 12 Apr 2020 16:45:16 +0000 Original-Received: from localhost ([127.0.0.1]:58723 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jNfjQ-0005Fl-Co for submit@debbugs.gnu.org; Sun, 12 Apr 2020 12:45:16 -0400 Original-Received: from mail-ot1-f49.google.com ([209.85.210.49]:46813) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jNfjP-0005FT-3z for 40576@debbugs.gnu.org; Sun, 12 Apr 2020 12:45:15 -0400 Original-Received: by mail-ot1-f49.google.com with SMTP id w12so6016816otm.13 for <40576@debbugs.gnu.org>; Sun, 12 Apr 2020 09:45:15 -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=1DFuo5Q+PKzs94SycesqmKsjcXgHJxd1ZGZlknEd5r4=; b=lQFOnpYTQ+yU9fIW9F1DOPZJlHOi7grl97vB9s5z8PEA5fFDQWFEx0B80x3aeebYu/ bk7hEpIqE/iWJ1t0dZ1pwWjkDfXTjq4dWqlJG0bZGkVkIbJazKPgEVoBzuegZu7oD+hE fj7N8wBcb8shYnQUAWI5IlIQ/6S+XJbx7uiMv9MGpzGOjuulUuu/TXIu4EILM58XcG+b f5atgkzRRM2PfWUIGB6EoKZBT2ZvP+/RqMBgGb2JATTt1Wu0VC3fBBJdytIl9XrGrPWd rgDWJpMeo2hL+7sjAypriXgt3WzbmoBqa+eRE75aIeH9LTIJy2k1ZQpkKmIUAYoPxo5S 5/Wg== 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=1DFuo5Q+PKzs94SycesqmKsjcXgHJxd1ZGZlknEd5r4=; b=V/NhclGIqjzqULYCXpZ7kQFnoM28LaWQ3Ll4l3erwTD605KiWtLehnYeCwmV9sfY+I dcppgxY23d5LxPEUh/pUq6WJd1m/GByz1/36Lc1W0BD7c5cjV+VVRzklkaV9a8xzDoA4 HIJkMTXR1Hdo5ybib5YXuD+bRwhtvSfBEt/ox1C+yx12QRwFdNotTh1+f4Qj6Uq84T3f 2Se2hLxg/ZtmHdNvOSFtzJ5JM83a8nh0KMQRTVX+438aGXK0MZp8CnEl3Dca0SQ96cwv 9+7pjVp0wdJv2gFFooFkbkexMaZPAV+N4hk9S7JDk8pr+fR0dOmliT7bqWwCfwhw/N0b Mh1g== X-Gm-Message-State: AGi0PubrfCzG1LLnz61SkjhAp88tAYeKXQD5328RFmZBYT2DM3TMmYYl Yl6xPUFSxN3MkP7oxjrMblaCB4nRMYG8rNPNU7s= X-Google-Smtp-Source: APiQypI6rKyHoTAJgVAKkPXGirL3JL991HoMhYq+q+VLEmTgS+HAcSP/0B7net4QMIepCzUDfeK7UJ0ow2IIkMhKsl0= X-Received: by 2002:a05:6830:1e79:: with SMTP id m25mr11364689otr.36.1586709909380; Sun, 12 Apr 2020 09:45:09 -0700 (PDT) In-Reply-To: <83zhbgk74d.fsf@gnu.org> 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:178258 Archived-At: 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.