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

Reject invalid version strings for debian packages. #1847

Closed
jordansissel opened this issue Nov 6, 2021 · 2 comments · Fixed by #1971
Closed

Reject invalid version strings for debian packages. #1847

jordansissel opened this issue Nov 6, 2021 · 2 comments · Fixed by #1971

Comments

@jordansissel
Copy link
Owner

While writing docs tonight, I found that fpm can create a debian package with an invalid version string.

% fpm -s empty -t deb -v "v1.2.3" -n example
Created package {:path=>"example_v1.2.3_amd64.deb"}

% dpkg --field example_v1.2.3_amd64.deb Version
dpkg-deb: error: parsing file '/tmp/dpkg-deb.AlPRzj/control' near line 2 package 'example':
 'Version' field value 'v1.2.3': version number does not start with digit
@mthbrown
Copy link

Just ran into this as well

@jordansissel
Copy link
Owner Author

Based on #1968 and this issue, I'd like two behaviors:

  1. If the version string is something like 'v1.2.3' then fpm should drop the 'v' and use '1.2.3' for the version field
  2. Excluding the item above, if it's an invalid version string, fpm should log an actionable error message and exit with failure.

Item 1 (vX.Y.Z) should help with automatic versioning that some folks do with Git tags where a release is tagged vX.Y.Z for a version number.

jordansissel added a commit that referenced this issue Dec 4, 2022
jordansissel added a commit that referenced this issue Dec 4, 2022
A hopefully-actionable error message is provided when an invalid version
is given when making a Debian package.

To aid readability, rewrote the relationship pattern as a multiline regex. Added separate pattern for version field.

Test coverage added for #1969's "v" prefix removal.

For #1847
jordansissel added a commit that referenced this issue Dec 4, 2022
A hopefully-actionable error message is provided when an invalid version
is given when making a Debian package.

To aid readability, rewrote the relationship pattern as a multiline regex. Added separate pattern for version field.

Test coverage added for #1969's "v" prefix removal.

For #1847
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.

2 participants