bundle catalog add rewrites Windows drive paths as POSIX paths
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 68/100
Piste de recherche
Commence dans src/specify_cli/bundles/catalog_config.py à _is_local_path et _canonicalize_url, puis suis comment add_source() (vers la ligne 184) enregistre le résultat. Les chemins de lecteur Windows ne doivent pas passer par le Path(...).resolve() natif de l'hôte sous POSIX ; on conserve la valeur telle quelle ou on la rejette. C'est terminé quand bundle catalog add C:\catalog.json n'écrit plus une URL relative au répertoire courant, et qu'un test couvre ce cas.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Summary
_is_local_path() explicitly recognizes a Windows drive path such as
C:\catalog.json, but _canonicalize_url() then passes it to the host-native
Path(...).resolve(). On Linux and macOS that turns the Windows absolute path
into a path relative to the current project, and add_source() persists the
rewritten value into the catalog configuration.
Environment
- Repository:
github/spec-kit - Target revision:
1c799bda6c136fcf42fb3475a922ccaac57e6c71 - Platform: macOS (POSIX), Python 3.13
- File:
src/specify_cli/bundles/catalog_config.py:96-116
(_is_local_path,_canonicalize_url), used byadd_source()at:184
Expected behavior
A Windows absolute path is either preserved verbatim in the configuration or
rejected as non-local on a POSIX host. It must not be silently rewritten into a
different path.
Actual behavior
Adding C:\catalog.json on macOS persists:
catalogs:
- id: c---catalog
url: /private/tmp/.../project/C:\catalog.json
priority: 50
install_policy: install-allowed
The stored URL points at a non-existent file whose name contains a backslash
and a colon; later catalog reads fail to resolve the intended source.
Root cause
_WINDOWS_DRIVE_RE = re.compile(r"^[A-Za-z]:[\\/]")
def _is_local_path(url: str) -> bool:
if _WINDOWS_DRIVE_RE.match(url):
return True
...
def _canonicalize_url(url: str) -> str:
if _is_local_path(url):
return str(Path(url).expanduser().resolve())
return url
The Windows-drive branch is platform-independent, while Path is host-native.
On POSIX, Path(r"C:\catalog.json").resolve() produces
<cwd>/C:\catalog.json; on Windows it would be absolute. The same function is
reached from the public bundle catalog add path through add_source().
Impact
- A catalog configuration produced on Windows and consumed on Linux/macOS (or a
Windows path passed on a POSIX host) is silently corrupted instead of being
rejected. - The stored catalog id (
c---catalog) and URL both diverge from the user's
input, and the source cannot be loaded.
Suggested fix
Preserve Windows drive paths on non-Windows hosts instead of resolving them
with the host-native Path:
def _canonicalize_url(url: str) -> str:
if _WINDOWS_DRIVE_RE.match(url):
return url # do not reinterpret on POSIX
if _is_local_path(url):
return str(Path(url).expanduser().resolve())
return url
or canonicalize with PureWindowsPath when the host is POSIX and the input
matches the Windows-drive form, and reject the value if it cannot be resolved.
- Langage dominant
- Python
- Étoiles
- 144k
- Forks
- 12.9k
- Merge moyen
- 1 j 4 h
- PR mergées (30 j)
- 181
Préparer son environnement
Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de github/spec-kit
-
The Python branch-creation port accepts an oversized `--number` and crashes at `int()` instead of rejecting itPeut-être pris @github-actions l’a pris il y a 3 jours. Ouvertebug-assess bug-fix fix-proposed severity-low triage-can-wait
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
github/spec-kit#5194 · 3 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
[Bug]: Cline extension and preset commands have `speckit.*.md` file names rewritten to `speckit-*-md`Peut-être pris @kevin9327 l’a pris il y a 4 jours. Ouvertetriage-can-wait
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour
-
[Bug]: `create-new-feature.sh` rejects the feature descriptions `-n`, `-e` and `-E`, which the Python script acceptsPeut-être pris @WOLIKIMCHENG l’a pris il y a 7 jours. Ouvertetriage-can-wait
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour
-
[Bug]: `bundle init <bundle>` initialises with the default integration instead of the bundle's, then aborts with a clashPeut-être pris @chelsealong l’a pris il y a 8 jours. Ouvertetriage-must-have
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
[Bug]: `specify preset set-priority` does not update agent command files that are already writtenPeut-être pris @mikamikasuki l’a pris il y a 8 jours. Ouvertetriage-must-have
Difficulté 2/5 1-3 heures Accessibilité débutants 77/100
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de github/spec-kit
Issues similaires
-
question
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
conda-forge/vc-feedstock#132 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
limitlessprojects/Go-Hybrid#3342 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
UKGovernmentBEIS/inspect_ai#6268 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
LSSTDESC/rail_sompz#42 ·
-
All tests fail with 'EXITED with status 3' on pytest 9.2.0 (TestReport._id is not marshallable)Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
pytest-dev/pytest-forked#113 ·