Closed dertseha closed 5 years ago
I agree, a) should be the solution.
Now what happens to the name in the lead section? Will it simply be truncated?
Hello there and thank you for your answer.
I looked at some long-named RPMs that I created with rpmbuild
. The name field in the lead is simply truncated. If the encoded name would take 100 bytes, only 65 are taken from that, and the last byte is 0x00
in the lead.
Ok ... I guess this should be a quick change.
Do you want to do that?
Thank you for the offer. My mind would be currently willing, though other factors hinder me right now (avoiding TMI). I could do it, would take some time (hopefully measured in days), and I'd need a pointer where the tag should be set (which class is responsible for doing that?)
Well, there is no hurry :grin: …
I think the first thing to do is to limit the number of bytes written in the method org.eclipse.packagedrone.utils.rpm.build.RpmWriter.writeLead()
. However you need to take into account the number of bytes (vs chars). So I guess writing a specific method, returning no more than 66 bytes would be the right thing. Including a unit test, testing for multi byte UTF-8 cases. And removing the exception, of course.
And that should be about is, as the name is already put into the tags: https://github.com/eclipse/packagedrone/blob/3869c1643cdc6f7cb8b26097a7b6994683b13d7e/bundles/org.eclipse.packagedrone.utils.rpm/src/org/eclipse/packagedrone/utils/rpm/build/RpmBuilder.java#L817
To give an update: The company I'm working in is still checking their legal stuff regarding the contribution guidelines. It'll be longer than a few days as initially thought :/
No worries, I am currently in the process of migrating the RPM code to a new Eclipse project (Eclipse Packager) which should be the home of stuff creating software packages, which would be RPM and APT.
So I will need a little bit of time myself to do that, but when it is done, it should be a much simpler project structure and should make it much easier to provide and test a PR.
Added to eclipse packager https://github.com/eclipse/packager/pull/1
Using the library as part of ctron/rpm-builder, I came across an exception
Name exceeds 66 bytes
fromRpmWriter.writeLead()
. While the RPM lead allows for (encoded) names only up to 66 bytes, it is possible to store longer names in RPMs using tags. See: http://ftp.rpm.org/max-rpm/s1-rpm-file-format-rpm-file-format.htmlAfter some cursory investigation, here some ideas on how to address this: a) Handled within this library: Investigating how the lead is being created,
LeadBuilder.build()
creates aLead
instance based onRpmLead.toLeadName()
. Either the builder, or possibly thetoLeadName()
function, should truncate the string. Though, since this is before charset encoding (happening inRpmWriter.writeLead()
), this might not be the best place. Perhaps simply truncate the (encoded) name inRpmWriter.writeLead()
instead of throwing an exception; And somewhere theRpmTag.NAME
is filled. (I know too little of the responsibilities of builder, writer, ... at this point.)b) Handled within user-library: Should ctron/rpm-builder pass in a truncated name and provide a header customizer in
RpmBuilder
that sets the RpmTag.NAME element?I'd vote for a solution within this library, as b) would require the knowledge of the internal limitations of the data structures, as well as causing duplication in all using code...
How to address this?