#1051079 apt: When failing to parse .sources files, give more information in error messages

Package:
apt
Source:
apt
Description:
commandline package manager
Submitter:
Adam Baxter
Date:
2023-09-05 14:30:06 UTC
Severity:
normal
#1051079#5
Date:
2023-09-02 12:01:11 UTC
From:
To:
Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate ***

   * What led up to the situation?

I've made some kind of mistake in a deb822 .sources file. apt or some component of it can't parse the file and errors out
   * What exactly did you do (or not do) that was effective (or
     ineffective)?
Tried to write my own deb822 format file instead of just using sources.list and solving this hours ago :)

   * What was the outcome of this action?

$ apt update
E: Unable to parse package file /etc/apt/sources.list.d/grafana.sources (1)
E: The list of sources could not be read.

   * What outcome did you expect instead?

Either:
* Skipping the "bad" file and emitting a warning OR
* A precise error message - what is wrong at what line and character.


Note this also broke reportbug itself, see #1051077

*** End of the template - remove these template lines ***

#1051079#10
Date:
2023-09-02 12:21:04 UTC
From:
To:
Apologies - missed changing the version, I have also tested apt 2.7.3 in sid and got the same message.

Thanks,
Adam

#1051079#15
Date:
2023-09-05 14:28:45 UTC
From:
To:
Precise error messages really require rewriting all our parsers since we
don't really track line numbers, people didn't think of that when it was
written 30 years ago.

It's a problem in apt.conf and preferences, and everything basically.