Bug #120487 MySQLServerMock debug output prints an empty string due to use-after-move
Submitted: 17 May 10:47
Reporter: S F. Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Router Severity:S3 (Non-critical)
Version:MySQL 9.6.0, commit 447eb26e094b444a88c5 OS:Any
Assigned to: CPU Architecture:Any
Tags: mock-server, router

[17 May 10:47] S F.
Description:
MySQLServerMock::MySQLServerMock moves the expected_queries_file constructor parameter into expected_queries_file_ in the initializer list, then prints the moved-from parameter when debug_mode_ is enabled.

After the move, the parameter is valid but its value is unspecified. In practice it prints an empty filename:

```cpp
expected_queries_file_{std::move(expected_queries_file)},
// ...
std::cout << "\n\nExpected SQL queries come from file '"
          << expected_queries_file << "'\n\n"
          << std::flush;
```

How to repeat:
Compile a small program that constructs server_mock::MySQLServerMock with debug_mode=true and a non-empty expected_queries_file.

Observed output: Expected SQL queries come from file ''

Expected output should include the actual filename.

Suggested fix:
Print the member that owns the moved string:

```cpp
std::cout << "\n\nExpected SQL queries come from file '"
          << expected_queries_file_ << "'\n\n"
          << std::flush;
```