jlevy / jlevy/tryscript

An unset variable in path: puts the working directory on PATH

Abierto Apto para principiantes
#55 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
13
Forks
1
Merge medio
3 h 38 min
PR fusionados (30 d)
3

Descripción

An unset variable in a `path:` entry expands to an empty string, and an empty `PATH`
element means the current directory to POSIX. So this front matter:

```yaml
path:
- $TOOL_DIR
```

silently puts the working directory on `PATH` when `TOOL_DIR` is not set, instead of
contributing nothing.

That is the wrong failure. A test that names a directory it cannot resolve should get a
clear "command not found", not a lookup that quietly searches somewhere the author never
named — and in a sandboxed run the working directory contains fixtures, which is exactly
where a stray executable could sit.

## Proposal

Drop entries that expand to empty, rather than passing them through.

A test asserting that a bare `$VAR` does not put the working directory on `PATH` would pin
it: today that assertion fails.

## Related

jlevy/tryscript#54 asks for `requires:`, which addresses the same underlying problem from
the other side — knowing which binary a run actually resolved rather than trusting `PATH`
composition to have gone as intended.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Locate the code that expands path: entries and inspect how unset variables become PATH elements. Add the proposed test using a bare $VAR, then verify that an empty expansion is omitted and the working directory is not searched; the test should produce a clear command-not-found result.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
typescript
Área
cli, testing-qa
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Activo
Claridad
Bien especificado
Aptitud para principiantes
75/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.