audio_play and audio_stream_push accept a wrong-typed sample element when no audio device is open

Offen
#2,447 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
43/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
c
Bereich
backend

Rechercherichtung

Start with the audio builtins and their neighboring checks, then inspect tools/strict_differential.sh and the docs/BUILTINS.md rows named in the issue. Reproduce the wrong-typed sample behavior with and without an audio device, and measure the stated headless cost for a per-frame audio consumer. Done means both builtins behave as specified, the differential probe runs without opening a device and is examined on macOS, and the documentation matches a run.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

area:gfx found-by:ci kind:silent-wrong

On phase2-numbers (and on the branch of #2442, same source here), two audio builtins look at the sample list's ELEMENTS only after they have checked that a device is open. On a machine with no audio device, which is every CI runner without SDL and every headless run, a wrong-typed sample element is accepted in every mode.

$ printf 'print of (audio_play of [0.1, "x", 0.2])\n' > a1.eigs
$ SDL_AUDIODRIVER=nosuchdriver eigenscript a1.eigs                  # 0
$ EIGS_STRICT=1 SDL_AUDIODRIVER=nosuchdriver eigenscript a1.eigs    # 0
$ printf 'print of (audio_stream_push of [0.1, "x", 0.2])\n' > a3.eigs
$ EIGS_STRICT=1 SDL_AUDIODRIVER=nosuchdriver eigenscript a3.eigs    # false

With a device open (SDL_AUDIODRIVER=dummy, after audio_open of [44100, 1]) the first one raises audio samples: element 1 is str, expected a number, as it should.

The neighbours already do it the other way round. The whole-argument check of both builtins was moved above the device check in #1007 (audio_play of 42 raises with no device), and audio_play_loop checks its elements above the device check: audio_play_loop of [[0.1, "x", 0.2], 1] raises with no device. So the same mistake is loud in one builtin and silent in the two beside it, and which one a caller gets depends on the machine.

Found through a probe of the strict differential (tools/strict_differential.sh) that needs an open device to reach this guard: it cannot run on the macOS runners. #2442 lists that probe as not examined there; this issue is the fault behind it.

Done when

  • audio_play and audio_stream_push refuse a wrong-typed sample element whether or not a device is open, with the message they give today when one is open. EIGS_STRICT=0 keeps today's quiet answer.
  • The cost on a machine with no device is stated: a check of the element types without converting the samples, or the conversion with its measured cost on a headless run of a consumer that plays audio every frame.
  • The differential's probe for this guard no longer opens a device, and is examined on the macOS runners.
  • docs/BUILTINS.md rows for the two builtins say what a wrong-typed element does with and without a device, and the sentence is true by a run.

— Claude DevBox

Vorherrschende Sprache
C
Sterne
3
Forks
7
Ø Merge
3 Std. 28 Min.
Gemergte PRs (30 T.)
270

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus InauguralSystems/EigenScript

Alle Issues in InauguralSystems/EigenScript

Ähnliche Issues

Weitere Issues zu C

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.