[MDEV-6875] TEE command does not work when piped into mysql client Created: 2014-10-15 Updated: 2015-04-23 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | OTHER |
| Affects Version/s: | 5.1.67, 5.2.14, 5.3.12, 5.5.40, 10.0.14, 10.1.0 |
| Fix Version/s: | 10.1 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Robin J. rogge | Assignee: | Alexander Barkov |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | client, upstream-fixed | ||
| Description |
|
The following command will work as expected with Percona and Oracle MySQL 5.6 releases, but not with MariaDB 10.1: output is generated on stdout but the /tmp/foo file is not being created.
When running the same query from within the mysql client application (as opposed to piping into it), the file will be created as expected. |
| Comments |
| Comment by Elena Stepanova [ 2014-10-16 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Reproducible on MySQL 5.5, apparently fixed in 5.6. Assigned to bar, because here is the only commit I found in 5.6 that mentions TEE – of course, it doesn't necessarily mean it's the one, but it's a viable suspect.
| ||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2014-11-16 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Moved to upstream-fixed because it's not reproducible on MySQL 5.6 (even if the revision above was not the one to fix it). | ||||||||||||||||||||||||||||||||||||||||||
| Comment by A. Dischner [ 2015-04-22 ] | ||||||||||||||||||||||||||||||||||||||||||
|
My systems SLES 11/12 and openSUSE 13.2 mysql 5.5.2: fails does anybody have a workaround? regards, Bodo | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2015-04-22 ] | ||||||||||||||||||||||||||||||||||||||||||
|
This is not, strictly speaking, a bug. TEE and PAGER commands don't work in the batch mode, this is intentional and documented (e.g see mysql --help). And batch mode is enabled whenever the input is not the terminal. I'd rather say that MySQL-5.6 behavior is a bug. There was a crash when TEE was used in embedded server. It's Bug#11764633, fixed in commit d608ad2dd6. Later they've removed the check for the batch mode from the TEE command (in commit 47f7fc4353) to be able to test the fix for Bug#11764633 in the test suite. Usually debugging changes like that are only enabled in a special "testing" mode, but Oracle has unintentionally enabled TEE in batch mode for everyone. I say "unintentionally" because the help text wasn't changed and the --tee command line option still doesn't work in batch mode, so it apparently was not an intentional decision "let's enable TEE in batch mode". Anyway, I tend to agree that this "buggy" 5.6 behavior is more practically useful than the old intentional behavior of mysql client. We can enable TEE in the batch mode. That includes
Related useful change:
Alternatively, we can do just the last item (make it possible to disable batch mode) and whoever needs TEE or PAGER will have to disable batch mode to use them. As a workaround you can use tee after the mysql client:
| ||||||||||||||||||||||||||||||||||||||||||
| Comment by A. Dischner [ 2015-04-23 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Hi Sergei, thanks for your fast, in depth answer! The workaround works perfect for me, kind regards, Bodo |