GNU bug report logs - #65703
gnus-cut-thread loop condition oddity

Previous Next

Package: emacs;

Reported by: Mattias Engdegård <mattias.engdegard <at> gmail.com>

Date: Sat, 2 Sep 2023 14:25:02 UTC

Severity: normal

To reply to this bug, email your comments to 65703 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#65703; Package emacs. (Sat, 02 Sep 2023 14:25:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Mattias Engdegård <mattias.engdegard <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 02 Sep 2023 14:25:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mattias Engdegård <mattias.engdegard <at> gmail.com>
To: Emacs Bug Report <bug-gnu-emacs <at> gnu.org>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, Andrew G Cohen <cohen <at> andy.bu.edu>
Subject: gnus-cut-thread loop condition oddity
Date: Sat, 2 Sep 2023 16:24:38 +0200
This is about code I know nothing about but a tool of mine noticed it in the passing:

The loop in gnus-cut-thread in lisp/gnus/gnus-sum.el, replicated below, has a very odd loop condition: the latter half looks misplaced, as if it would belong in the loop body.

In particular, there is a definite possibility that the little `while` loop at the end will end up supplying the value for the loop condition of the outer loop, which of course terminates it since `while` forms are always nil.

Maybe someone who knows Gnus please take a look?

  (while (and
          thread
          (or
           (gnus-summary-article-sparse-p (mail-header-number (car thread)))
           (gnus-summary-article-ancient-p
            (mail-header-number (car thread))))
          (if (or (<= (length (cdr thread)) 1)           ; Should this be here?
                  (eq gnus-fetch-old-headers 'invisible))
              (setq gnus-newsgroup-limit
                    (delq (mail-header-number (car thread))
                          gnus-newsgroup-limit)
                    thread (cadr thread))
            (when (gnus-invisible-cut-children (cdr thread))
              (let ((th (cdr thread)))
                (while th                                ; And this?
                  (if (memq (mail-header-number (caar th))
                            gnus-newsgroup-limit)
                      (setq thread (car th)
                            th nil)
                    (setq th (cdr th))))))))))





This bug report was last modified 1 year and 82 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.