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

The max lengthe of RPM package name is 66? #974

Closed
fbs2016 opened this issue Dec 11, 2019 · 7 comments
Closed

The max lengthe of RPM package name is 66? #974

fbs2016 opened this issue Dec 11, 2019 · 7 comments

Comments

@fbs2016
Copy link

fbs2016 commented Dec 11, 2019

From lib/rpmlead.c, I see the definatino "char name[66];", it means that the limit of the rpm package name length is 66?
I try to set it to a larger one like "98" in my code, it can generate the rpm package success but failed when I use rpm command to extract it.

@ffesti
Copy link
Contributor

ffesti commented Dec 12, 2019

The lead is not really the data that's being used and it is only there for legacy purpose. But RPM is expecting it to be in the format that is in the code. You can't just change that data structure. Also this field contains the NEVR of the package (Name:Epoch-Version-Release)
The actual name goes into the NAME tag.

Are you running into actual issues with a package with a long name? What error message do you see? And can you post the spec file of the package?

@fbs2016
Copy link
Author

fbs2016 commented Dec 19, 2019

Thanks, Festi. In fact, I use a java program which to create RPM package, which refer to an old RPM API (RPM 4.4.2).
I can use it to create a RPM package and use the standard RPM command to parser it, like rpm/rpm2cpio command.
I meet the name length limit problem when create RPM package, then I try to set the name length to a larger one, it success. But it failed when I try to extract the package using standard rpm2cpio comand:
error: rpm2cpio: illegal signature type
error reading header from package
cpio: premature end of archive

Does the standard rpmbuild command with version 4.4.2 also have the name length limit? And how to solve the the backward compatibility on the latest rpm command?

@ffesti
Copy link
Contributor

ffesti commented Dec 19, 2019

No, the package name should not be limited. It looks like there is a bug in the code creating the lead. But it is hard to tell where exactly this is. If your Java program is creating the package directly without creating a spec file and then running rpmbuild I would advice checking the code that creates the lead in there. If it does create a spec it might be a bug in rpm 4.4.2 which is ancient and we won't fix anything in there. But you can try to switch to rpm 4.4.2.3 which contains lots of bug fixes.

@fbs2016
Copy link
Author

fbs2016 commented Dec 20, 2019

The java program create the RPM package with a spec file as input.
It's hard to tell why it can't work as only the extraction by standard RPM command failed.
Maybe I can debug the RPM source code to find why it reports the err then I can update the java code to meet the standard RPM extraction requirement.

@fbs2016
Copy link
Author

fbs2016 commented Dec 25, 2019

I meet some problem when try to setup the dev env for debugging. Could you point out the lead structure definition in source file? I find some code that the name length is "66" in struct "rpmlead_s" which I think it's deprecated. Thanks

@pmatilai
Copy link
Member

pmatilai commented Jan 2, 2020

See https://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/pkgformat.html covers the fundamentals of rpm package file format, http://ftp.rpm.org/max-rpm/s1-rpm-file-format-rpm-file-format.html has more background and rationale about the evolution.

But as ffesti already pointed out, the data in the lead is not actually used at all, it mostly just needs to exist, have the right maging and be of right length. 4.4.2 will look at the "type" field as well, but not the name.

@pmatilai pmatilai closed this as completed Jan 2, 2020
@fbs2016
Copy link
Author

fbs2016 commented Jan 19, 2020

I just truncate the name if its length is more than 66, and it doesn't impact the RPM package generation and extraction. Thanks

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

No branches or pull requests

3 participants