Commit 8410dd67 authored by Rafael Monnerat's avatar Rafael Monnerat

slaprunner: sha256sum don't work with quotation marks

parent 53a52b28
......@@ -31,7 +31,7 @@ md5sum = 0701cf6282efa28086990f73ec2a319f
[template-runner-export-script]
filename = template/runner-export.sh.jinja2
md5sum = c0c32fc9c1bc9980745eeb638b48a691
md5sum = b921435ab5a8c408026e74d9a40eea44
[instance-runner-export]
filename = instance-runner-export.cfg.in
......
......@@ -108,7 +108,7 @@ if [ -z "$backup_directory_path" ]; then
fi
sleep 5
sha256sum "$backup_directory_path" | sort -k 66 > "$tmp_backup_sum"
sha256sum $backup_directory_path | sort -k 66 > "$tmp_backup_sum"
egrep "instance/slappart.*/srv/backup/" "$backup_directory/backup.signature" > "$tmp_filtered_signature"
# If the diff fails, then the notifier will restart this script
......
  • Nice catch, although this is not the best fix: it just brings back the bug that any space (and weird char) in any path will break this script.

    This would seem better, but I did not test it:

    find -path "./runner/instance/slappart*/srv/backup/*" -type f -print0 | xargs -0 sha256sum | sort -k 66 > "$tmp_backup_sum"
    test -s "$tmp_backup_sum" || exit 0

    This also takes care of maximum argument length.

    [EDIT] "test -s ... ||" was intended, but I wrote "test -z .. &&"

    Edited by Vincent Pelletier
  • How can this change fix anything ? Quotation marks are only a shell syntax to delimit tokens. They aren't passed in the arguments of sha256sum.

  • @jm : $backup_directory_path contains many paths.

  • @vpelletier I will check your recommendation when I return to the topic.

  • @vpelletier arg, I was too blinded by the incorrect commit subject.

    Anyway, I'd rather focus on rewriting more in Python.

Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment