craigwblake / redline

Pure Java Rpm Library
http://redline-rpm.org
MIT License
128 stars 97 forks source link

OS field in RPM header for AIX (and further enum values) is off by one #142

Open tonyabbott opened 5 years ago

tonyabbott commented 5 years ago

I'm creating an RPM for AIX using builder.setPlatform(Architecture.PPC, Os.AIX) which results in the value 6 for the OS field in the RPM lead instead of the expected 5.

The OS values in org.redline_rpm.header.Os are written by Lead.write() using the ordinal value of the enum: buffer.putShort(( short) (os.ordinal() != 0 ? os.ordinal() : 0xFF));

In /usr/lib/rpm/rpmrc, the values for AmigaOS and AIX are the same (5), but the Os enum has constants for both AmigaOS and AIX. This results in all OSs from AIX onwards being off-by-one.

The simplest solution would to fold the AMIGAOS and AIX enum values into one called AMIGAOS_OR_AIX, otherwise a more sophisticated mapping is required.