winpax / sfsu

(WIP) A modern, and very very fast, implementation of Scoop
Apache License 2.0
121 stars 7 forks source link

search: cannot find package (which scoop search finds) #714

Closed PAStheLoD closed 2 months ago

PAStheLoD commented 2 months ago

Describe the bug

searching for bun does not find the bun manifest from "main" bucket

Steps to To Reproduce

sfsu search bun

Expected behavior

Output includes

'main' bucket:
  bun (1.1.7)

Full Output

~> sfsu search 'bun'                                                                                 2024-05-05 20:17:44
'nerd-fonts' bucket:
  Ubuntu-NF-Mono (3.2.1)
  Ubuntu-NF-Propo (3.2.1)
  Ubuntu-NF (3.2.1)
  UbuntuMono-NF-Mono (3.2.1)
  UbuntuMono-NF-Propo (3.2.1)
  UbuntuMono-NF (3.2.1)
  UbuntuSans-NF-Mono (3.2.1)
  UbuntuSans-NF-Propo (3.2.1)
  UbuntuSans-NF (3.2.1)

'versions' bucket:
  bun-canary (1.1.7-canary.1+72bc2585e)

Version

1.11.0

Additional context

quite possible unrelated, but sfsu checkup gives a strange error:

Error: Internal Windows API Error: the system cannot find the file specified 0x80070002

result of scoop search bun

 scoop search bun                                                                                         2024-05-05 20:24:54
MethodInvocationException: C:\Users\Tibi\scoop\apps\scoop\current\libexec\scoop-search.ps1:68
Line |
  68 |          $json = [System.Text.Json.JsonDocument]::Parse([System.IO.Fil …
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Exception calling "Parse" with "1" argument(s): "'0x0D' is invalid within a JSON string. The string should be correctly
     | escaped. LineNumber: 10 | BytePositionInLine: 48."
MethodInvocationException: C:\Users\Tibi\scoop\apps\scoop\current\libexec\scoop-search.ps1:68
Line |
  68 |          $json = [System.Text.Json.JsonDocument]::Parse([System.IO.Fil …
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Exception calling "Parse" with "1" argument(s): "'0x0D' is invalid within a JSON string. The string should be correctly
     | escaped. LineNumber: 10 | BytePositionInLine: 48."
Results from local buckets...

Name                Version                  Source     Binaries
----                -------                  ------     --------
bun                 1.1.7                    main
busybox             5301-gda71f7c57          main       bunzip2
bzip2               1.0.8.0                  main       bunzip2.exe
gow                 0.8.0                    main       bunzip2.exe
unxutils            2007.03.01               main       bunzip2.exe
cfssl               1.6.5                    extras     cfssl-bundle.exe | mkbundle.exe
bun-canary          1.1.7-canary.1+72bc2585e versions
Sarabun             nightly                  nerd-fonts
Ubuntu-NF-Mono      3.2.1                    nerd-fonts
Ubuntu-NF-Propo     3.2.1                    nerd-fonts
Ubuntu-NF           3.2.1                    nerd-fonts
UbuntuMono-NF-Mono  3.2.1                    nerd-fonts
UbuntuMono-NF-Propo 3.2.1                    nerd-fonts
UbuntuMono-NF       3.2.1                    nerd-fonts
UbuntuSans-NF-Mono  3.2.1                    nerd-fonts
UbuntuSans-NF-Propo 3.2.1                    nerd-fonts
UbuntuSans-NF       3.2.1                    nerd-fonts

also, using -m both indicates that the main bucket is searched:

~> sfsu search -m both bun

'main' bucket:
  busybox (5301-gda71f7c57)
    bunzip2
    bunzip2

  bzip2 (1.0.8.0)
    bunzip2.exe

  gow (0.8.0)
    bin\bunzip2.exe

// ...

also thanks for writing sfsu, it's great!

PAStheLoD commented 2 months ago

Hm, after patching crates/sprinkles/src/buckets.rs Bucket::matches() it seems that there's some error during parsing the manifest.

eager_name_matches returns true, but then the error is silently ignored.

~> cargo run search -m name bun

bucket: "main", manifest name: "bun"    , search_regex: Regex("(?i)bun")

err!! .. :o  ParsingManifest("C:\\Users\\Tibi\\scoop\\buckets\\main\\bucket\\bun.json", Error("invalid type: sequence, expected a string", line: 11, column: 19))

ah, after editing bun.json it's clear that sfsu currently cannot parse manifests with multiple download URLs and checksum hashes for them.

probably the hash and url fields of the InstallConfig struct also need to be StringArray enums? (Blindly replacing the types leads to ... pikachu surprise ... compile time errors!)

jewlexx commented 2 months ago

Thanks for reporting this. I recently changed the manifest to use a single string under the impression that there weren't any manifests using multiple urls/hashes.

This change was reverted in #672, and this should work again after that PR is merged.