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

RPM is not readable by rpmlint #89

Closed
rakus opened this issue Jul 14, 2023 · 4 comments · Fixed by #83
Closed

RPM is not readable by rpmlint #89

rakus opened this issue Jul 14, 2023 · 4 comments · Fixed by #83

Comments

@rakus
Copy link

rakus commented Jul 14, 2023

A RPM created with cargo generate-rpm is installable, but cannot be investigated with rpmlint.

$ rpmlint target/generate-rpm/hello-world-0.1.0-1.x86_64.rpm 
(none): E: fatal error while reading target/generate-rpm/hello-world-0.1.0-1.x86_64.rpm: list index out of range

With verbose output, the following is printed:

$ rpmlint -v target/generate-rpm/hello-world-0.1.0-1.x86_64.rpm 
files over 4GB not supported by cpio, use rpm2archive instead
cpio: premature end of archive
(none): E: fatal error while reading target/generate-rpm/hello-world-0.1.0-1.x86_64.rpm: list index out of range
Traceback (most recent call last):
  File "/bin/rpmlint", line 8, in <module>
    sys.exit(lint())
             ^^^^^^
  File "/usr/lib/python3.11/site-packages/rpmlint/cli.py", line 177, in lint
    sys.exit(lint.run())
             ^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/rpmlint/lint.py", line 105, in run
    return self._run()
           ^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/rpmlint/lint.py", line 76, in _run
    self.validate_files(self.options['rpmfile'])
  File "/usr/lib/python3.11/site-packages/rpmlint/lint.py", line 237, in validate_files
    self.validate_file(pkg, pkg == packages[-1])
  File "/usr/lib/python3.11/site-packages/rpmlint/lint.py", line 261, in validate_file
    raise e
  File "/usr/lib/python3.11/site-packages/rpmlint/lint.py", line 251, in validate_file
    with Pkg(pname, self.config.configuration['ExtractDir'],
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/rpmlint/pkg.py", line 423, in __init__
    self.files = self._gather_files_info()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/rpmlint/pkg.py", line 576, in _gather_files_info
    pkgfile.size = sizes[idx]
                   ~~~~~^^^^^
IndexError: list index out of range

To reproduce:
Create a new project using cargo new hello-world. Then adjust the Cargo.toml like this:

[package]
name = "hello-world"
version = "0.1.0"
edition = "2021"
authors = ["Cargo"]
description = "A hello-world program"
license = "MIT"
homepage = "https://my-hello-world.com"
repository = "https://github.com/fake/hello-world"

[package.metadata.generate-rpm]
assets = [
    { source = "target/release/hello-world", dest = "/usr/bin/hello-world", mode = "755" }
]

Finally generate the RPM and try to lint it with rpmlint.

Or am I'm doing something wrong here?


Environment:

  • Fedora 38
  • cargo 1.70.0 (ec8a8a0ca 2023-04-25)
  • cargo-generate-rpm 0.11.1
@rakus
Copy link
Author

rakus commented Jul 16, 2023

Just build and tested PR #83. This would solve the problem, due to using version 0.12.0 of the rpm crate.

The verbose error message above contains "files over 4GB not supported by cpio" and the changelog vor rpm 0.12.0 has this entry:

CentOS 7 support by using long sizes only for packages bigger than 4 GiB

Also this does not mention rpmlint or Fedora 38, rpm 0.12.0 seems to fix the problem.

Close this ticket or leave it open until #83 is merged?

@cat-in-136 cat-in-136 linked a pull request Jul 22, 2023 that will close this issue
@cat-in-136
Copy link
Owner

cat-in-136 commented Jul 22, 2023

Thank you for information. I've confirmed #83 fixes this issue.

Note that: we need to continue our efforts to reduce rpmlint warnings, bacause there is some feature missing in the rpm crate and my crate so lots of warnings in rpmlint shown as of now.

@dralley
Copy link

dralley commented Aug 6, 2023

Just dropping in to mention that we would welcome rpmlint tests being committed upstream rpm-rs/rpm#28

@cat-in-136 Is there anything blocking the associated PR from merging? Can it be merged?

@cat-in-136
Copy link
Owner

In the part that resolves this issue, #83 is fine. #83 is a PR that is also mixed with other issue resolutions, #83 is blocked by other issues.

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 a pull request may close this issue.

3 participants