]> git.tuebingen.mpg.de Git - dss.git/log
dss.git
34 hours agoMerge topic branch t/realpath into pu pu
Andre Noll [Mon, 6 May 2024 20:31:16 +0000 (22:31 +0200)]
Merge topic branch t/realpath into pu

Started on 2024-04-27

* refs/heads/t/realpath:
  Resolve config file path only once.
  Use standard realpath().

34 hours agoMerge topic branch t/misc into pu
Andre Noll [Mon, 6 May 2024 20:31:16 +0000 (22:31 +0200)]
Merge topic branch t/misc into pu

Started on 2024-04-28

* refs/heads/t/misc:
  Kill COMPILE_TIME_LOGLEVEL.
  Convert all URLs to https.

34 hours agoMerge topic branch t/com_help into pu
Andre Noll [Mon, 6 May 2024 20:31:15 +0000 (22:31 +0200)]
Merge topic branch t/com_help into pu

Started on 2024-04-28

* refs/heads/t/com_help:
  f
  Implement help subommand.

34 hours agoMerge topic branch t/build into pu
Andre Noll [Mon, 6 May 2024 20:31:15 +0000 (22:31 +0200)]
Merge topic branch t/build into pu

* The build is quiet by default, use V=1 to get old behaviour.
* Create compressed man page (dss.1.gz).
* dss -V now shows the git version.

* refs/heads/t/build:
  build: Compress the man page.
  Avoid rebuilds of lopsub-generated files.
  build: Use variables for lobsubgen and rm commands.
  Make the build quiet by default.
  build: Create dependencies on the fly and implement dynamic versioning

34 hours agobuild: Compress the man page.
Andre Noll [Sun, 28 Apr 2024 03:07:01 +0000 (05:07 +0200)]
build: Compress the man page.

Run gzip with -n to make the build reproducible.

34 hours agoAvoid rebuilds of lopsub-generated files.
Andre Noll [Sun, 28 Apr 2024 03:10:19 +0000 (05:10 +0200)]
Avoid rebuilds of lopsub-generated files.

Without the .PRECIOUS special target, the files get removed after a
successful build and a subsequent make run rebuilds them.

34 hours agobuild: Use variables for lobsubgen and rm commands.
Andre Noll [Sun, 28 Apr 2024 02:10:18 +0000 (04:10 +0200)]
build: Use variables for lobsubgen and rm commands.

34 hours agoMake the build quiet by default.
Andre Noll [Sun, 28 Apr 2024 01:25:28 +0000 (03:25 +0200)]
Make the build quiet by default.

The old verbose output can still be had by running e.g. make V=1.

34 hours agobuild: Create dependencies on the fly and implement dynamic versioning
Andre Noll [Sat, 27 Apr 2024 22:35:06 +0000 (00:35 +0200)]
build: Create dependencies on the fly and implement dynamic versioning

10 days agoResolve config file path only once.
Andre Noll [Sat, 27 Apr 2024 21:45:59 +0000 (23:45 +0200)]
Resolve config file path only once.

10 days agoKill COMPILE_TIME_LOGLEVEL.
Andre Noll [Sun, 28 Apr 2024 02:35:52 +0000 (04:35 +0200)]
Kill COMPILE_TIME_LOGLEVEL.

10 days agoConvert all URLs to https.
Andre Noll [Sun, 28 Apr 2024 02:24:47 +0000 (04:24 +0200)]
Convert all URLs to https.

10 days agof
Andre Noll [Sun, 28 Apr 2024 02:17:33 +0000 (04:17 +0200)]
f

10 days agoImplement help subommand.
Andre Noll [Sun, 28 Apr 2024 02:01:50 +0000 (04:01 +0200)]
Implement help subommand.

10 days agoMerge branch 'master' into next next
Andre Noll [Sat, 27 Apr 2024 23:26:57 +0000 (01:26 +0200)]
Merge branch 'master' into next

* master:
  Support local make files.

10 days agoUse standard realpath().
Andre Noll [Sat, 27 Apr 2024 21:13:02 +0000 (23:13 +0200)]
Use standard realpath().

These days we may rely on the POSIX 2008 semantics realpath(), so remove
our open-coded version.

12 days agoSupport local make files. master
Andre Noll [Thu, 25 Apr 2024 13:38:23 +0000 (15:38 +0200)]
Support local make files.

These additional targets are handy for site-local targets such as
installing the web files or deploying the executable and the man page
on a remote server.

3 months agoMerge branch 'master' into next
Andre Noll [Mon, 29 Jan 2024 17:27:01 +0000 (18:27 +0100)]
Merge branch 'master' into next

* master:
  Fix --config-file for relative paths.

6 months agoFix --config-file for relative paths.
Andre Noll [Tue, 19 Sep 2023 14:31:49 +0000 (16:31 +0200)]
Fix --config-file for relative paths.

The dss lock works by first turning the given config file path
argument into a canonical absolute path using dss_realpath(), then
hashing this absolute path to obtain a key ID for semget(2).

If the given path is relative, we have to compute the ID before
changing to the destination directory because dss_realpath() needs to
call stat(2) to detect symlinks, and this system call will fail if the
current working directory has changed. This is currently not the case
as we change to the destination directory early in check_config().

If dss_realpath() fails, we silently use the unmodified path argument
for hashing to deal with the case that the default config does not
exist. As a result, if relative paths are given, the key ID depends
on whether or not change_to_dest_dir() was called. This is the case
for the run subcommanmd, but not for the kill subcommand. Thus the
kill subcommand does not work as expected if a relative path is given.

Fix this by grabbing the lock before changing the working directory
in all cases.

7 months agoMerge branch 'master' into next
Andre Noll [Tue, 19 Sep 2023 14:46:14 +0000 (16:46 +0200)]
Merge branch 'master' into next

* master:
  Avoid duplicate error message.
  dss-1.0.1.

3 years agoAvoid duplicate error message.
Andre Noll [Sun, 17 May 2020 15:08:33 +0000 (17:08 +0200)]
Avoid duplicate error message.

If parse_config_file() encounters an error, it logs the error *and*
returns the error code, which causes the error message to be logged
again. Fix this by removing the log statement from parse_config_file().

4 years agodss-1.0.1. v1.0.1
Andre Noll [Fri, 8 Nov 2019 13:24:27 +0000 (14:24 +0100)]
dss-1.0.1.

4 years agoMerge branch 'master' into next
Andre Noll [Thu, 7 Nov 2019 11:31:36 +0000 (12:31 +0100)]
Merge branch 'master' into next

* master:

4 years agoMerge branch 'refs/heads/t/prune'
Andre Noll [Thu, 7 Nov 2019 11:31:02 +0000 (12:31 +0100)]
Merge branch 'refs/heads/t/prune'

A couple of cleanups and unifications for the snapshot pruning code,
which is executed by the prune and run subcommands. With the patches
applied, both subcommands behave identically, i.e. they consider
the same set of snapshots as candidates for pruning. Also the prune
command gained the new --disk-space option to force it to act as if
disk space was high or low.

Cooking for six weeks.

* refs/heads/t/prune:
  Introduce prune --disk-space.
  Revamp com_prune().
  Factor out find_removable_snapshot().
  prune Simplify rm exit code logic.
  find_oldest_removable_snapshot(): Improve log message.
  prune: Print a message if there is nothing to prune.
  get_snapshot_list(): Add comment about sorting.
  prune: Fail gracefully if pre-rm hook fails.

4 years agoMerge branch 'refs/heads/t/svg-logo'
Andre Noll [Wed, 30 Oct 2019 09:58:12 +0000 (10:58 +0100)]
Merge branch 'refs/heads/t/svg-logo'

Cooking for about a month. The web page has been updated today to
use the new logo.

* refs/heads/t/svg-logo:
  Redo the logo as svg.

4 years agoMerge branch 'master' into next
Andre Noll [Fri, 25 Oct 2019 11:40:09 +0000 (13:40 +0200)]
Merge branch 'master' into next

* master:
  daemon_init(): Do not set umask to zero.
  Fix logic to append slash to the source directory.

4 years agodaemon_init(): Do not set umask to zero.
Andre Noll [Fri, 25 Oct 2019 11:34:49 +0000 (13:34 +0200)]
daemon_init(): Do not set umask to zero.

We don't need this because we actively want rsync to respect the file
creation mask. This does not matter in the common case of a single
source directory because the permission bits will be copied from the
source directory anyway. However, for multiple source directories it
does matter because with umask(0) the top level snapshot directory
is created with mode 777.

4 years agoFix logic to append slash to the source directory.
Andre Noll [Fri, 25 Oct 2019 11:29:50 +0000 (13:29 +0200)]
Fix logic to append slash to the source directory.

This bug was introduced recently in commit dd3f58c0bdf1
(create_rsync_argv(): Allocate correctly sized arg array) which
redefined N.

4 years agoMerge branch 'master' into next
Andre Noll [Sun, 13 Oct 2019 04:05:17 +0000 (06:05 +0200)]
Merge branch 'master' into next

* master:
  Simplify split_args().

4 years agoSimplify split_args().
Andre Noll [Wed, 6 Feb 2019 16:37:25 +0000 (17:37 +0100)]
Simplify split_args().

Both callers pass the same value for the delimiters, so we can
remove the last argument of the function.

4 years agoMerge branch 'refs/heads/t/prune' into next
Andre Noll [Sat, 21 Sep 2019 13:12:42 +0000 (15:12 +0200)]
Merge branch 'refs/heads/t/prune' into next

* refs/heads/t/prune:
  Introduce prune --disk-space.
  Revamp com_prune().
  Factor out find_removable_snapshot().
  prune Simplify rm exit code logic.
  find_oldest_removable_snapshot(): Improve log message.
  prune: Print a message if there is nothing to prune.
  get_snapshot_list(): Add comment about sorting.
  prune: Fail gracefully if pre-rm hook fails.

4 years agoIntroduce prune --disk-space.
Andre Noll [Thu, 7 Feb 2019 22:05:34 +0000 (23:05 +0100)]
Introduce prune --disk-space.

The new option takes a mandatory argument of the set {check, high,
low}. The latter two make the command act as if disk space was
high/low without actually performing the check. This is mostly useful
for debugging.

4 years agoRevamp com_prune().
Andre Noll [Sun, 1 Sep 2019 17:34:54 +0000 (19:34 +0200)]
Revamp com_prune().

The prune subcommand implements its own logic for picking the snapshot
to remove. The algorithm is similar but not identical to how the run
subcommand gets rid of snapshots.

This patch eliminates this inconsistency by changing com_prune()
to call the find_removable_snapshot() helper which was introduced in
the previous commit.

Since find_removable_snapshot() returns a dynamically allocated string
via the "why" pointer, we have to introduce another label for freeing
this memory.

The patch also improves the help text of the prune subcommand slightly.

4 years agoFactor out find_removable_snapshot().
Andre Noll [Thu, 7 Feb 2019 19:49:19 +0000 (20:49 +0100)]
Factor out find_removable_snapshot().

Both the run and the prune subcommand contain code for picking a
suitable snapshot to remove, with slightly different semantics.

This is a preparatory patch for eliminating the differences between
the two implementations. It introduces a new helper which can be
shared. After this patch, only the run subcommand uses the helper. A
subsequent patch will convert the second caller, com_prune().

4 years agoprune Simplify rm exit code logic.
Andre Noll [Sun, 1 Sep 2019 17:31:40 +0000 (19:31 +0200)]
prune Simplify rm exit code logic.

We can rely on the fact that wait_for_remove_process() sets
snapshot_removal_status to the correct value on success.

4 years agofind_oldest_removable_snapshot(): Improve log message.
Andre Noll [Sun, 10 Feb 2019 11:05:27 +0000 (12:05 +0100)]
find_oldest_removable_snapshot(): Improve log message.

The other three functions which return a candidate for removal print
one debug message but not the name of the selected snapshot, so make
find_oldest_removable_snapshot() follow this pattern too.

4 years agoprune: Print a message if there is nothing to prune.
Andre Noll [Thu, 7 Feb 2019 18:05:24 +0000 (19:05 +0100)]
prune: Print a message if there is nothing to prune.

When the prune subcommand finds there are no snapshots to prune, the
command stays silent, which is confusing. Make it print "nothing to
prune" in this case.

4 years agoget_snapshot_list(): Add comment about sorting.
Andre Noll [Sun, 10 Feb 2019 11:05:40 +0000 (12:05 +0100)]
get_snapshot_list(): Add comment about sorting.

Callers rely on the returned snapshot list being sorted by creation
time, so let's document this fact.

4 years agoprune: Fail gracefully if pre-rm hook fails.
Andre Noll [Sun, 1 Sep 2019 17:29:39 +0000 (19:29 +0200)]
prune: Fail gracefully if pre-rm hook fails.

In this case wait_for_remove_process() returns non-negative and we
miss to set the exit code, making the command appear to succeed even
if the rm process has not been created.

4 years agoMerge branch 'refs/heads/t/svg-logo' into next
Andre Noll [Wed, 18 Sep 2019 08:34:35 +0000 (10:34 +0200)]
Merge branch 'refs/heads/t/svg-logo' into next

* refs/heads/t/svg-logo:
  Redo the logo as svg.

4 years agoMerge branch 'master' into next
Andre Noll [Wed, 18 Sep 2019 08:34:34 +0000 (10:34 +0200)]
Merge branch 'master' into next

* master:

4 years agoRedo the logo as svg.
Andre Noll [Sat, 19 Jan 2019 11:16:24 +0000 (12:16 +0100)]
Redo the logo as svg.

Scalable vector graphics are much nicer for web pages than bitmaps. The
mklogo script can be removed and there is no more dependency on
ImageMagick. What a deal.

The new logo was made with vi. It is a bit smaller than the old logo
but looks similar.

4 years agoMerge branch 'refs/heads/t/multiple-source-dirs'
Andre Noll [Wed, 18 Sep 2019 08:33:29 +0000 (10:33 +0200)]
Merge branch 'refs/heads/t/multiple-source-dirs'

Was cooking for more than a year.

* refs/heads/t/multiple-source-dirs:
  create_rsync_argv(): Allocate correctly sized arg array.
  Support multiple source directories.

4 years agoMerge branch 'refs/heads/t/multiple-source-dirs' into next
Andre Noll [Tue, 3 Sep 2019 09:12:30 +0000 (11:12 +0200)]
Merge branch 'refs/heads/t/multiple-source-dirs' into next

* refs/heads/t/multiple-source-dirs:
  create_rsync_argv(): Allocate correctly sized arg array.

4 years agocreate_rsync_argv(): Allocate correctly sized arg array.
Andre Noll [Tue, 3 Sep 2019 09:09:14 +0000 (11:09 +0200)]
create_rsync_argv(): Allocate correctly sized arg array.

In the calculation of the length of the argv array we did not take
into account that --source-dir may be given multiple times. This can
result in an invalid write at the end of the allocated space.

5 years agoMerge branch 'master' into next
Andre Noll [Mon, 11 Feb 2019 19:58:09 +0000 (20:58 +0100)]
Merge branch 'master' into next

* master:
  Remove stale comment.
  Improve comment of snapshot_currently_being_removed.

5 years agoMerge remote-tracking branch 'refs/remotes/bthcx/next' into next
Andre Noll [Sun, 10 Feb 2019 12:55:26 +0000 (13:55 +0100)]
Merge remote-tracking branch 'refs/remotes/bthcx/next' into next

* refs/remotes/bthcx/next:

5 years agoMerge branch 'master' into next
Andre Noll [Sun, 10 Feb 2019 12:52:45 +0000 (13:52 +0100)]
Merge branch 'master' into next

* master:
  Add link to author homepage.

5 years agoRemove stale comment.
Andre Noll [Thu, 7 Feb 2019 20:41:22 +0000 (21:41 +0100)]
Remove stale comment.

This comment went stale ten years ago in commit 360bcc95d588 (Clean
up snapshot removal logic) which changed the type of the return value
of find_redundant_snapshot() from int to struct snapshot *.

5 years agoImprove comment of snapshot_currently_being_removed.
Andre Noll [Thu, 7 Feb 2019 20:40:43 +0000 (21:40 +0100)]
Improve comment of snapshot_currently_being_removed.

The old comment did not provide any information at all..

5 years agoMerge branch 'master' into next
Andre Noll [Sat, 9 Feb 2019 18:32:26 +0000 (19:32 +0100)]
Merge branch 'master' into next

* master:
  Add link to author homepage.

5 years agoAdd link to author homepage.
Andre Noll [Sat, 19 Jan 2019 18:47:14 +0000 (19:47 +0100)]
Add link to author homepage.

People who like dss might also be interested in other projects of
the author.

5 years agoSupport multiple source directories.
Andre Noll [Wed, 6 Jun 2018 13:08:24 +0000 (15:08 +0200)]
Support multiple source directories.

rsync is capable of copying multiple source directories to a single
destination, but this is currently not supported by dss. This commit
adds this functionality. The implementation is straight-forward,
except that we don't want to add a trailing slash to every source
directory. The new comment in dss.c explains this in more detail.

Suggested-By: Sanja Jasek <sanja.jasek@tuebingen.mpg.de>
Tested-By: Sanja Jasek <sanja.jasek@tuebingen.mpg.de>
5 years agoFixed typo.
Sanja Jasek [Fri, 1 Jun 2018 19:53:03 +0000 (21:53 +0200)]
Fixed typo.

Signed-off-by: Andre Noll <maan@tuebingen.mpg.de>
6 years agodss-1.0.0. v1.0.0
Andre Noll [Sun, 19 Nov 2017 02:01:05 +0000 (03:01 +0100)]
dss-1.0.0.

6 years agoAdd missing newline to --version output.
Andre Noll [Sun, 19 Nov 2017 01:59:15 +0000 (02:59 +0100)]
Add missing newline to --version output.

6 years agorun: Don't kill children twice.
Andre Noll [Tue, 14 Nov 2017 03:12:02 +0000 (04:12 +0100)]
run: Don't kill children twice.

When handle_signal(), the signal dispatcher of the run subcommand,
detects that SIGINT or SIGTERM was received, it calls kill_children()
to terminate any running rsync or rm processes. It then returns
negative which terminates the select loop. However, after select_loop()
returns, kill_children() is called again. Also the error message is
logged twice.

Not a biggie, but let's get rid of this redundancy by removing the
first call to kill_children().

Since handle_signal() is only called from com_run(), this patch
affects only the run subcommand.

6 years agoFix compute_next_snapshot_time().
Andre Noll [Tue, 14 Nov 2017 02:19:58 +0000 (03:19 +0100)]
Fix compute_next_snapshot_time().

The function computes the average idle time between snapshots and adds
this value to the completion time of the last snapshot to obtain the
start time for the next snapshot.

However, if the last snapshot happens to be incomplete, its completion
time is set to -1. Hence the computed next snapshot time is going to
be in the past, so we start the next snapshot immediately.

Although this is incorrect, the bug is benign because the correct next
snapshot time should also be in the past since we decided earlier to
create the snapshot which was now found incomplete.

Fix this by using the completion time of the last _complete_ snapshot
instead.

6 years agoipc.c: Remove a dead store.
Andre Noll [Tue, 14 Nov 2017 02:18:10 +0000 (03:18 +0100)]
ipc.c: Remove a dead store.

scan-build correctly points out that the value stored to 'name'
is never read.

6 years agoSilence a bogus scan-build warning.
Andre Noll [Tue, 14 Nov 2017 02:14:47 +0000 (03:14 +0100)]
Silence a bogus scan-build warning.

We never pass a NULL pointer to create_snapshot(), but scan-build
is unable to prove this and claims that the array access results in
a  null pointer dereference. The added assertion helps the reader of
the code, and it quietens scan-build.

6 years agoReplace license boilerplate with single line SPDX comments.
Andre Noll [Mon, 6 Nov 2017 00:12:41 +0000 (01:12 +0100)]
Replace license boilerplate with single line SPDX comments.

This gets rid of existing copyright templates in favor of just the
one-liner SPDX (Software Package Data Exchange) notice. All files are
licensed under the GPL-2.0, so the same tag is added to each file. No
copyright is changed by this commit.

Several files (mostly the very short ones) did not contain a license
text so far. By default all files without license information are
under the default license of this package, which is GPL version 2.
This commit adds the missing SPDX line so that now all files except
dss.css, index.html.in, INSTALL, NEWS and README have it.

We also remove author and copyright year, since the author is the same
everywhere, and the year hasn't been updated any more since at least
six years. Accurate information is available from the git log.

The COPYING file can also be removed because the license text at
https://spdx.org/licenses/GPL-2.0.html is immutable.

6 years agoMerge branch 'refs/heads/t/kill-w'
Andre Noll [Sat, 18 Nov 2017 14:54:03 +0000 (15:54 +0100)]
Merge branch 'refs/heads/t/kill-w'

Two patches which make life easier for shutdown scripts which need
to terminate the dss process, but would like to wait until the exit
hook completed.

The merge conflicted in dss.suite, but this was trivial to fix.

Cooking for a week.

* refs/heads/t/kill-w:
  kill: New option --wait.
  run: Wait for children to die.

6 years agoMerge branch 'refs/heads/t/exit-hook'
Andre Noll [Fri, 17 Nov 2017 15:41:27 +0000 (16:41 +0100)]
Merge branch 'refs/heads/t/exit-hook'

A fix for a long standing issue with the exit hook.

Cooking for a week.

* refs/heads/t/exit-hook:
  Allow word-splitting for exit hook.

6 years agoMerge branch 'refs/heads/t/ls-incomplete-duration'
Andre Noll [Thu, 16 Nov 2017 19:57:34 +0000 (20:57 +0100)]
Merge branch 'refs/heads/t/ls-incomplete-duration'

A simple patch which improves the ls output.

Cooking for 10 days.

* refs/heads/t/ls-incomplete-duration:
  ls: Print current duration of incomplete snapshots.

6 years agoMerge branch 'refs/heads/t/mountpoint'
Andre Noll [Wed, 15 Nov 2017 18:09:06 +0000 (19:09 +0100)]
Merge branch 'refs/heads/t/mountpoint'

A new main option which aborts dss if the destination file system is
not mounted.

Cooking for two weeks.

* refs/heads/t/mountpoint:
  New option: --mountpoint.

6 years agoMerge branch 'refs/heads/t/short-log'
Andre Noll [Tue, 14 Nov 2017 15:08:52 +0000 (16:08 +0100)]
Merge branch 'refs/heads/t/short-log'

A few patches which change dss_log() to only print the time stamp
and the function if dss is executing the "run" subcommand.

Cooking for a week.

* refs/heads/t/short-log:
  Subcommand sensitive logging.
  Save the subcommand pointer in a global variable.
  main(): Don't initialize user data pointer.

6 years agofind_orphaned_snapshot(): Improve log message.
Andre Noll [Sat, 11 Nov 2017 05:24:47 +0000 (06:24 +0100)]
find_orphaned_snapshot(): Improve log message.

It is kind of obvious that find_orphaned_snapshot() looks for, well,
orphaned snapshots. The new message at least gives the user a vague
idea what this means.

6 years agoAdd log message to send_signal().
Andre Noll [Tue, 14 Nov 2017 02:39:30 +0000 (03:39 +0100)]
Add log message to send_signal().

Sending a signal is a significant event which deserves a log message.

6 years agoRemove a noisy log message.
Andre Noll [Sat, 11 Nov 2017 20:34:41 +0000 (21:34 +0100)]
Remove a noisy log message.

This message does not add any information and just spams the log
file. Remove it.

6 years agoFix bad grammar "allows <infinitive>".
Andre Noll [Tue, 7 Nov 2017 23:06:17 +0000 (00:06 +0100)]
Fix bad grammar "allows <infinitive>".

In standard English, the verb "allows" can never take an infinitive as
its direct object.

6 years agogcc-compat.h: Remove _static_inline_ macro.
Andre Noll [Mon, 6 Nov 2017 00:52:03 +0000 (01:52 +0100)]
gcc-compat.h: Remove _static_inline_ macro.

The only purpose of this macro is to have a way to include static
inline functions into the doxygen source code documentation (but omit
normal static functions in .c files).  Since dss does not use doxygen,
the macro is pointless.

Remove the equally pointless documentation of dss_rename(), one
of the two users of _static_inline_, while converting it to plain
static inline.

6 years agoClean up gcc-compat.h.
Andre Noll [Mon, 6 Nov 2017 00:47:37 +0000 (01:47 +0100)]
Clean up gcc-compat.h.

It contained three macros which are no longer used.

6 years agoMerge branch 'refs/heads/t/configtest'
Andre Noll [Mon, 13 Nov 2017 16:46:57 +0000 (17:46 +0100)]
Merge branch 'refs/heads/t/configtest'

A single patch which adds the new configtest subcommand, plus a fixup
for a formatting issue which was noticed only after the branch had
already been merged to next.

* refs/heads/t/configtest:
  show_subcommand_summary(): Increase column width.
  New subcommand: configtest.

6 years agoMerge branch 'maint'
Andre Noll [Mon, 13 Nov 2017 16:23:14 +0000 (17:23 +0100)]
Merge branch 'maint'

* maint:
  Fix snapshot removal reason.

6 years agoFix snapshot removal reason. maint
Andre Noll [Sat, 11 Nov 2017 05:16:51 +0000 (06:16 +0100)]
Fix snapshot removal reason.

If the oldest snapshot has to be removed because disk space is low,
we currently log "orphaned" as the reason, which is incorrect.

6 years agokill: New option --wait.
Andre Noll [Sun, 15 Oct 2017 16:08:47 +0000 (18:08 +0200)]
kill: New option --wait.

Simply running "dss kill" during system shutdown to terminate the
dss process does not work as expected because the kill subcommand
exits after the signal has been sent, which might be long before the
targeted dss process terminates.

For example, the dss main process might be running its exit hook to
inform the system administrator about the fact that the dss service
is going down when the shutdown procedure already has deactivated the
network. Or the shutdown procedure kills the exit hook with SIGKILL
during its normal "killing remaining processes" phase before file
systems are unmounted.

With the --wait option, the kill subcommand will not return until the
dss process has died or the timeout expires. We hardcode the timeout
in send_signal() for the time being. It can be made configurable if
this turns out to be necessary.

6 years agoAllow word-splitting for exit hook.
Andre Noll [Sun, 15 Oct 2017 18:29:39 +0000 (20:29 +0200)]
Allow word-splitting for exit hook.

All hooks except the exit hook are run via dss_exec_cmdline_pid(),
which performs word splitting to create the argument vector for
exec(2). For the exit hook, however, we build the argument vector
manually, so the command line for the exit hook is not split.

This commit removes this inconsistency. However, we can't use
dss_exec_cmdline_pid() here because we need to append the error string
which caused dss to exit to the argument vector as a single argument,
and this string may well contain whitespace characters.

Hence we run split_args() on the argument to --exit-hook to obtain
an argument vector, append the error string as another element,
and then run dss_exec().

6 years agoUpdate .gitignore.
Andre Noll [Mon, 6 Nov 2017 09:54:44 +0000 (10:54 +0100)]
Update .gitignore.

We never had .a files in the tree, and the .cmdline.[ch] files went
away when we switched to lopsub. The generated index.html was always
missing.

Moreover, let's add *.swp, the swap files created by vim to recover
crashed editing sessions.

6 years agoREADME/INSTALL: Fix typo: snaphot.
Andre Noll [Mon, 6 Nov 2017 02:34:39 +0000 (03:34 +0100)]
README/INSTALL: Fix typo: snaphot.

The typo in README was introduced two years ago in commit 05e75054
(README: Explain that there are no incremental backups) while the
one in INSTALL is more than five years old, see commit a0b6810b (doc:
Add a second example config file).

6 years agoINSTALL: Switch to https for rsync link.
Andre Noll [Mon, 6 Nov 2017 02:20:24 +0000 (03:20 +0100)]
INSTALL: Switch to https for rsync link.

The http link gives 502 (Couldn't parse server headers) at the moment
while https works.

6 years agoNEWS: Fix lopsub link.
Andre Noll [Mon, 6 Nov 2017 02:12:14 +0000 (03:12 +0100)]
NEWS: Fix lopsub link.

The tilde caused the URL to 404.

6 years agoMerge branch 'refs/heads/t/im-logo'
Andre Noll [Mon, 6 Nov 2017 00:27:30 +0000 (01:27 +0100)]
Merge branch 'refs/heads/t/im-logo'

One commit which changes the way dss.png is built and another one
which adds the generated dss.png to .gitignore.

* refs/heads/t/im-logo:
  Add dss.png to .gitignore.
  Replace dss.dia by a shell script.

6 years agols: Print current duration of incomplete snapshots.
Andre Noll [Sun, 15 Oct 2017 19:11:46 +0000 (21:11 +0200)]
ls: Print current duration of incomplete snapshots.

Currently the duration of incomplete (and orphaned) snapshots is shown
as 0:00. It's more interesting to see for how long the snapshot is
already being created, so print the difference of the current time
and the start time instead.

Fix an overlong line and a whitespace issue while at it.

6 years agoshow_subcommand_summary(): Increase column width.
Andre Noll [Sat, 4 Nov 2017 12:13:48 +0000 (13:13 +0100)]
show_subcommand_summary(): Increase column width.

Since the new configtest command is 10 characters long, there was no
whitespace between the command name and the short description.

6 years agorun: Wait for children to die.
Andre Noll [Mon, 16 Oct 2017 15:36:51 +0000 (17:36 +0200)]
run: Wait for children to die.

When the select loop returns and dss is about to terminate, it sends
SIGTERM to any running rm or rsync processes and exits. It does not
wait for these processes to die, however. This is trivial to implement,
and it makes life easier for shutdown scripts which like to proceed
with unmounting file systems.

6 years agoNew subcommand: configtest.
Andre Noll [Sun, 15 Oct 2017 13:03:08 +0000 (15:03 +0200)]
New subcommand: configtest.

Similar to the identically named subcommand of apache2ctl. This is
trivial to implement because we only need to describe the subcommand
in dss.suite and create a command handler which prints an OK message
and returns success. If the config file contains errors, we abort
earlier anyway.

6 years agoSubcommand sensitive logging.
Andre Noll [Tue, 17 Oct 2017 17:19:51 +0000 (19:19 +0200)]
Subcommand sensitive logging.

It's kind of silly to log the current time and the function name for
subcommands other than "run", since these commands run only for a
short time.

This commit changes dss_log() to only print this additional information
when dss run is being executed.

6 years agoSave the subcommand pointer in a global variable.
Andre Noll [Tue, 17 Oct 2017 17:11:07 +0000 (19:11 +0200)]
Save the subcommand pointer in a global variable.

This is needed for subcommand sensitive logging which will be
introduced in a subsequent commit. For now it allows to drop the
argument of check_config(), which is good given that handle_sighup()
already played dirty games by "knowing" it is only called from the
run subcommand.

6 years agomain(): Don't initialize user data pointer.
Andre Noll [Tue, 17 Oct 2017 16:59:42 +0000 (18:59 +0200)]
main(): Don't initialize user data pointer.

It is never used uninitialized. The unnecessary initialization only
hides the warning from the compiler if it ever should ever be used
uninitialized.

6 years agoNew option: --mountpoint.
Andre Noll [Mon, 16 Oct 2017 15:19:08 +0000 (17:19 +0200)]
New option: --mountpoint.

The new option applies to run, create, ls and prune. The feature
could be implemented as a pre-create hook, but since it is so common,
it makes sense to add it to dss proper.

As for the implementation we simply check that "." and ".." are on
different devices (or are identical).

6 years agoMerge branch 'refs/heads/t/lopsub'
Andre Noll [Sun, 15 Oct 2017 12:51:29 +0000 (14:51 +0200)]
Merge branch 'refs/heads/t/lopsub'

Conversion to lopsub and a few other improvements on top of it.

* refs/heads/t/lopsub:
  INSTALL: Explain how to use CPPFLAGS and LDFLAGS.
  build: Introduce DSS_CPPFLAGS.
  build: Fix cc command which creates dependencies,
  build: Combine CFLAGS and DEBUG_CFLAGS.
  Implement --checksum.
  run: Improve error diagnostics for chdir(2) failure.
  run: Improve error message if dss is already running.
  run: Fix exit status in case another dss process is running.
  build: Add target install and install-strip.
  Convert dss to lopsub.
  Remove --no-resume.

6 years agoRevert "ipc.c: Use ftok() instead of SuperFastHash."
Andre Noll [Wed, 6 Sep 2017 12:57:28 +0000 (14:57 +0200)]
Revert "ipc.c: Use ftok() instead of SuperFastHash."

This reverts commit c92370affe722f38a85a41d1b5524e4a102b8f4d.

This was not a good idea because ftok(3) hashes, among other
information, the inode number of the file, and this number changes
every time the configuration file is edited.

The revert conflicted slightly to the commit which renamed
get_key_or_die() to get_key() and changed the type of the return
value to key_t, but the conflict was easy to resolve.

6 years agoipc: Improve error diagnostics for kill.
Andre Noll [Sun, 16 Apr 2017 10:48:58 +0000 (12:48 +0200)]
ipc: Improve error diagnostics for kill.

If dss is not running, the kill command prints "No such file or
directory" because the call to semget(2) fails with ENOENT. This
message is a bit misleading, so let's return -E_NOT_RUNNING in this
case instead.

6 years agoAdd dss.png to .gitignore.
Andre Noll [Thu, 13 Jul 2017 19:03:48 +0000 (21:03 +0200)]
Add dss.png to .gitignore.

It's a generated file which should never be under version control.

6 years agoReplace dss.dia by a shell script.
Andre Noll [Sun, 30 Apr 2017 00:33:57 +0000 (02:33 +0200)]
Replace dss.dia by a shell script.

The dia command line tool misaligns the text on the dss logo, and the
dia application started to segfault on my home box after a library
upgrade.

This patch replaces the dia source file by the mklogo bash script
which runs the convert utility of ImageMagick to write the dss logo
in png format to stdout.

The result looks almost identical.

6 years agoINSTALL: Explain how to use CPPFLAGS and LDFLAGS.
Andre Noll [Thu, 13 Jul 2017 20:51:45 +0000 (22:51 +0200)]
INSTALL: Explain how to use CPPFLAGS and LDFLAGS.

6 years agobuild: Introduce DSS_CPPFLAGS.
Andre Noll [Thu, 13 Jul 2017 17:43:04 +0000 (19:43 +0200)]
build: Introduce DSS_CPPFLAGS.

As with CFLAGS, it is good practice to leave CPPFLAGS unset in the
Makefile and append it to the cc command after our own flags, to give
the user a chance to override our settings.

This patch initializes DSS_CPPFLAGS with the VERSION_STRING define
which was part of the receipe and adds -Wunused macros, which is a
preprocessor flag rather than a compiler flag.

DSS_CPPFLAGS and CPPFLAGS are added to the two relevant commands,
in addition to the existing DSS_CFLAGS and CFLAGS.

6 years agobuild: Fix cc command which creates dependencies,
Andre Noll [Thu, 13 Jul 2017 17:33:52 +0000 (19:33 +0200)]
build: Fix cc command which creates dependencies,

The command to create Makefile.deps was hardcoded as gcc in Makefile.
This patch changes the command to $(CC) and adds the usual set of
flags which we use for compiling.

6 years agobuild: Combine CFLAGS and DEBUG_CFLAGS.
Andre Noll [Thu, 13 Jul 2017 17:21:11 +0000 (19:21 +0200)]
build: Combine CFLAGS and DEBUG_CFLAGS.

We needed two sets of flags for gengetopt because the C code generated
by gengetopt would not compile cleanly with our rather strict set of
flags. With lopsub this is no longer necessary.

Moreover, it is considered good practice to not set CFLAGS at all but
to append the contents of this variable to the compile command. This
way the user may set the variable to override some of the options.

This commit gets rid of CFLAGS in favor of DSS_CFLAGS, which is just
the union of the CFLAGS and the DEBUG_CFLAGS variables we had before.

6 years agoImplement --checksum.
Andre Noll [Mon, 17 Apr 2017 17:06:37 +0000 (19:06 +0200)]
Implement --checksum.

It is considered good practice to run rsync with --checksum from time
to time. This patch implements the feature via the new --checksum
option.

The probabilistic approach was chosen so that dss does not need to
remember which snapshots were created with --checksum.