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

Aberta
#2,447 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
43/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
c
Domínio
backend

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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

Linguagem predominante
C
Estrelas
3
Forks
7
Merge médio
3h 28min
PRs com merge (30d)
270

Preparar o ambiente

Abrir no Codespaces

Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de InauguralSystems/EigenScript

Todas as issues de InauguralSystems/EigenScript

Issues semelhantes

Mais issues de C

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.