Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(scanner/suse): skip new line in zyper -q lu #1986

Merged
merged 1 commit into from
Jul 4, 2024
Merged

Conversation

MaineK00n
Copy link
Collaborator

@MaineK00n MaineK00n commented Jul 4, 2024

If this Pull Request is work in progress, Add a prefix of “[WIP]” in the title.

What did you implement:

Fixes #1977

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

setup

$ git clone https://github.com/MaineK00n/vuls-targets.git
$ cd vuls-targets/suse/leap/15.6
$ vagrant up --provision
// TODO: add known_hosts

$ cat config.toml
[servers.vagrant]
host = "127.0.0.1"
port = "2222"
user = "vagrant"
keyPath = "/home/vuls/vuls-targets/.ssh/id_rsa"
scanMode           = ["fast-root"]
scanModules        = ["ospkg"]

before

$ vuls scan
[Jul  4 14:57:44]  INFO [localhost] vuls-v0.26.0-build-20240704_144346_ac55380
...
[Jul  4 14:57:47]  INFO [localhost] (1/1) vagrant is running on other
[Jul  4 14:57:47]  INFO [vagrant] Scanning OS pkg in fast-root mode
[Jul  4 14:57:48]  WARN [vagrant] err: Failed to scan updatable packages:
    github.com/future-architect/vuls/scanner.(*suse).scanPackages
        /home/mainek00n/github/github.com/MaineK00n/vuls/scanner/suse.go:192
  - zypper -q lu Unknown format: :
    github.com/future-architect/vuls/scanner.(*suse).parseZypperLUOneLine
        /home/mainek00n/github/github.com/MaineK00n/vuls/scanner/suse.go:249
[Jul  4 14:57:50]  WARN [localhost] Some warnings occurred during scanning on vagrant. Please fix the warnings to get a useful information. Execute configtest subcommand before scanning to know the cause of the warnings. warnings: [Failed to scan updatable packages:
    github.com/future-architect/vuls/scanner.(*suse).scanPackages
        /home/mainek00n/github/github.com/MaineK00n/vuls/scanner/suse.go:192
  - zypper -q lu Unknown format: :
    github.com/future-architect/vuls/scanner.(*suse).parseZypperLUOneLine
        /home/mainek00n/github/github.com/MaineK00n/vuls/scanner/suse.go:249]


Scan Summary
================
vagrant	opensuse.leap15.6	275 installed, 0 updatable

Warning: [Failed to scan updatable packages:
    github.com/future-architect/vuls/scanner.(*suse).scanPackages
        /home/mainek00n/github/github.com/MaineK00n/vuls/scanner/suse.go:192
  - zypper -q lu Unknown format: :
    github.com/future-architect/vuls/scanner.(*suse).parseZypperLUOneLine
        /home/mainek00n/github/github.com/MaineK00n/vuls/scanner/suse.go:249]



To view the detail, vuls tui is useful.
To send a report, run vuls report -h.

after

$ vuls scan
[Jul  4 14:59:39]  INFO [localhost] vuls-v0.26.0-build-20240704_145807_67df9ce
...
[Jul  4 14:59:41]  INFO [localhost] (1/1) vagrant is running on other
[Jul  4 14:59:41]  INFO [vagrant] Scanning OS pkg in fast-root mode


Scan Summary
================
vagrant	opensuse.leap15.6	275 installed, 122 updatable





To view the detail, vuls tui is useful.
To send a report, run vuls report -h.

Checklist:

You don't have to satisfy all of the following.

  • Write tests
  • Write documentation
  • Check that there aren't other open pull requests for the same issue/feature
  • Format your source code by make fmt
  • Pass the test by make test
  • Provide verification config / commands
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES

Reference

Copy link
Collaborator

@shino shino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎆

@MaineK00n MaineK00n merged commit 1333f3a into master Jul 4, 2024
7 checks passed
@MaineK00n MaineK00n deleted the MaineK00n/suse branch July 4, 2024 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

openSUSE Leap 15.6: zypper -q lu Unknown format
2 participants