[correctness][confirmed-defect][builtins/wc] wc pads regular-file stdin as though it were a pipe
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
Línea de trabajo
La decisión del formato de stdin está en builtins/wc/wc.go: hasNonRegular se activa siempre que se usa stdin (alrededor de la línea 176), y esa marca fuerza un ancho mínimo de siete (alrededor de la línea 216). Ejecuta el reproductor wc -lc < zz_correctness_scan_input en un directorio temporal y compara su salida con la de bash -c. Después comprueba que hasNonRegular solo se aplica a las pipes. Está terminado cuando 2 8 aparece en una redirección a un archivo regular, el comportamiento de las pipes no cambia y un escenario en tests/scenarios/cmd/wc/formatting/ lo cubre.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Generated by the rshell behavior correctness scanner.
- Contract:
BEH-007 - Classification:
confirmed-defect - Impact:
low - Target:
builtins/wc - Scanned commit:
514d1cb8188fda6b1accca5955dfab3b0e8aa34a
wc -lc < file adds seven-column padding instead of the GNU regular-file formatting. Counts are correct; deterministic stdout bytes are not.
Contract sources
[SHELL_FEATURES.md:58](https://github.com/datadog/rshell/blob/514d1cb8188fda6b1accca5955dfab3b0e8aa34a/SHELL_FEATURES.md#L58): Supported surface; Bash/GNU behavior applies where no intentional divergence is documented.
Implementation references
[builtins/wc/wc.go:176](https://github.com/datadog/rshell/blob/514d1cb8188fda6b1accca5955dfab3b0e8aa34a/builtins/wc/wc.go#L176): hasNonRegular is set merely because stdin is used.[builtins/wc/wc.go:216](https://github.com/datadog/rshell/blob/514d1cb8188fda6b1accca5955dfab3b0e8aa34a/builtins/wc/wc.go#L216): That flag forces minimum width seven even for a regular-file redirect.
Fixture setup
Use a fresh empty working directory for each run. Build from /workspace/repo first. Create these UTF-8 files with exactly the following contents (JSON string notation): {"zz_correctness_scan_input": "one\ntwo\n"}. Run the CLI and reference commands with that directory as cwd.
Reproducer
wc -lc < zz_correctness_scan_input
Commands used:
GOENV_VERSION=1.26.3 timeout 300s go build -o /tmp/zz_correctness_scan_rshell ./cmd/rshell/tmp/zz_correctness_scan_rshell --allow-all-commands --allowed-paths "$PWD" -c 'wc -lc < zz_correctness_scan_input 'LC_ALL=C.UTF-8 /usr/bin/bash --noprofile --norc -c 'wc -lc < zz_correctness_scan_input 'GOENV_VERSION=1.26.3 timeout 300s go test ./tests -run '^TestShellScenarios$/^.$/zz_correctness_scan_' -count=2 -v -timeout 300s
Expected
Exit code: 0
stdout:
2 8
stderr:
Actual
Exit code: 0
stdout:
2 8
stderr:
Verification
- Reproduction runs: 4
- Reference: Two fresh CLI fixtures and two fresh scenario fixtures; exploratory runs excluded. Native Bash 5.2.21, GNU coreutils 9.4, grep 3.11, sed 4.9, LC_ALL=C.UTF-8. Docker comparison attempted but image pull returned HTTP 502.
- Temporary test: tests/scenarios/zz_correctness_scan_wc_seekable_format.yaml (removed after evidence capture)
- Suggested regression-test location:
tests/scenarios/cmd/wc/formatting/
Fingerprint: fcf7755d6ac7070d8f8b00c3ee045a2e875d56641b19c176402e3797e485b1f1
- Lenguaje dominante
- Go
- Estrellas
- 31
- Forks
- 3
- Merge medio
- 2 d 9 h
- PR fusionados (30 d)
- 14
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una 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 DataDog/rshell
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
Todos los issues de DataDog/rshell
Issues similares
-
docs(prompt): filer socket fragment hardcodes an issue-intent cap of 8 that Chore runs overrideAbiertoagent-butler-finding chore
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
jordansmall/spindrift#5128 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 84/100
Los mantenedores suelen responder en 2 días
-
License GOtome under Apache 2.0 instead of AGPL-3.0Posiblemente ocupada @praetorianer777 la tomó hoy. Abiertoarea:workflow documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
praetorianer777/GoTome#212 ·
Los mantenedores suelen responder en 1 día
-
ci: pin Go version in Build and Unit Test workflows (>=1.26.6 floats to 1.27.2 and breaks golangci-lint)Posiblemente ocupada @leninmehedy la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 87/100
hashgraph/solo-weaver#1255 ·
Los mantenedores suelen responder en 1 día
-
area/infra backlog type/chore
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
praetorianer777/Stator#374 ·
Los mantenedores suelen responder en 1 día