rickysarraf / apt-offline

Offline APT Package Manager
http://rickysarraf.github.io/apt-offline/
GNU General Public License v3.0
219 stars 37 forks source link

ValueError: too many values to unpack (expected 4) #214

Closed tushev closed 1 year ago

tushev commented 1 year ago

Online system:

Offline system:

Output from online system when using release v1.8.5 on both systems:

root@WSL:~/apt-offline$ ./apt-offline get /mnt/flash/aptoffline/i386.sig --bundle /mnt/flash/aptoffline/bundle.zip --verbose
VERBOSE: Namespace(verbose=True, quiet=False, get='/mnt/flash/aptoffline/i386.sig', socket_timeout=30, download_dir=None, cache_dir=None, disable_md5check=False, num_of_threads=1, bundle_file='/mnt/flash/aptoffline/bundle.zip', deb_bugs=False, proxy_host=None, proxy_port=None, https_cert_file=None, https_key_file=None, http_basicauth=[], disable_cert_check=False, func=<function fetcher at 0x7f17c807b370>)
VERBOSE: Default timeout now is: 30.

Fetching APT Data

VERBOSE: Item before split is: 'cdrom:[Debian GNU/Linux 11.7.0 _Bullseye_ - Official i386 DVD Binary-1 20230429-11:50]/dists/bullseye/InRelease' Debian%20GNU_Linux%2011.7.0%20%5fBullseye%5f%20-%20Official%20i386%20DVD%20Binary-1%2020230429-11:50_dists_bullseye_InRelease 0

Traceback (most recent call last):
  File "/root/apt-offline/apt_offline_core/AptOfflineCoreLib.py", line 864, in stripper
    url, localFile, size, checksum = item.split(' ')
ValueError: too many values to unpack (expected 4)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/apt-offline/./apt-offline", line 28, in <module>
    main()
  File "/root/apt-offline/apt_offline_core/AptOfflineCoreLib.py", line 2503, in main
    args.func(args)
  File "/root/apt-offline/apt_offline_core/AptOfflineCoreLib.py", line 1253, in fetcher
    (ItemURL, ItemFile, ItemSize, ItemChecksum) = stripper(item)
  File "/root/apt-offline/apt_offline_core/AptOfflineCoreLib.py", line 868, in stripper
    url, localFile, size = item.split(' ')
ValueError: too many values to unpack (expected 3)

Contents of i386.sig:

'cdrom:[Debian GNU/Linux 11.7.0 _Bullseye_ - Official i386 DVD Binary-1 20230429-11:50]/dists/bullseye/InRelease' Debian%20GNU_Linux%2011.7.0%20%5fBullseye%5f%20-%20Official%20i386%20DVD%20Binary-1%2020230429-11:50_dists_bullseye_InRelease 0 
'cdrom:[Debian GNU/Linux 11.7.0 _Bullseye_ - Official i386 DVD Binary-1 20230429-11:50]/dists/bullseye/contrib/binary-i386/Packages.xz' Debian%20GNU_Linux%2011.7.0%20%5fBullseye%5f%20-%20Official%20i386%20DVD%20Binary-1%2020230429-11:50_dists_bullseye_contrib_binary-i386_Packages 0 
'cdrom:[Debian GNU/Linux 11.7.0 _Bullseye_ - Official i386 DVD Binary-1 20230429-11:50]/dists/bullseye/contrib/binary-all/Packages.xz' Debian%20GNU_Linux%2011.7.0%20%5fBullseye%5f%20-%20Official%20i386%20DVD%20Binary-1%2020230429-11:50_dists_bullseye_contrib_binary-all_Packages 0 
'cdrom:[Debian GNU/Linux 11.7.0 _Bullseye_ - Official i386 DVD Binary-1 20230429-11:50]/dists/bullseye/contrib/i18n/Translation-en_US.xz' Debian%20GNU_Linux%2011.7.0%20%5fBullseye%5f%20-%20Official%20i386%20DVD%20Binary-1%2020230429-11:50_dists_bullseye_contrib_i18n_Translation-en%5fUS 0 
'cdrom:[Debian GNU/Linux 11.7.0 _Bullseye_ - Official i386 DVD Binary-1 20230429-11:50]/dists/bullseye/contrib/i18n/Translation-en.xz' Debian%20GNU_Linux%2011.7.0%20%5fBullseye%5f%20-%20Official%20i386%20DVD%20Binary-1%2020230429-11:50_dists_bullseye_contrib_i18n_Translation-en 0 
'cdrom:[Debian GNU/Linux 11.7.0 _Bullseye_ - Official i386 DVD Binary-1 20230429-11:50]/dists/bullseye/main/binary-i386/Packages.xz' Debian%20GNU_Linux%2011.7.0%20%5fBullseye%5f%20-%20Official%20i386%20DVD%20Binary-1%2020230429-11:50_dists_bullseye_main_binary-i386_Packages 0 
'cdrom:[Debian GNU/Linux 11.7.0 _Bullseye_ - Official i386 DVD Binary-1 20230429-11:50]/dists/bullseye/main/binary-all/Packages.xz' Debian%20GNU_Linux%2011.7.0%20%5fBullseye%5f%20-%20Official%20i386%20DVD%20Binary-1%2020230429-11:50_dists_bullseye_main_binary-all_Packages 0 
'cdrom:[Debian GNU/Linux 11.7.0 _Bullseye_ - Official i386 DVD Binary-1 20230429-11:50]/dists/bullseye/main/i18n/Translation-en_US.xz' Debian%20GNU_Linux%2011.7.0%20%5fBullseye%5f%20-%20Official%20i386%20DVD%20Binary-1%2020230429-11:50_dists_bullseye_main_i18n_Translation-en%5fUS 0 
'cdrom:[Debian GNU/Linux 11.7.0 _Bullseye_ - Official i386 DVD Binary-1 20230429-11:50]/dists/bullseye/main/i18n/Translation-en.xz' Debian%20GNU_Linux%2011.7.0%20%5fBullseye%5f%20-%20Official%20i386%20DVD%20Binary-1%2020230429-11:50_dists_bullseye_main_i18n_Translation-en 0 

^ note the newline at the end.

Could you please fix it?

tushev commented 1 year ago

UPDATE: modified /etc/apt/sources.list: commented out cdrom, uncommented http:// lines (on offline system).

Seems to be working.

Anyway, I suppose it would be better to add at least a proper error message for this case; ideally - to suggest to resolve this automatically.

rickysarraf commented 1 year ago

Thank you for reporting it. Yes. This condition should be handled

tushev commented 1 year ago

@rickysarraf and as a follow-on: I re-enabled cdrom "repo" on offline system, and got the same issue again.

I suppose, the ideal solution would be to exclude cdrom lines in /etc/apt/sources.list on offline system in the very beginning and show a notice (like in case with This is usually the case when the underneath apt system has no payload to download).

Thank you very much for your time and your wonderful tool!

rickysarraf commented 1 year ago

@rickysarraf and as a follow-on: I re-enabled cdrom "repo" on offline system, and got the same issue again.

Yes. apt-offline should be able to handle all kinds on input fed. Even a malformed signature file.

I suppose, the ideal solution would be to exclude cdrom lines in /etc/apt/sources.list on offline system in the very beginning and show a notice (like in case with This is usually the case when the underneath apt system has no payload to download).

Thank you very much for your time and your wonderful tool!

That we can't control. People can have legacy systems. There are also derivatives that add their own bling. etc. etc.

The ideal solution is to keep being more resilient.

tushev commented 1 year ago

Thanks!