Filtered lists (e.g. the shorthand list) get every set and set member re-added once any set passes the filter

Aperta Adatta ai principianti
#540 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@plk ci sta già lavorando.

Dal 2/11/2026.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
60/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
latex, perl
Ambito
backend

Direzione di ricerca

Il bug si trova nel blocco di riaggiunta dei membri dell'insieme in process_lists in lib/Biber.pm, intorno alle righe 3161-3170, dove il blocco first ignora $_. Riproducilo con l'esempio di lista shorthand (.bib e .tex) della issue e controlla \datalist[list]{shorthand:...} nell'output generato. È completato quando la lista shorthand contiene solo a, b, S1 e i test esistenti sotto t/ continuano a passare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Bug fixedindev

🤖 This issue was identified by Claude Opus 5.5, and the text below is entirely written by Claude Opus 5.5

After filtering a list, process_lists adds back the members of sets that passed the filter (Biber.pm:3164-3170 on dev; this was added in 2.20 for #457):

      my @sets = grep {$section->bibentry($_)->get_field('entrytype') eq 'set'} $flist->@*;
      foreach my $k ($list->get_keys->@*) {
        my $be = $section->bibentry($k);
        if (first {$be->get_field('entryset')} @sets) {
          push $flist->@*, $k;
        }
      }

The block passed to first doesn't use $_, so it is true for every entry that has an entryset field (every set, and every member of any set) as soon as @sets is non-empty. In the shorthand list below, only S1 has a shorthand, but S2, c and d are added too:

@set{S1, entryset = {a,b}, shorthand = {SH1}}
@set{S2, entryset = {c,d}}
@book{a, author = {Alpha, A.}, title = {TA}, year = {2000}}
@book{b, author = {Beta, B.},  title = {TB}, year = {2001}}
@book{c, author = {Gamma, C.}, title = {TC}, year = {2002}}
@book{d, author = {Delta, D.}, title = {TD}, year = {2003}}
@book{e, author = {Eps, E.},   title = {TE}, year = {2003}}
\documentclass{article}
\usepackage[style=authoryear]{biblatex}
\addbibresource{test.bib}
\begin{document}
\cite{S1,S2,e}
\printbiblist{shorthand}
\printbibliography
\end{document}

biber 2.22 and current dev (79a1edc) write S2, a, b, c, d, S1 into \datalist[list]{shorthand:…}; it should be a, b, S1. With first, a set key 0 would also count as "not found".

Suggested fix
--- a/lib/Biber.pm
+++ b/lib/Biber.pm
@@ -3161,10 +3161,11 @@
       }
 
       # Now add set members of sets which have not been filtered out
-      my @sets = grep {$section->bibentry($_)->get_field('entrytype') eq 'set'} $flist->@*;
+      my %sets = map {$_ => 1} grep {$section->bibentry($_)->get_field('entrytype') eq 'set'} $flist->@*;
       foreach my $k ($list->get_keys->@*) {
         my $be = $section->bibentry($k);
-        if (first {$be->get_field('entryset')} @sets) {
+        next if $be->get_field('entrytype') eq 'set'; # sets are filtered like other entries
+        if (grep {$sets{$_}} ($be->get_field('entryset') // [])->@*) {
           push $flist->@*, $k;
         }
       }

With this change the shorthand list contains a, b, S1. All tests in t/ pass on dev (79a1edc) with this patch, applied together with the others I'm filing alongside it.

Lingua principale
TeX
Stelle
397
Fork
42
Merge medio
8h 3m
PR unite (30g)
1

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di plk/biber

Tutte le issue di plk/biber

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.