Bug #30560 Valgrind option to mysql-test-run with spaces in cause strange error

Submitted: 22 Aug 2007 11:33 Modified: 8 Dec 2007 15:39
Reporter: Mats Kindahl Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Tests Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: Magnus BlÄudd CPU Architecture:Any

[22 Aug 2007 11:33] Mats Kindahl
Description:
When using the ``--valgrind-option`` to supply a ``--db-command`` to Valgrind, it is necessary to insert spaces in the command, for example::

  --valgrind-options="--db-command='gdb -nw %f %p'"

Inside mysql-test-run.pl, the following snippet can be found::

  # Add valgrind options, can be overriden by user
  mtr_add_arg($args, '%s', $_) for (split(' ', $opt_valgrind_options));

Since it splits the valgrind options at spaces, it will produce the list: "--db-command='gdb", "-nw",  "%f", and "%p'", several of which are not recognized as options.

How to repeat:
::

  $ ./mysql-test-run --valgrind-options="--db-command='gdb -nw %f %p'"
  ...

  TEST                           RESULT         TIME (ms)
  -------------------------------------------------------

  mysql-test-run: WARNING: Forcing kill of process 26520
  mysql-test-run: WARNING: Process 26672 died
  main.1st                       [ fail ]

  ERROR: Failed to start master mysqld 0

  $ cat var/log/master.err   
  CURRENT_TEST: main.1st
  valgrind: %f: command not found
  Note: Forcing kill of process 26672

Suggested fix:
Change code in mysql-test-run.pl to recognize separate options correctly.

The simplest solution might be to just use the supplied string and instead of using the list version of ``exec`` (which calls ``execvp``) use the single scalar version of ``exec`` (which handles the separation of the string into arguments itself, basically by calling ``system``).
[5 Oct 2007 16:36] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/34998

ChangeSet@1.2533, 2007-10-05 18:36:23+02:00, msvensson@shellback.(none) +1 -0
  Bug#30560 Valgrind option to mysql-test-run with spaces in cause strange error
[18 Oct 2007 21:34] Bugs System
Pushed into 5.1.23-beta
[18 Oct 2007 21:36] Bugs System
Pushed into 5.0.52
[23 Oct 2007 9:53] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/36110

ChangeSet@1.2539, 2007-10-23 11:52:55+02:00, msvensson@pilot.mysql.com +1 -0
  Bug#30560  Valgrind option to mysql-test-run with spaces in cause strange error
[7 Dec 2007 23:07] Bugs System
Pushed into 6.0.5-alpha
[7 Dec 2007 23:09] Bugs System
Pushed into 5.1.23-rc
[7 Dec 2007 23:10] Bugs System
Pushed into 5.0.54
[8 Dec 2007 15:39] Paul DuBois
Test suite change. No changelog entry needed.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.047 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.