mesonbuild / mesonbuild/meson

Results of find_program('some-script") should be consistent, irrespective of value of PATHEXT

Open
#4,355 14 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs-info OS:windows
Dominant language
Python
Stars
6.6k
Forks
1.9k
Avg merge
2d 6h
Merged PRs (30d)
33

Description

test_find_program() (a windows-only test) fails if .py isn't in PATHEXT

C:\meson>py run_unittests.py WindowsTests.test_find_program
F
Stdout:
Program cmd found: YES (C:\WINDOWS\system32\cmd.EXE)
Program cmd.exe found: YES (C:\WINDOWS\system32\cmd.exe)
Program C:\WINDOWS\system32\cmd found: YES (C:\WINDOWS\system32\cmd.exe)
Program C:\cygwin64\wip\meson\test cases/windows\8 find program\test-script found: YES (python C:\cygwin64\wip\meson\test cases/windows\8 find program\test-script)
Program C:\cygwin64\wip\meson\test cases/windows\8 find program\test-script-ext.py found: YES (C:\Users\jon\AppData\Local\Programs\Python\Python36\python.exe C:\cygwin64\wip\meson\test cases/windows\8 find program\test-script-ext.py)
Program test-script-ext found: NO

======================================================================
FAIL: test_find_program (__main__.WindowsTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "run_unittests.py", line 3041, in test_find_program
    self.assertTrue(prog.found(), msg='test-script-ext not found in PATH')
AssertionError: False is not true : test-script-ext not found in PATH

Stdout:
Program cmd found: YES (C:\WINDOWS\system32\cmd.EXE)
Program cmd.exe found: YES (C:\WINDOWS\system32\cmd.exe)
Program C:\WINDOWS\system32\cmd found: YES (C:\WINDOWS\system32\cmd.exe)
Program C:\cygwin64\wip\meson\test cases/windows\8 find program\test-script found: YES (python C:\cygwin64\wip\meson\test cases/windows\8 find program\test-script)
Program C:\cygwin64\wip\meson\test cases/windows\8 find program\test-script-ext.py found: YES (C:\Users\jon\AppData\Local\Programs\Python\Python36\python.exe C:\cygwin64\wip\meson\test cases/windows\8 find program\test-script-ext.py)
Program test-script-ext found: NO

----------------------------------------------------------------------
Ran 1 test in 0.059s

FAILED (failures=1)

C:\meson>echo %PATHEXT%
.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

C:\meson>set PATHEXT=%PATHEXT%;.py

C:\meson>py run_unittests.py WindowsTests.test_find_program
.
----------------------------------------------------------------------
Ran 1 test in 0.025s

OK

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with run_unittests.py and WindowsTests.test_find_program, then reproduce the failure with and without .py in PATHEXT. Check the find_program behavior for test-script-ext and its explicit .py variant; done means the test passes consistently regardless of PATHEXT.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.