Bug #41240 ndb_error_reporter fails when the TAPE environment variable is set
Submitted: 4 Dec 2008 18:58 Modified: 12 Feb 2009 15:53
Reporter: Andrew Hutchings Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:6.3.17 OS:Linux
Assigned to: CPU Architecture:Any

[4 Dec 2008 18:58] Andrew Hutchings
Description:
When the TAPE environment variable is set the output for 'tar' is redirected to the location in that variable rather than stdout to be caught by a compression tool.

How to repeat:
1. export TAPE=/tmp/my_test_file
2. ndb_error_reporter path/to/config-file

Result is an empty compressed file with all the tar data in /tmp/my_test_file.

Suggested fix:
Change:

if($r==0)
{
    $outfile= "$reportdir.tar.bz2";
    system "tar c $reportdir|bzip2 > $outfile";
}
else
{
    $outfile= "$reportdir.tar.gz";
    system "tar c $reportdir|gzip > $outfile";
}

To:

if($r==0)
{
    $outfile= "$reportdir.tar.bz2";
    system "tar cf - $reportdir|bzip2 > $outfile";
}
else
{
    $outfile= "$reportdir.tar.gz";
    system "tar cf - $reportdir|gzip > $outfile";
}

This overrides the TAPE environment variable, forcing the output to stdout to be caught by the pipe to the compression utilities.
[4 Dec 2008 19:08] Andrew Hutchings
By default Solaris sends to /dev/rmt/0 without a TAPE environment variable.  The fix for this is the same
[11 Dec 2008 14:11] Geert Vanderkelen
Workaround on Linux is unsetting the TAPE environment variable. Doesn't work on Solaris though.

Fix is easy for the Perl script.
[12 Feb 2009 15:53] Jonas Oreland
bug#42753 which is duplicate is fixed.
closing this