The bug766033.sh test is not portable

Bug #999273 reported by Alexey Kopytov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona XtraBackup moved to https://jira.percona.com/projects/PXB
Fix Released
Low
Alexey Kopytov
2.0
Fix Released
Low
Alexey Kopytov
2.1
Fix Released
Low
Alexey Kopytov

Bug Description

The bug766039.sh test introduced with https://code.launchpad.net/~sergei.glushchenko/percona-xtrabackup/bug766033-filename-error/+merge/96043 has a number of portability issues:

- the values for 'count' and 'seek' are in 512-byte units. So we actually write 8 MB of zeroes starting with the 512 KB offset. Is that intentional?

- On *BSD and OSX "wc" has a different output format (the number is prepended with a tab character). But the next check compares "$COUNT" and "1" as strings rather than numbers. So that expression is always false. Besides, we don't really need the count of matched lines, all we need is the grep exit code (i.e. if there was at least one matching line).

So this:

> set +e
> COUNT=`xtrabackup --backup --datadir=$mysql_datadir --target-dir=$topdir/backup 2>&1 \
> | grep "File ./sakila/rental.ibd seems to be corrupted" | wc -l `
> set -e
>
> if [ "$COUNT" != "1" ] ; then
> vlog "test failed"
> exit 1
> fi

is equivalent to the following 2 lines that are also more portable:

> run_cmd_expect_failure $XB_BIN $XB_ARGS --backup --datadir=$mysql_datadir \
> --target-dir=$topdir/backup
> grep -q "File ./sakila/rental.ibd seems to be corrupted" $OUTFILE

Related branches

summary: - The bug766039.sh test is not portable
+ The bug766033.sh test is not portable
Revision history for this message
Alexey Kopytov (akopytov) wrote :

Reassigning to myself as this bug blocks my testing of replication support in the test suite.

Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PXB-850

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.