FS#47002 - Pacman could handle braindead router/ISP behaviour better

Attached to Project: Pacman
Opened by Rob Miles (robertskmiles) - Sunday, 08 November 2015, 14:54 GMT
Last edited by Andrew Gregory (andrewgregory) - Sunday, 08 November 2015, 21:44 GMT
Task Type Feature Request
Category General
Status Closed
Assigned To No-one
Architecture All
Severity High
Priority Normal
Reported Version 4.2.1
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Summary and Info:

Certain routers have a very stupid behaviour where if they can't get an internet connection they will hijack HTTP requests and respond with their own HTML document which explains that they can't get an internet connection. Often this gives no programmatic indication that anything is wrong, i.e. they return an HTTP 200 OK code, but the content is this "friendly" html error document instead of what you requested. When using a browser, this behaviour means you put in google.com, and your browser shows a page saying the router can't connect, with google.com still in the address bar. When running a system upgrade with pacman, this behaviour causes problems up to and including (I believe) rendering the system unbootable. With an intermittent internet connection, some proportion of all the requests pacman makes during the upgrade come back containing completely the wrong content, with no indication to pacman that there's any problem.

I discovered this when I chrooted into my unbootable system and found pacman throwing errors because /var/lib/pacman/sync/core.db, community.db, extra.db etc. were all just copies of this stupid HTML file. I was able to fix it just by doing another upgrade with a working internet connection.

Clearly this is the router's fault, not pacman's, so I've entered it as a feature request rather than a bug. Still, it would be nice if pacman could handle the router's failings more gracefully, by trusting the network a little less. Perhaps it could keep the old version of files it's replacing, and when it gets the new file over the network, run a quick check to make sure what it got remotely resembles what it expected, before it deletes the old file. If the new file fails the check, pacman can use whatever error handling code it already has for network problems. I don't think pacman is ever trying to download HTML files, so it doesn't have to be a costly file integrity check, just looking at the first few bytes should do it. Maybe just running the 'file' utility?

I've listed this as 'high' severity rather than 'critical', because I'm not completely certain that this was the cause of my system failing to boot. I'm afraid I don't have time to try to reproduce it and make sure.

Steps to Reproduce:

1. Have a stupid crappy router (like a BT Home Hub)
2. Have intermittent internet connection problems (which should be easy with BT)
3. Run a system update with pacman (pacman -Syuu?)
4. (optional) Reboot
This task depends upon

Closed by  Andrew Gregory (andrewgregory)
Sunday, 08 November 2015, 21:44 GMT
Reason for closing:  Duplicate
Additional comments about closing:  FS#46107
Comment by Allan McRae (Allan) - Sunday, 08 November 2015, 15:35 GMT
There is no possibility that this ends in a non-bootable system. Pacman will change no system files in this case.

Loading...