all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattias.engdegard@gmail.com>
To: 65703@debbugs.gnu.org
Cc: Lars Ingebrigtsen <larsi@gnus.org>, Andrew G Cohen <cohen@andy.bu.edu>
Subject: bug#65703: gnus-cut-thread loop condition oddity
Date: Sat, 2 Sep 2023 16:24:38 +0200	[thread overview]
Message-ID: <BA195515-05A3-49B0-95BB-7C50A5CEC00A@gmail.com> (raw)

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))))))))))






                 reply	other threads:[~2023-09-02 14:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BA195515-05A3-49B0-95BB-7C50A5CEC00A@gmail.com \
    --to=mattias.engdegard@gmail.com \
    --cc=65703@debbugs.gnu.org \
    --cc=cohen@andy.bu.edu \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.