plk/biber

method 'clone' error when multiple entries pointing to the same missing related

Neved4 opened this issue · 3 comments

Neved4 commented

Description

  • Fix Can't call method "clone" on an undefined value

When there are two entry keys of the form BookA and BookB that point to the same relatd entry Translated and is missing, it errors with:

Can't call method "clone" on an undefined value at
/var/folders/v5/hj_6p8f102zdt45chhn_x8n40000gn/T/par-79706d6f6c646573
/cache-e34ad03908a9c47f3411cdb5bf7054398afc2974/inc/lib/Biber/Entry.pm line 101.

The error dissappears by adding the Translated entry or by deleting one of either BookA or BookB.

I superficially understand how the error happens, even if not the underlying mechanism. I know that the .bib files should not be structured in this way, but sometimes you're handled big databases you have no control over. How do you feel about biber handling this by emitting a nicer WARN / ERR, to better guide the user towards a solution?

MWE

test.bib:

@book{HPSGHandbookA,
  author    = {Stefan Müller},
  title     = {Head-Driven Phrase Structure Grammar},
  date      = {2020},
  address   = {Berlin},
  publisher = {Language Science Press},
  related   = {AC2020a},
}

@book{HPSGHandbookB,
  author    = {Stefan Müller},
  title     = {Head-Driven Phrase Structure Grammar},
  date      = {2020},
  address   = {Berlin},
  publisher = {Language Science Press},
  related   = {AC2020a},
}

test.tex:

\documentclass{article}
\usepackage{biblatex}
  \addbibresource{test.bib}

\begin{document}
  \nocite{*}
  \printbibliography
\end{document}

Compiling with latexmk -pdf test.tex, it outputs the error above.

Ways to fix it would be to either test2.bib:

@book{Translated,
  author   = {Anne Abeillé and Rui P. Chaves},
  title    = {Coordination},
}

@book{HPSGHandbookA,
  author    = {Stefan Müller},
  title     = {Head-Driven Phrase Structure Grammar},
  date      = {2020},
  address   = {Berlin},
  publisher = {Language Science Press},
  related   = {AC2020a},
}

@book{HPSGHandbookB,
  author    = {Stefan Müller},
  title     = {Head-Driven Phrase Structure Grammar},
  date      = {2020},
  address   = {Berlin},
  publisher = {Language Science Press},
  related   = {AC2020a},
}

Or test3.bib:

@book{HPSGHandbookA,
  author    = {Stefan Müller},
  title     = {Head-Driven Phrase Structure Grammar},
  date      = {2020},
  address   = {Berlin},
  publisher = {Language Science Press},
  related   = {AC2020a},
}

Additional details

Setup Version
macOS 13.3.1
TeX Live 2023
biber 2.19
biblatex 2.19
plk commented

This is fixed in 2.20 DEV branch and in 2.20 development binaries on SF.

Neved4 commented

I had no idea! I just had stumbled upon this, thx lots for replying as always. Do you want me to close it?

plk commented

I will close.