Subject: bug#61002: closed (Re: bug#61002: 28.2; Gnus - "Date" scoring scores all articles.)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 17 Feb 2024 17:43:01 +0000

Your bug report

#61002: 28.2; Gnus - "Date" scoring scores all articles.

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
61002: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=61002
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#61002: 28.2; Gnus - "Date" scoring scores all articles.
From: Eric Abrahamsen <[email-masked]>
To: Jakub Ječmínek <[email-masked]>
Cc: [email-masked], Eli Zaretskii <[email-masked]>, [email-masked], [email-masked]
Date: Sat, 17 Feb 2024 09:41:42 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

Jakub Ječmínek <[email-masked]> writes:

> Hi, thanks for the feedback!
>
> Eric Abrahamsen <[email-masked]> writes:
>
>> Thanks for the ping. TBH I've never used scoring in Gnus, so this is new
>> territory for me. I tried the patch and it worked correctly, but...
>>
>> The patch is doing this:
>>
>> (gnus-date-get-time (gnus-date-iso8601 match))
>>
>> This is the definition of `gnus-date-iso8601':
>>
>> (defun gnus-date-iso8601 (date)
>>   "Convert the DATE to YYYYMMDDTHHMMSS."
>>   (condition-case ()
>>       (gnus-time-iso8601 (gnus-date-get-time date))
>>     (error "")))
>>
>> So error handling aside, the patch ends up doing the equivalent of:
>>
>> (let ((ds "Sun, 22 Jan 2023 09:30:17 +0100"))
>>   (gnus-date-get-time
>>    (gnus-time-iso8601
>>     (gnus-date-get-time ds))))
>>
>> which effectively round-trips the date string through two different
>> formats.
>
> You're right. I've replaced the offending form with this:
>
> (car (time-convert (gnus-date-get-time match) 1))
>
>> [...] I think we should just keep the inner
>> `gnus-date-get-time' call, and wrap the whole `int-to-string' form in a
>> `condition-case'. If anything at all goes wrong we really don't care, we
>> can just skip it and return a "1" or something.
>>
>> WDYT?
>
> I believe that error handling is now redundant, because even if we try to
> parse invalid date using `gnus-date-get-time' we still end up with valid
> value (0).
>
> (/ (car (time-convert (gnus-date-get-time "invalid date") 1)) 86400)
>
> But, there's one important thing I failed to realize - the code I wrote
> would break prompts for other headers. Therefore I propose we add `cond'
> and distinguish which header we're scoring on.
>
> Please let me know what you think, here's the patch:
>
>>>From 4e2174503c1d69345536929a22483ae309048271 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Jakub=20Je=C4=8Dm=C3=ADnek?= <[email-masked]>
> Date: Mon, 12 Feb 2024 14:03:24 +0100
> Subject: [PATCH] Provide valid match string when scoring on date header
>  (Bug#61002)
>
> * lisp/gnus/gnus-score.el (gnus-summary-score-entry): Fix invalid
> default match string when creating score file interactively on date header.
> ---
>  lisp/gnus/gnus-score.el | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el
> index bd19e7d7cd7..479b7496cf1 100644
> --- a/lisp/gnus/gnus-score.el
> +++ b/lisp/gnus/gnus-score.el
> @@ -893,9 +893,14 @@ If optional argument `EXTRA' is non-nil, it's a non-standard overview header."
>  				 (t "permanent"))
>  			   header
>  			   (if (< score 0) "lower" "raise"))
> -		   (if (numberp match)
> -		       (int-to-string match)
> -		     match))))
> +                   (cond ((numberp match) (int-to-string match))
> +                         ((string= header "date")
> +                          (int-to-string
> +                           (-
> +                            (/ (car (time-convert (current-time) 1)) 86400)
> +                            (/ (car (time-convert (gnus-date-get-time match) 1))
> +                               86400))))
> +                         (t match)))))
>
>      ;; If this is an integer comparison, we transform from string to int.
>      (if (eq (nth 2 (assoc header gnus-header-index)) 'gnus-score-integer)
> --
> 2.39.3 (Apple Git-145)
>
> The patch should be correctly indented even though it doesn't look like
> it is. The reason is that previous lines contain mixture of tabs and
> spaces.

Looks good! I've pushed, and am closing this bug, thanks.

Subject: 28.2; Gnus - "Date" scoring scores all articles.
From: Kamil Jońca <[email-masked]>
To: [email-masked]
Date: Sun, 22 Jan 2023 09:30:17 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

(I do not know if emacs list is the best one. If gnus have dedicated
list please tell me)

I have to resubscribe some of my groups.
As I know that most of articles I have read already, I wanted to score
them lower before first of January. But it seems that always all
articles are marked as scored:
key sequence

C-u
1
L
d
b
t
Tue, 16 Jul 2019 09:20:31 +0000 (UTC)

All articles are  marked as scored.
I would expect that only these before 16 jul 2019 will be marked.

In GNU Emacs 28.2 (build 2, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw3d scroll bars)
 of 2022-12-20, modified by Debian built on x86-csail-01
Windowing system distributor 'The X.Org Foundation', version 11.0.12101005
System Description: Debian GNU/Linux bookworm/sid

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/libexec
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-libsystemd --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/28.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/28.2/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils
 --with-native-compilation --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/libexec
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-libsystemd --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/28.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/28.2/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils
 --with-native-compilation --with-x=yes --with-x-toolkit=lucid
 --with-toolkit-scroll-bars --without-gsettings 'CFLAGS=-g -O2
 -ffile-prefix-map=/build/emacs-OltuXQ/emacs-28.2+1=. -fstack-protector-strong
 -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM HARFBUZZ JPEG JSON LCMS2
LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS
X11 XAW3D XDBE XIM XPM LUCID ZLIB

Important settings:
  value of $LC_MESSAGES: en_GB.utf8
  value of $LC_TIME: C
  value of $LANG: pl_PL.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Group

Minor modes in effect:
  gnus-topic-mode: t
  shell-dirtrack-mode: t
  gnus-undo-mode: t
  desktop-save-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
/usr/share/emacs/site-lisp/elpa/fsm-0.2.1/fsm hides /usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/fsm
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/srv hides /usr/share/emacs/site-lisp/elpa/srv-0.2/srv
/usr/share/emacs/site-lisp/elpa/fsm-0.2.1/fsm-pkg hides /usr/share/emacs/site-lisp/elpa-src/fsm-0.2.1/fsm-pkg
/usr/share/emacs/site-lisp/elpa/fsm-0.2.1/fsm-autoloads hides /usr/share/emacs/site-lisp/elpa-src/fsm-0.2.1/fsm-autoloads
/usr/share/emacs/site-lisp/elpa/fsm-0.2.1/fsm hides /usr/share/emacs/site-lisp/elpa-src/fsm-0.2.1/fsm
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-wmii hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-wmii
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/srv hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/srv
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-festival hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-festival
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-screen hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-screen
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-ratpoison hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-ratpoison
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-gmail hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-gmail
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-autoloads hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-autoloads
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-httpupload hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-httpupload
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-libnotify hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-libnotify
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-awesome hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-awesome
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-notifications hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-notifications
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-xmessage hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-xmessage
/usr/share/emacs/site-lisp/elpa/fsm-0.2.1/fsm hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/fsm
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-ourversion hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-ourversion
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-pkg hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-pkg
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-sawfish hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-sawfish
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/hexrgb hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/hexrgb
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/jabber-tmux hides /usr/share/emacs/site-lisp/elpa-src/jabber-0.8.9999snapshot1569/jabber-tmux
/usr/share/emacs/site-lisp/elpa/jabber-0.8.9999snapshot1569/srv hides /usr/share/emacs/site-lisp/elpa-src/srv-0.2/srv
/usr/share/emacs/site-lisp/elpa/srv-0.2/srv-autoloads hides /usr/share/emacs/site-lisp/elpa-src/srv-0.2/srv-autoloads
/usr/share/emacs/site-lisp/elpa/srv-0.2/srv-pkg hides /usr/share/emacs/site-lisp/elpa-src/srv-0.2/srv-pkg
/usr/share/emacs/site-lisp/flim/sasl hides /usr/share/emacs/28.2/lisp/net/sasl
/usr/share/emacs/site-lisp/sieve-mode hides /usr/share/emacs/28.2/lisp/net/sieve-mode

Features:
(shadow emacsbug sendmail appt w3m-form w3m-bookmark w3m timezone
w3m-hist w3m-fb bookmark-w3m w3m-ems w3m-favicon w3m-image tab-line
w3m-proc w3m-util sort gnus-cite flow-fill mm-archive mail-extr
gnus-bcklg gnus-cus comp comp-cstr gnus-async qp gnus-ml disp-table
gnus-topic nndraft nnmh utf-7 rfc2104 network-stream nsm gnus-agent
gnus-srvr gnus-score nnvirtual gnus-msg nntp gnus-cache cus-start
add-log spamassassin-mode skeleton score-mode diary-lib diary-loaddefs
m4-mode vc-bzr mule-util info mhtml-mode css-mode color nroff-mode
rng-xsd xsd-regexp rng-cmpct js imenu fetchmail-mode make-mode autoconf
autoconf-mode rng-nxml rng-valid rng-loc rng-uri rng-parse nxml-parse
rng-match rng-dt rng-util rng-pttrn nxml-ns nxml-mode nxml-outln
nxml-rap sgml-mode facemenu nxml-util nxml-enc xmltok vc-dir ewoc vc
edmacro kmacro pylint compile python tramp-sh tramp tramp-loaddefs
trampver tramp-integration files-x tramp-compat shell ls-lisp perl-mode
reveal sieve-mode org-element avl-tree generator ol-eww eww xdg
url-queue mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect
gnus-search eieio-opt cl-extra help-mode speedbar ezimage dframe
gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum shr kinsoku
svg dom gnus-group gnus-undo gnus-start gnus-dbus dbus xml gnus-cloud
nnimap nnmail mail-source utf7 netrc nnoo parse-time gnus-spec gnus-int
gnus-range message rmc puny rfc822 mml mml-sec epa derived epg rfc6068
epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader gnus-win ol-docview doc-view image-mode exif
ol-bibtex ol-bbdb ol-w3m ol-doi org-link-doi org ob ob-tangle ob-ref
ob-lob ob-table ob-exp org-macro org-footnote org-src ob-comint
org-pcomplete pcomplete org-list org-faces org-entities noutline outline
org-version ob-emacs-lisp ob-core ob-eval org-table oc-basic bibtex
iso8601 ol rx org-keys oc org-compat advice org-macs org-loaddefs
format-spec find-func cal-menu calendar cal-loaddefs conf-mode
muttrc-mode man cc-awk cc-mode cc-guess cc-menus cc-cmds cc-styles
cc-align jka-compr sql view thingatpt comint ansi-color ring dired-aux
dired dired-loaddefs vc-git diff-mode easy-mmode vc-dispatcher sh-script
smie executable server eudcb-ldap ldap eudc eudc-options-file cus-edit
pp eudc-vars nnir cc-fonts cc-engine cc-vars cc-defs yaml-mode warnings
gnus nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums
text-property-search time-date mail-utils mm-util mail-prsvr wid-edit
desktop frameset cus-load finder-inf w3m-load package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map
url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib
iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting font-render-setting cairo x-toolkit x
multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 1160502 145690)
 (symbols 48 41607 5)
 (strings 32 164870 28136)
 (string-bytes 1 5503368)
 (vectors 16 79426)
 (vector-slots 8 2023882 82342)
 (floats 8 484 404)
 (intervals 56 79344 393)
 (buffers 992 956))

-- 
http://stopstopnop.pl/stop_stopnop.pl_o_nas.html