From 6f69ae1b8deb3aa3bb171c8542b657810338c0d8 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 6 Jan 2019 14:47:58 +0100 Subject: [PATCH] Add docs, changelog file --- changelog/unreleased/issue-2135 | 10 ++++++++++ doc/040_backup.rst | 8 ++++++++ 2 files changed, 18 insertions(+) create mode 100644 changelog/unreleased/issue-2135 diff --git a/changelog/unreleased/issue-2135 b/changelog/unreleased/issue-2135 new file mode 100644 index 000000000..b689b54f7 --- /dev/null +++ b/changelog/unreleased/issue-2135 @@ -0,0 +1,10 @@ +Bugfix: Return error when no bytes could be read from stdin + +We assume that users reading backup data from stdin want to know when no data +could be read, so now restic returns an error when `backup --stdin` is called +but no bytes could be read. Usually, this means that an earlier command in a +pipe has failed. The documentation was amended and now recommends setting the +`pipefail` option (`set -o pipefail`). + +https://github.com/restic/restic/pull/2135 +https://github.com/restic/restic/pull/2139 diff --git a/doc/040_backup.rst b/doc/040_backup.rst index 951f65a4c..14715de9a 100644 --- a/doc/040_backup.rst +++ b/doc/040_backup.rst @@ -286,6 +286,7 @@ this mode of operation, just supply the option ``--stdin`` to the .. code-block:: console + $ set -o pipefail $ mysqldump [...] | restic -r /srv/restic-repo backup --stdin This creates a new snapshot of the output of ``mysqldump``. You can then @@ -299,6 +300,13 @@ specified with ``--stdin-filename``, e.g. like this: $ mysqldump [...] | restic -r /srv/restic-repo backup --stdin --stdin-filename production.sql +The option ``pipefail`` is highly recommended so that a non-zero exit code from +one of the programs in the pipe (e.g. ``mysqldump`` here) makes the whole chain +return a non-zero exit code. Refer to the `Use the Unofficial Bash Strict Mode +`__ for more +details on this. + + Tags for backup ***************