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

Open Beginner friendly
#540 0 comments 0 reactions 1 assignee View on GitHub

@plk is already working on this.

Since Nov 2, 2026.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
60/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
latex, perl
Domain
backend

Research direction

The bug is in the set-member re-adding block of process_lists in lib/Biber.pm, around lines 3161-3170, where the first block ignores $_. Reproduce it with the shorthand-list .bib and .tex example from the issue and inspect \datalist[list]{shorthand:...} in the generated output. Done means the shorthand list contains only a, b, S1, and the existing tests under t/ still pass.

Written by the indexing model from the issue text.

Description

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.

Dominant language
TeX
Stars
396
Forks
40
Avg merge
8h 3m
Merged PRs (30d)
1

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from plk/biber

All issues in plk/biber

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.