manjaro / pacman-mirrors

This repo has been archived. Our code is now hosted at
https://gitlab.manjaro.org
GNU General Public License v3.0
25 stars 16 forks source link

Pacman-mirrors Interactive mode brocken #123

Closed scachemaille closed 6 years ago

scachemaille commented 6 years ago

I just tried sudo pacman-mirros -i and it seems broken. I have the following error:

   0.339 Germany        : https://mirror.philpot.de/manjaro/
   0.134 Germany        : http://mirror.philpot.de/manjaro/
Traceback (most recent call last):
  File "/usr/bin/pacman-mirrors", line 57, in <module>
    pm.run()
  File "/usr/lib/python3.6/site-packages/pacman_mirrors/pacman_mirrors.py", line 912, in run
    self.build_interactive_mirror_list()
  File "/usr/lib/python3.6/site-packages/pacman_mirrors/pacman_mirrors.py", line 609, in build_interactive_mirror_list
    self.default)
  File "/usr/lib/python3.6/site-packages/pacman_mirrors/dialogs/graphicalui.py", line 160, in run
    window = GraphicalUI(server_list, random, default)
  File "/usr/lib/python3.6/site-packages/pacman_mirrors/dialogs/graphicalui.py", line 54, in __init__
    "{}h {}m".format(server["last_sync"][:2],
TypeError: 'int' object is not subscriptable

pacman-mirrors 4.7.5-1

Skycoder42 commented 6 years ago

Can confirm this with 4.7.6-2 as well. It's excatly the same error.

petsam commented 6 years ago

Same error Version 4.7.6

fhdk commented 6 years ago
File "/usr/lib/python3.6/site-packages/pacman_mirrors/dialogs/graphicalui.py", line 54, in __init__
    "{}h {}m".format(server["last_sync"][:2]

This lead me to think that some data is missing in the status.json file.

Under which conditions does the error occur?

When the error occurs what is the content of custom-mirrors.json (if any) and status.json from /var/lib/pacman-mirrors?

I cant reproduce it.

pacman-mirrors-interactive

Skycoder42 commented 6 years ago

Here are my files, right after running sudo pacmam-mirrors -i. I also added pacman-mirrors.conf.

fhdk commented 6 years ago

Your pacman-mirrors.conf contains invalid settings. The current valid configuration is here

The other files is OK.

Using the command mentioned in OP

sudo pacman-mirrors -i

I cannot reproduce the issue. Not even with a full mirror pool. (pacman-mirrors -c all)

petsam commented 6 years ago

My pacman-mirrors.conf

##
#/etc/pacman-mirrors.conf
##

#Branch Pacman should use (stable, testing, unstable)
Branch = testing

#Generation method
#1) rank   - rank mirrors depending on their access time
#2) random - randomly generate the output mirrorlist
Method = rank

#Define protocols and priority
#  separated by comma 'https,http' or 'http,https'
#ATM available protocols are: http, https, ftp
#Not specifying a protocol will ban the protocol from being used
#If a mirror has more than one protocol defined only the first is written to the mirrorlist
#Empty means all in reversed alphabetic order
Protocols =

#Get a list of all available counties with 'pacman-mirrors -l'
#Value can be 'Custom' or nothing which means all
# OnlyCountry = 

#When set to False - all certificates are accepted.
#Use only if you fully trust all ssl-enabled mirrors.
SSLVerify = True
fhdk commented 6 years ago

@Skycoder42

right after running sudo pacmam-mirrors -i

Could you copy status.json and custom-mirrors.json before you it?

fhdk commented 6 years ago

@Skycoder42 Are you running on Wayland?

Is it on TTY?

xircon commented 6 years ago

Same error. Plasma xorg. first.zip second.zip

First - before interactive Second - After.

xircon commented 6 years ago

Just updated to pacman-mirrors-4.8.1-3 - still crashing in interactive mode.

fhdk commented 6 years ago

@xircon Could you post the error message from 4.8.1-3?

commonsourcecs commented 6 years ago

v. 4.7.6-2 Failing for me with this return:

Traceback (most recent call last):
  File "/usr/bin/pacman-mirrors", line 57, in <module>
    pm.run()
  File "/usr/lib/python3.6/site-packages/pacman_mirrors/pacman_mirrors.py", line 912, in run
    self.build_interactive_mirror_list()
  File "/usr/lib/python3.6/site-packages/pacman_mirrors/pacman_mirrors.py", line 609, in build_interactive_mirror_list
    self.default)
  File "/usr/lib/python3.6/site-packages/pacman_mirrors/dialogs/graphicalui.py", line 160, in run
    window = GraphicalUI(server_list, random, default)
  File "/usr/lib/python3.6/site-packages/pacman_mirrors/dialogs/graphicalui.py", line 54, in __init__
    "{}h {}m".format(server["last_sync"][:2],
TypeError: 'int' object is not subscriptable

pacman-mirrors.tar.gz I had run '-i' before creating the first archive already, but here is one after command fail again: pacman-mirrors2.tar.gz

fhdk commented 6 years ago

@xircon @commonsourcecs

That is most weird - that code does not existin 4.8.1

File "/usr/lib/python3.6/site-packages/pacman_mirrors/dialogs/graphicalui.py", line 54, in __init__
    "{}h {}m".format(server["last_sync"][:2],

https://github.com/manjaro/pacman-mirrors/blob/0ab1f1c438eeed43fa96616d3e07c2deff9e75bc/pacman_mirrors/dialogs/graphicalui.py#L49-L58

commonsourcecs commented 6 years ago

Found source for me. '-i' fails when there is any discrepancy in the list. In my region/list, there is one mirror currently Timed Out. To test, I switched to Netherlands (all mirrors active and synced to Testing). Then ran '-i' on its own again. That worked.

xircon commented 6 years ago

Had to nip out - 4.8.1-5 same problems - do you want the zip?

xircon commented 6 years ago

Yes, mirror times out:

   0.213 Germany        : https://mirror.netcologne.de/manjaro/
   ..... Germany        : https://repo.rhindon.net/manjaro/
   ..... Germany        : https://repo.stdout.net/manjaro/
.: ERROR [Errno -2] Name or service not known 'https://repo.stdout.net/manjaro/'

Could be the problem?

bogdancovaciu commented 6 years ago

Hello, Finally i'm here too, even if i feel that is way too overwhelming. Here are the files you requested on manjaro forum: pacman_mirrors_1.zip pacman_mirrors_2.zip

Are in the order you requested and hopefully helpful!

commonsourcecs commented 6 years ago

4.8.1-1 also Confirmed that '-i' fails with list containing 'Timed Out' mirrors but succeeds on list without. This can also be mitigated for lists with bad mirror, as long as another option is passed such as using -ic. It would appear -i needs help sorting or making sense of oddities in the list. (while simple '-a' seems deprecated now, '--api' or '-B' no longer works in 4.8.1-1 though)

fhdk commented 6 years ago

Yes - the api is my bad - I added some checks for any api related argument eg -B without the actual --api present - and it failed me. This has been corrected.

Skycoder42 commented 6 years ago

With version Version 4.8.1dev (4.8.1-6) the error message has changed a little:

Traceback (most recent call last):
  File "/usr/bin/pacman-mirrors", line 57, in <module>
    pm.run()
  File "/usr/lib/python3.6/site-packages/pacman_mirrors/pacman_mirrors.py", line 853, in run
    self.build_interactive_mirror_list()
  File "/usr/lib/python3.6/site-packages/pacman_mirrors/pacman_mirrors.py", line 585, in build_interactive_mirror_list
    interactive_list = mirrorFn.translate_pool_to_interactive(worklist)
  File "/usr/lib/python3.6/site-packages/pacman_mirrors/mirrors/mirrorFn.py", line 207, in translate_pool_to_interactive
    "last_sync": "{}h {}m".format(mirror["last_sync"][:2].replace(":", ""),
TypeError: 'int' object is not subscriptable

EDIT: I too have the mirror that times out. After removing the mirror from the custom-mirrors.json (or removing the file) it worked again (The speedtest before still tests the broken mirror, but as it is not the custom-mirrors.json it works fine). Note: The entry hat -1 for all 3 branches, so it was easy to find.

@fhdk Im using kwin with X11, not wayland. And yes, it's a normal graphical console, aka a tty. But as it seems the reson is are the broken custom mirrors.

fhdk commented 6 years ago

The issue has been solved with the release of 4.8.2

commonsourcecs commented 6 years ago

4.8.2-2

Traceback (most recent call last):
  File "/usr/bin/pacman-mirrors", line 57, in <module>
    pm.run()
  File "/usr/lib/python3.6/site-packages/pacman_mirrors/pacman_mirrors.py", line 853, in run
    self.build_interactive_mirror_list()
  File "/usr/lib/python3.6/site-packages/pacman_mirrors/pacman_mirrors.py", line 585, in build_interactive_mirror_list
    interactive_list = mirrorFn.translate_pool_to_interactive(worklist)
  File "/usr/lib/python3.6/site-packages/pacman_mirrors/mirrors/mirrorFn.py", line 213, in translate_pool_to_interactive
    "last_sync": "{}h {}m".format(mirror["last_sync"][:2].replace(":", ""),
TypeError: 'int' object is not subscriptable