| Summary: | Support ~ in package versions | ||
|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] OE-Core | Reporter: | Richard Purdie <richard.purdie> |
| Component: | core | Assignee: | Unassigned <unassigned> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | Medium | CC: | jessica.zhang, meta.mr.watcher, meta.watcher, n3npq, ross.burton, sgw |
| Version: | 1.4 | ||
| Target Milestone: | Future | ||
| Hardware: | x86 | ||
| OS: | Multiple | ||
| Whiteboard: | |||
| OS type for building Yocto: | --- | Type of Regression: | --- |
| Verified: | Documentation change: | Don't know | |
|
Description
Richard Purdie
2013-03-04 12:15:52 UTC
Tracked at https://bugs.launchpad.net/rpm/+bug/1172341 Also, dpkg supports them. The cited "invalid tag value" problem is a regular expression
that can be modified: add "~" to the permitted characters
in this macro
%pattern_Version ^[A-Za-z0-9+._~]+$
in the macros file to permit a '~' in Version:.
THe semantic changes to version comparison implied by
twiddle-in-version have been implemented for more than
a year and are present in rpm-5.4.10 (at least).
Whether opkg/opkg-utils/dpkg "support" twiddle in
version is largely irrelevant to rpm: rpm needs
to be self-consistent with its own tool chains.
Very few rpm tools are known to handle twiddle-in-version
correctly.
I'm also obligated by full disclosure to point out
the reason (a CVE a few years back) why '~' (and other
characters) were not included in rpm Version: strings.
Many scripts/tools construct shell commands using
values in metadata: rpmbuild is one of those tools,
there are others.
E.g. rpmbuild removes the build tree whose name is constructed
from NVR tags in metadata. Consider this *.spec metadata:
Name: N
Version: V~whatever
Release: R
from which data rpmbuild constructs a command
rm -rf N-V~whatever
preparing for a build.
All that is needed to trick rpmbuild into removing
one's home directory is an alternative representation
for a space character in some shell context surrounding
the twiddle so that the command becomes
rm -rf N-V ~ whatever
A closely related exploit that appended ";rm -rf ~" to
the Name: value (but using alternative representations of
the ' ' character was reported to vendor-sec like 4 years ago
opkg-utils should now be using more shared code so is fixed. rpm4 supports it. I think we're close to closing this. I've added a selftest that verifies that rpm, dpkg, and opkg all do the right thing with ~ in version comparisons, and a recipe that uses ~ builds correctly: $ find . -name test-version[-_]1* ./deb/corei7-64/test-version_1.0~beta-r0_amd64.deb ./ipk/corei7-64/test-version_1.0~beta-r0_corei7-64.ipk ./rpm/corei7_64/test-version-1.0~beta-r0.corei7_64.rpm |