In SSH mode, report.php cannot copy junit.xml back (double quoting is back)

Aperta
#370 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

@ekamran ci sta già lavorando.

Dal 12/11/2026.

  • #371 di @ekamran — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
18/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
github-actions, php
Ambito
testing-qa

Direzione di ricerca

The bug is in report.php, where the remote junit.xml path is passed through escapeshellarg() twice before rsync runs in SSH mode (WPT_SSH_CONNECT, WPT_TEST_DIR). Start by reading that rsync call and the earlier history in #263, #264 and #273, then reproduce it with a junit.xml on a remote host. Pull request #371 is already open against this issue, so review it rather than starting a new fix. Done means junit.xml is copied to WPT_PREPARE_DIR over SSH on rsync 3.2.4 or newer and the results are reported.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

When WPT_SSH_CONNECT is set, report.php copies junit.xml back from the test environment with rsync. The remote path is quoted twice: WPT_TEST_DIR goes through escapeshellarg(), and then WPT_SSH_CONNECT: plus that path goes through escapeshellarg() again.

Since rsync 3.2.4, rsync escapes the quotes it passes to the remote shell (see "arg protection" in the 3.2.4 NEWS), so the inner quotes become part of the path and the copy fails:

rsync -r -e "ssh -o StrictHostKeyChecking=no" 'root@localhost:'\''/tmp/wp-remote'\''/tests/phpunit/build/logs/*' '/tmp/wp-tests'
rsync: [sender] change_dir "/root/'/tmp/wp-remote'/tests/phpunit/build/logs" failed: No such file or directory (2)

report.php stops there, so nothing is reported. The same command works with rsync --old-args, which turns the newer escaping off.

This is the bug from #263. #264 fixed it, and #273 then reverted all of #264 because its test.php part broke local runs (#271). test.php was fixed again later, but the report.php part did not come back, and #263 is still closed.

I ran report.php from master (087bb29) in SSH mode, rsync 3.4.1 on both sides, with a junit.xml in the test environment. It fails as above. Local runs (no WPT_SSH_CONNECT) are not affected.

I found this while testing the GitHub action in #245, which always runs over SSH: its "Report the results" step fails this way, and the job stays green because the step has continue-on-error: true.

Expected: junit.xml is copied to WPT_PREPARE_DIR and the results are reported.

Lingua principale
PHP
Stelle
77
Fork
83
Merge medio
4g 9h
PR unite (30g)
2

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di WordPress/phpunit-test-runner

Tutte le issue di WordPress/phpunit-test-runner

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.