Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix errors for /bin/sh with the xtrabackup cron #1222

Merged
merged 2 commits into from
Aug 12, 2019

Conversation

baldurmen
Copy link
Contributor

Using Debian's default shell for cron (/bin/sh), the xtrabackup incremental cron was failing for me with an error message like:

Cron <root@foo> /usr/local/sbin/xtrabackup.sh --incremental-basedir=/foo/mysql-backups --target-dir=/foo/mysql-backups/`date +
/bin/sh: 1: Syntax error: EOF in backquote substitution

This is caused by percent-signs (%) not being escaped. With /bin/sh, percent-signs (%) in the command, unless escaped with backslash , will be changed into newline characters, and all data after the first % will be sent to the command as standard input. Thus the EOF error.

I also made another small commit to convert backtiks (`) into $(), which is the prefered POSIX way. https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xcu_chap02.html#tag_23_02_06_03 has a good writeup on it.

Happy to make modifications if required.

@baldurmen
Copy link
Contributor Author

Now with updated spec tests.

Percent-signs (%) in the command, unless escaped with backslash \, will be changed into newline characters, and all data after the first % will be sent to the command as standard input.
@baldurmen
Copy link
Contributor Author

Well a bunch of tests fail because GitHub is unstable and cloning repositories fail. Could someone with permissions on this project restart the Travis jobs for me?

@baldurmen baldurmen closed this Aug 8, 2019
@baldurmen baldurmen reopened this Aug 8, 2019
@baldurmen
Copy link
Contributor Author

Well, I forced Travis to run again, sorry for closing/reopening but that was the only solution I had.

This seems ready for review :)

Copy link
Contributor

@ThoughtCrhyme ThoughtCrhyme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @baldurmen thanks for the fix! Looks good to me.

@ThoughtCrhyme ThoughtCrhyme merged commit 5052906 into puppetlabs:master Aug 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants