From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#52451: 27.1; jka-compr-write-region produces wrong type argument error Date: Sun, 12 Dec 2021 16:28:09 +0200 Message-ID: <83ilvtoq2u.fsf@gnu.org> References: <3230961.nYHENnkMsn@gabor> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40709"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 52451@debbugs.gnu.org To: Braun =?UTF-8?Q?G=C3=A1bor?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 12 15:29:11 2021 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 1mwPqh-000APC-9T for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Dec 2021 15:29:11 +0100 Original-Received: from localhost ([::1]:49762 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwPqf-0003Mv-By for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Dec 2021 09:29:09 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:46160) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwPqY-0003Mm-8p for bug-gnu-emacs@gnu.org; Sun, 12 Dec 2021 09:29:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39458) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mwPqY-0004ip-0N for bug-gnu-emacs@gnu.org; Sun, 12 Dec 2021 09:29:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mwPqX-0005jg-NI for bug-gnu-emacs@gnu.org; Sun, 12 Dec 2021 09:29:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 12 Dec 2021 14:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52451 X-GNU-PR-Package: emacs Original-Received: via spool by 52451-submit@debbugs.gnu.org id=B52451.163931930522009 (code B ref 52451); Sun, 12 Dec 2021 14:29:01 +0000 Original-Received: (at 52451) by debbugs.gnu.org; 12 Dec 2021 14:28:25 +0000 Original-Received: from localhost ([127.0.0.1]:51004 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mwPpx-0005iu-4n for submit@debbugs.gnu.org; Sun, 12 Dec 2021 09:28:25 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:45334) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mwPpv-0005iZ-Kz for 52451@debbugs.gnu.org; Sun, 12 Dec 2021 09:28:23 -0500 Original-Received: from [2001:470:142:3::e] (port=60800 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwPpq-0004Rr-Bk; Sun, 12 Dec 2021 09:28:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=3mQPDXOFIanuWa8P0offd6suJ4LqwiFndoDxAcRFS2w=; b=mozapxpKIqP9d5ab54bd X/Y8gz6zzTYp3JoH3qq8MWJ10RPuT3f5nRGLawVTLazNy1T3YO2avUaMQer7uoE2ykEF4k647XR08 oPbXdyrLAsiBRrsv9SLd9sjKqh0s0d9lONdZEnHct06uD9TwULLNCeJiHwF/2APS9aVCRbx6ZjXy1 p53GqJugFxEozoQh5hiqRJz+jlA0JsxcXYs/6LmMBHshzo1LyJaeDdFeWlICc4+kaxsM3ylCh6flZ 2PZDJkIqj6SslDKtkxhn6cy/g8wSsecREeTetqsM22jVIyeKaDIXSlB351QQFoH1djToakhus3rsb DCduweAdXG9Vqg==; Original-Received: from [87.69.77.57] (port=3682 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwPpq-0002b2-4u; Sun, 12 Dec 2021 09:28:18 -0500 In-Reply-To: <3230961.nYHENnkMsn@gabor> (message from Braun =?UTF-8?Q?G=C3=A1bor?= on Sun, 12 Dec 2021 15:09:08 +0100) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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:222233 Archived-At: > From: Braun Gábor > Date: Sun, 12 Dec 2021 15:09:08 +0100 > > Start Emacs via the command > > emacs -Q --batch -l jka-compr.el --eval '(let ((jka-compr-really-do-compress > t) (debug-on-error t)) (jka-compr-write-region "foo" nil "/tmp/test.gz"))' > > > This should run without any error. > Instead the following appears on the terminal: > > > uncompressing jka-compr.el.gz... > uncompressing jka-compr.el.gz...done > Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil) > -(nil "foo") > (= (- end start) (buffer-size)) > (or (null start) (= (- end start) (buffer-size))) Why did you assume that jka-compr-write-region supports compressing a string, not just a portion of a buffer? I don't see it documented anywhere. > My guess is that the debugger refers to the following snippet > in function `jka-commpr-write-region': > > ;; If we uncompressed this file when visiting it, > ;; then recompress it when writing it > ;; even if the contents look compressed already. > (if (and jka-compr-really-do-compress > (or (null start) > (= (- end start) (buffer-size)))) > (setq magic nil)) > > This seems to falsely assume that START is nil or a buffer position, > even though the docstring of `write-region' explicitly allows it to be a > string. When will write-region invoke jka-commpr-write-region if it is called with the first argument a string? That's the use case we should discuss, not the direct invocation of jka-commpr-write-region in your recipe, I think.