[BUG] subset() returns false for an upper-bound-only range such as subset('<2.0.0', '*')
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 74/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- javascript, node.js
- Área
- backend
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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/
- Lenguaje dominante
- JavaScript
- Estrellas
- 5.5k
- Forks
- 624
- Merge medio
- 6 d 1 h
- PR fusionados (30 d)
- 13
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de npm/node-semver
-
[BUG] minVersion returns 0.0.0 when a 0.0.0 prerelease is the true minimumPosiblemente ocupada @thisisshivamtiwari la tomó hace 10 días. AbiertoBug Needs Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
npm/node-semver#934 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
[BUG] new Range(comparator).test() throws TypeError for a prerelease versionPosiblemente ocupada @Boulea7 la tomó hace 37 días. AbiertoBug Needs Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
npm/node-semver#908 ·
Los mantenedores suelen responder en 1 día
-
semver:major
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
npm/node-semver#108 · 6 comentarios ·
Los mantenedores suelen responder en 1 día
-
[BUG] intersects() still returns true for an empty range against "*" (follow-up to #521)Posiblemente ocupada @json-open-source la tomó hace 36 días. AbiertoBug Needs Triage
Dificultad 3/5 1-2 días Aptitud para principiantes 64/100
npm/node-semver#909 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[BUG] `* || 1.2.3-alpha` won't match `1.2.3-alpha` (when includePrerelease = false)Posiblemente ocupada @x0Lazarus la tomó hace 42 días. AbiertoBug Needs Triage
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
npm/node-semver#906 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de npm/node-semver
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Fei2411/DeepSeek-Bot#1113 ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
arfct/timezone.fyi#19 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
fastify/fastify-http-proxy#493 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
eliasstravik/herdr-projects#785 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
tensorflow/tfjs#8754 ·