From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Braun =?UTF-8?Q?G=C3=A1bor?= Newsgroups: gmane.emacs.bugs Subject: bug#52451: 27.1; jka-compr-write-region produces wrong type argument error Date: Sun, 12 Dec 2021 15:09:08 +0100 Message-ID: <3230961.nYHENnkMsn@gabor> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30678"; mail-complaints-to="usenet@ciao.gmane.io" To: 52451@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 12 15:10:14 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 1mwPYL-0007n4-Qt for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Dec 2021 15:10:13 +0100 Original-Received: from localhost ([::1]:45330 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwPYK-0007gv-O1 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Dec 2021 09:10:12 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:43594) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwPYA-0007gj-NV for bug-gnu-emacs@gnu.org; Sun, 12 Dec 2021 09:10:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39429) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mwPYA-0007nB-Ee for bug-gnu-emacs@gnu.org; Sun, 12 Dec 2021 09:10:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mwPYA-0005IQ-7f for bug-gnu-emacs@gnu.org; Sun, 12 Dec 2021 09:10:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Braun =?UTF-8?Q?G=C3=A1bor?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 12 Dec 2021 14:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 52451 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.163931815720303 (code B ref -1); Sun, 12 Dec 2021 14:10:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 12 Dec 2021 14:09:17 +0000 Original-Received: from localhost ([127.0.0.1]:50975 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mwPXR-0005HN-Dz for submit@debbugs.gnu.org; Sun, 12 Dec 2021 09:09:17 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:46988) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mwPXP-0005HG-PT for submit@debbugs.gnu.org; Sun, 12 Dec 2021 09:09:16 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:43522) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwPXP-0007el-Lj for bug-gnu-emacs@gnu.org; Sun, 12 Dec 2021 09:09:15 -0500 Original-Received: from [2a00:1450:4864:20::42e] (port=40455 helo=mail-wr1-x42e.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mwPXO-0007iR-17 for bug-gnu-emacs@gnu.org; Sun, 12 Dec 2021 09:09:15 -0500 Original-Received: by mail-wr1-x42e.google.com with SMTP id t9so22892941wrx.7 for ; Sun, 12 Dec 2021 06:09:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=akfXcf6xheuxg4cCcEaYzefU7S22uXHT/m9q3ZzBB60=; b=bEdmTk7uKY0lZ0H4wve83Ug3dRICt6JaWVGDjMNcqQxgoAMYI6Ki+dp6W2sC8B4XGB qE4wIngxbMzAHb1gud2wXBeXEOtO2at/c3rBEtNWOpvwrqodB1xVrbXNQaglLu4uD+1E lQlMdvYX7lgITxeODNpOGuoWLiL39zVXdmXJ6h7WuFHvc4qZJd0ECy75U3lWhxxeJQQL A8EPN9W7GCHzW4kD/RyeN5tXC1YmzqQAmgmSnJ7ofy0PBCQ2lt17+7uxNAD+EXJmcejv fMq/1kQeMm3F5urZwS8xhukLgDjmTa3X+SQ9OeRY+5Tum1WEre64pQZqNSO6IOWH5pvh BeQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=akfXcf6xheuxg4cCcEaYzefU7S22uXHT/m9q3ZzBB60=; b=Mq1r4zLxEWC2sZVEts7y8aekkhSpmNR1bdzVllXOb8XFjEDvFMcsJ+UvR3z0OfsOwE wWCNeskxRyHs2O7AG/8kTmCMXeSNkN3a1qMxR66ApVDHwM9B0+VfuuoiQ9bd6Cia3vfJ FXV1aIOVOgFtzHjBQRAWVuMRk5vOA4lW/IeB77e52ukoVNHtgn5LpViz608o1Q8RgOmv lGUHp3rxiootCrhlKE24tHYN4CL5E4E/W/glOYTp0QqZ6H4PfkJw1Q8qNq4N2sGrmauP GrDPhHLed0xgsilqgOJ3nP6fASPAUNebDEqRRnLLAaBc98SLcOLL4Lzbx2Ml9e54ueab DIow== X-Gm-Message-State: AOAM531l2Oe7tKqxImHD4WPOYPHTTwKnAzQ4VMbMPXpLuoxvFSuNKay5 xQPV3SqQ8OrcCGnYM+4Tm/QLJ+Kdmwc= X-Google-Smtp-Source: ABdhPJyPgYdHsSU6tqIfSKH/pD2jDqPMvnjO11moFa4jvx0hslPy8b1lSp/IpMSlHm+odyQp5/p6PA== X-Received: by 2002:adf:e991:: with SMTP id h17mr25045790wrm.40.1639318152270; Sun, 12 Dec 2021 06:09:12 -0800 (PST) Original-Received: from gabor.localnet (dslb-092-078-124-054.092.078.pools.vodafone-ip.de. [92.78.124.54]) by smtp.gmail.com with ESMTPSA id 4sm11355454wrz.90.2021.12.12.06.09.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 06:09:11 -0800 (PST) X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42e (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=braungb88@gmail.com; helo=mail-wr1-x42e.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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:222230 Archived-At: Hi, Start Emacs via the command emacs -Q --batch -l jka-compr.el --eval '(let ((jka-compr-really-do-compre= ss=20 t) (debug-on-error t)) (jka-compr-write-region "foo" nil "/tmp/test.gz"))' = =20 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") (=3D (- end start) (buffer-size)) (or (null start) (=3D (- end start) (buffer-size))) (and jka-compr-really-do-compress (or (null start) (=3D (- end start) (bu= ffer- size)))) (if (and jka-compr-really-do-compress (or (null start) (=3D (- end start)= =20 (buffer-size)))) (setq magic nil)) (let* ((filename (expand-file-name file)) (visit-file (if (stringp visit)= =20 (expand-file-name visit) filename)) (info (jka-compr-get-compression-info v= isit- file)) (magic (and info (jka-compr-info-file-magic-bytes info)))) (if (and = jka- compr-really-do-compress (or (null start) (=3D (- end start) (buffer-size))= ))=20 (setq magic nil)) (if (and info (not (and magic (equal (if (stringp start)= =20 (substring start 0 ...) (let* ... ...)) magic)))) (let ((can-append (jka- compr-info-can-append info)) (compress-program (jka-compr-info-compress- program info)) (compress-message (jka-compr-info-compress-message info))=20 (compress-args (jka-compr-info-compress-args info)) (base-name (file-name- nondirectory visit-file)) temp-file temp-buffer (coding-system-used last-co= ding- system-used)) (or compress-program (error "No compression program defined")= )=20 (setq temp-buffer (get-buffer-create " *jka-compr-wr-temp*")) (save-current- buffer (set-buffer temp-buffer) (widen) (erase-buffer)) (if (and append (no= t can- append) (file-exists-p filename)) (let* ((local-copy (file-local-copy filen= ame))=20 (local-file (or local-copy filename))) (setq temp-file local-file)) (setq t= emp-file=20 (jka-compr-make-temp-name))) (and compress-message jka-compr-verbose (messa= ge=20 "%s %s..." compress-message base-name)) (jka-compr-run-real-handler 'write- region (list start end temp-file t 'dont)) (setq coding-system-used last- coding-system-used) (let ((coding-system-for-read 'no-conversion)) (jka-com= pr- call-process compress-program (concat compress-message " " base-name) temp-= file=20 temp-buffer nil compress-args)) (save-current-buffer (set-buffer temp-buffe= r) (let=20 ((coding-system-for-write 'no-conversion)) (jka-compr-run-real-handler 'wri= te- region (list (point-min) (point-max) filename (and append can-append) 'dont= =20 lockname mustbenew)) (erase-buffer))) (delete-file temp-file) (and compress- message jka-compr-verbose (message "%s %s...done" compress-message base- name)) (cond ((eq visit t) (setq buffer-file-name filename) (setq jka-compr- really-do-compress t) (set-visited-file-modtime)) ((stringp visit) (setq bu= ffer- file-name visit) (let ((buffer-file-name filename)) (set-visited-file-modti= me))))=20 (and (or (eq visit t) (eq visit nil) (stringp visit)) (message "Wrote %s"=20 visit-file)) (setq last-coding-system-used coding-system-used) nil) (jka-co= mpr- run-real-handler 'write-region (list start end filename append visit lockna= me=20 mustbenew)))) jka-compr-write-region("foo" nil "/tmp/test.gz") (let ((jka-compr-really-do-compress t) (debug-on-error t)) (jka-compr-wri= te- region "foo" nil "/tmp/test.gz")) eval((let ((jka-compr-really-do-compress t) (debug-on-error t)) (jka-comp= r- write-region "foo" nil "/tmp/test.gz")) t) command-line-1(("-l" "jka-compr.el" "--eval" "(let ((jka-compr-really-do- compress t) (debug-on-e...")) command-line() normal-top-level() 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) (=3D (- 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. Best wishes, G=C3=A1bor Braun In GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cair= o=20 version 1.16.0) of 2021-03-28, modified by Debian built on x86-conova-01 Windowing system distributor 'The X.Org Foundation', version 11.0.12011000 System Description: Devuan GNU/Linux 4 (chimaera) Configured using: 'configure --build x86_64-linux-gnu --prefix=3D/usr --sharedstatedir=3D/var/lib --libexecdir=3D/usr/lib --localstatedir=3D/var/lib --infodir=3D/usr/share/info --mandir=3D/usr/share/man --enable-libsystemd --with-pop=3Dyes --enable-locallisppath=3D/etc/emacs:/usr/local/share/emacs/27.1/site-lisp:= /usr/ local/share/emacs/site-lisp:/usr/share/emacs/27.1/site-lisp:/usr/share/emac= s/ site-lisp --with-sound=3Dalsa --without-gconf --with-mailutils --build x86_64-linux-gnu --prefix=3D/usr --sharedstatedir=3D/var/lib --libexecdir=3D/usr/lib --localstatedir=3D/var/lib --infodir=3D/usr/share/info --mandir=3D/usr/share/man --enable-libsystemd --with-pop=3Dyes --enable-locallisppath=3D/etc/emacs:/usr/local/share/emacs/27.1/site-lisp:= /usr/ local/share/emacs/site-lisp:/usr/share/emacs/27.1/site-lisp:/usr/share/emac= s/ site-lisp --with-sound=3Dalsa --without-gconf --with-mailutils --with-cairo --with-x=3Dyes --with-x-toolkit=3Dgtk3 --with-toolkit-scroll-bars 'CFLAGS=3D-g -O2 -ffile-prefix-map=3D/build/emacs-LlFm6W/emacs-27.1+1=3D. -fstack-protector= =2Dstrong -Wformat -Werror=3Dformat-security -Wall' 'CPPFLAGS=3D-Wdate-time -D_FORTIFY_SOURCE=3D2' LDFLAGS=3D-Wl,-z,relro' Configured features: XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON PDUMPER LCMS2 GMP Important settings: value of $LANG: hu_HU.UTF-8 locale-coding-system: utf-8-unix