[GH-ISSUE #360] Leading or trailing hyphen in pre-release or build identifiers #1133

Closed
opened 2026-04-16 10:23:31 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @chrisowensboston on GitHub (Mar 22, 2017).
Original GitHub issue: https://github.com/semver/semver/issues/360

As written, the spec allows a pre-release or build identifier to begin or end with a hyphen.

As a result, the following pass the spec:

  • 2.1.7--43 (version is '2.1.7'; pre-release is '-43' )
  • 2.1.7+-43 (version is '2.1.7'; build identifier is '-43')
    Is this intended / desired?
Originally created by @chrisowensboston on GitHub (Mar 22, 2017). Original GitHub issue: https://github.com/semver/semver/issues/360 As written, the spec allows a pre-release or build identifier to begin or end with a hyphen. As a result, the following pass the spec: - 2.1.7--43 (version is '2.1.7'; pre-release is '-43' ) - 2.1.7+-43 (version is '2.1.7'; build identifier is '-43') Is this intended / desired?
Author
Owner

@FichteFoll commented on GitHub (Mar 23, 2017):

The following text is in both the pre-release and the build metadata sections:

Identifiers MUST comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty.

So yes, this is valid. They compare lexicographically (over their ASCII value), by the way.

<!-- gh-comment-id:288579984 --> @FichteFoll commented on GitHub (Mar 23, 2017): The following text is in both the pre-release and the build metadata sections: >Identifiers MUST comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. So yes, this is valid. They compare lexicographically (over their ASCII value), by the way.
Author
Owner

@jwdonahue commented on GitHub (Nov 28, 2017):

I would not expect to see any humans deciding to use version strings of that form, but I can imagine automation that might produce them, particularly if some config/database field is empty at the time it was generated. The hyphens may actually convey some meaning to somebody.

Since there is no bug or controversy here, please close this issue at your earliest possible convenience.

<!-- gh-comment-id:347668462 --> @jwdonahue commented on GitHub (Nov 28, 2017): I would not expect to see any humans deciding to use version strings of that form, but I can imagine automation that might produce them, particularly if some config/database field is empty at the time it was generated. The hyphens may actually convey some meaning to somebody. Since there is no bug or controversy here, please close this issue at your earliest possible convenience.
Author
Owner

@chrisowensboston commented on GitHub (Nov 28, 2017):

Closed as requested by jsdonahue: there is no bug or controversy here.

<!-- gh-comment-id:347700711 --> @chrisowensboston commented on GitHub (Nov 28, 2017): Closed as requested by jsdonahue: there is no bug or controversy here.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/semver#1133