Test suite failures in IDFILE tests if backslash in TMP path

Bug #694800 reported by Martin Packman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Testrepository
Fix Released
Critical
Robert Collins

Bug Description

Due to the way pseudo-envvar substitution is done on the test command configuration, inputs containing a backslash may be mangled. Given Windows uses backslash as a directory separator, this is a particular problem there:

    re.sub("\$BLAH", "C:\\temp", "$BLAH") -> "C:\x09emp"

If the path contains a backslash followed by a number instead of just 't' then `sre_constants.error: invalid group reference` will be raised.

The problem is fixed in r113.1.4 but this part of the lp:~gz/testrepository/misc_workarounds branch was not merged. Apparently fixing this interferes with the idea of embedding shell scripts into the configuration files as requested for bug 595295 but I can't for the life of me see how (or why that should be encouraged).

On my box, the test suite has the following two failures because of this:

======================================================================
FAIL: testrepository.tests.commands.test_run.TestCommand.test_IDFILE_failures
----------------------------------------------------------------------
Text attachment: traceback
------------
Traceback (most recent call last):
  ...
  File "...\testrepository\tests\commands\test_run.py", line 100, in test_IDFILE_failures
    ], ui.outputs)
  ...
AssertionError: Match failed. Matchee: ...
Matcher: Equals(...)
Difference: !=:
reference = [('values',
  [('running', 'foo --load-list b:\\temp\\tmpsernri\\failing.list')]),
 ('popen',
  ('foo --load-list b:\\temp\\tmpsernri\\failing.list',),
  {'shell': True, 'stdout': -1, 'stdin': -1}),
 ('results', *),
 ('values', [('id', 1), ('tests', 0)])]
actual = [('values', [('running', 'foo --load-list b:\temp\tmpsernri\x0cailing.list')]),
 ('popen',
  ('foo --load-list b:\temp\tmpsernri\x0cailing.list',),
  {'shell': True, 'stdin': -1, 'stdout': -1}),
 ('results', <testrepository.ui.model.TestSuiteModel object at 0x00E27350>),
 ('values', [('id', 1), ('tests', 0)])]

------------
======================================================================
FAIL: testrepository.tests.test_testcommand.TestTestCommand.test_get_run_command_IDFILE_variable_setting
----------------------------------------------------------------------
Text attachment: traceback
------------
Traceback (most recent call last):
  ...
  File "...\testrepository\tests\test_testcommand.py", line 121, in test_get_run_command_IDFILE_variab
le_setting
    self.assertEqual(expected_cmd, fixture.cmd)
  ...
AssertionError: Match failed. Matchee: "foo --load-list b: emp mp_s0nwu"
Matcher: Equals('foo --load-list b:\\temp\\tmp_s0nwu')
Difference: !=:
reference = 'foo --load-list b:\\temp\\tmp_s0nwu'
actual = 'foo --load-list b:\temp\tmp_s0nwu'

------------

There is a wider problem with treating string configuration as shell script, in particular spaces other significant characters are passed through unescaped, which may also cause these tests to fail under some setups.

Revision history for this message
Robert Collins (lifeless) wrote :

The feature isn't about embedding shell /scripts/ its about being able to control whats run via shell -variables-. Thats a reasonable and very useful facility, but it only works on unices today.

Changed in testrepository:
assignee: nobody → Robert Collins (lifeless)
importance: Undecided → Critical
status: New → Triaged
status: Triaged → In Progress
milestone: none → next
Changed in testrepository:
status: In Progress → Fix Committed
Changed in testrepository:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.