[BUG] subset() returns false for an upper-bound-only range such as subset('<2.0.0', '*')
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 74/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, node.js
- Lĩnh vực
- backend
Hướng nghiên cứu
Start in ranges/subset.js at simpleSubset, especially the lt && hasDomGT && !gt condition described in the issue. Trace how missing lower bounds and * are normalized, then check the existing subset tests for these range combinations. Done means the first five reproductions return true while existing subset behavior remains correct.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
subset(sub, dom) returns false when sub has only an upper bound (< or <=) and dom has a lower bound, including *, which subset treats as >=0.0.0. Every version that satisfies <2.0.0 also satisfies *, so the README's "entirely contained" definition gives true.
subset('<1.0.0', '0.x') is a related false negative: 0.x is >=0.0.0 <1.0.0-0, which admits the same non-prerelease versions as <1.0.0.
Expected Behavior
The first five lines below print true.
In ranges/subset.js, simpleSubset replaces * in dom with >=0.0.0 and then returns false for lt && hasDomGT && !gt, which treats a missing lower bound in sub as unbounded below instead of >=0.0.0.
Steps To Reproduce
const { subset } = require('semver')
console.log(subset('<2.0.0', '*'))
console.log(subset('<2', '*'))
console.log(subset('<2.0.0', '>=0.0.0'))
console.log(subset('<2.0.0', '>=0.0.0-0'))
console.log(subset('<1.0.0', '0.x'))
console.log(subset('<1.0.0', '>=0.0.0 <1.0.0'))
console.log(subset('^1.2.3', '*'))
Output:
false
false
false
false
false
true
true
Environment
- semver: 7.8.6, also
mainat b37b033 - Node: 26.13.0
- OS: Ubuntu Linux
- platform: x86_64
Credit: https://ucsbplse.github.io/
- Ngôn ngữ chính
- JavaScript
- Star
- 5.5k
- Fork
- 624
- Merge trung bình
- 6 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 13
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của npm/node-semver
-
[BUG] minVersion returns 0.0.0 when a 0.0.0 prerelease is the true minimumCó thể đã có người làm @thisisshivamtiwari đã nhận 10 ngày trước. Đang mởBug Needs Triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
npm/node-semver#934 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] new Range(comparator).test() throws TypeError for a prerelease versionCó thể đã có người làm @Boulea7 đã nhận 37 ngày trước. Đang mởBug Needs Triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
npm/node-semver#908 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
semver:major
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
npm/node-semver#108 · 6 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] intersects() still returns true for an empty range against "*" (follow-up to #521)Có thể đã có người làm @json-open-source đã nhận 36 ngày trước. Đang mởBug Needs Triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 64/100
npm/node-semver#909 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] `* || 1.2.3-alpha` won't match `1.2.3-alpha` (when includePrerelease = false)Có thể đã có người làm @x0Lazarus đã nhận 42 ngày trước. Đang mởBug Needs Triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
npm/node-semver#906 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của npm/node-semver
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 2 ngày
-
desktop v3 windows
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
esengine/DeepSeek-Reasonix#15016 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Fei2411/DeepSeek-Bot#1113 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
arfct/timezone.fyi#19 ·