Stifler6996/apt-mirror

Config file mirror lines sensitive to spacing within sections

Closed this issue · 4 comments

deb-armhf http://mirror.aarnet.edu.au/pub/raspbian/raspbian [ONE Separator] bullseye [Multiple Separators allowed] main firmware contrib non-free rpi

Then in this part of the line main firmware contrib non-free rpi it must only contain 1 separator between each item.

Between URL and repository name MUST BE ONE Separator.
Between repository name and sections can be multiple Separators, spaces/tabs (but not both).
Between each section being mirrored, MUST BE ONE Separator.

Does this need fixing? Or does this just need documentation/clarification in the conf file?

Seems like #8 was identifying this problem, compounded by spreading sections across lines (not expected, and most likely unhandled by code).

Hi,

I am surprised that so little people use a local apt-mirror as it is great and super fast, despite the org apt-mirror software is no longer maintained.

I only see your and steamboatid making an effort on updating the original version for focal etc.

As said, I lost 1TB data, in the cleanup after it failed to understand the config file with extra spaces
Again, no hard feelings, its not unique data, just takes days waiting time / unavailability, and naturally just then we needed the mirror :-)

To use this operationally, we cant afford to loose the complete mirror for days due to a tiny space mistake, so even ended up with a local mirror of the local mirror as hot standby and regularly ffsync the huge data-set manually on another disk and host.

So for now, went back to the original apt-mirror as both your and steamboatid version did not work well (yet), and decided to stay on bionic/buster/debian10/etc for all systems with the original apt-mirror, working perfectly.

Feeling the urge to upgrade to Focal/Bullseye/Debian-11, trying to get the steamboatid version to work, failed until now, so checked here on progress :-)

So, you should consider to allow/check for spaces and abort/not let it not lead to a complete wipe.

Roger

I understand your points, and I (or someone else who is willing) may look at the config handling at some point.
However, apt-mirror works perfectly fine, so long as you are aware that "prettyfying" the config is unhandled.

As I said, this bug must have existed for a long time, before I came along. The "original apt-mirror" you say you use must have this bug also. You don't say exactly what you mean by original, so I cannot be sure.
If you mean the one you get from doing an apt install apt-mirror then its possible there have been changes between the packaging and release, compared to the github when I forked it.
If you are talking about getting it from the original github repo, then it is exactly the same as the one I started with, and must have the same bug.

Ah that explains it a bit.

I indeed run apt-mirror inside a docker container using Ubuntu and standard apt-install
I was already thinking about copying the config, removing all double spaces, replace tabs with space, perhaps case also, etc etc, then process

Ill give it a try in the coming weeks.

OK, thanks for the explanation

note to self:
qr/^[ \t]*(?<type>deb-src|deb)(?:-(?<arch>[\w\-]+))?[ \t]+(?:\[(?<options>[^\]]+)\][ \t]+)?(?<uri>[^\s]+)[ \t]+(?<components>.*)$/

will work better, but not completely perfect.