summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* Merge branch 'master' into nextnextAndre Noll2024-04-28
|\ | | | | | | | | * master: Support local make files.
| * Support local make files.Andre Noll2024-04-25
| | | | | | | | | | | | 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.
* | Merge branch 'master' into nextAndre Noll2024-01-29
|\| | | | | | | | | * master: Fix --config-file for relative paths.
| * Fix --config-file for relative paths.Andre Noll2023-11-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge branch 'master' into nextAndre Noll2023-09-19
|\| | | | | | | | | | | * master: Avoid duplicate error message. dss-1.0.1.
| * Avoid duplicate error message.Andre Noll2020-05-17
| | | | | | | | | | | | 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().
| * dss-1.0.1.v1.0.1Andre Noll2019-11-08
| |
* | Merge branch 'master' into nextAndre Noll2019-11-07
|\| | | | | | | * master:
| * Merge branch 'refs/heads/t/prune'Andre Noll2019-11-07
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * \ Merge branch 'refs/heads/t/svg-logo'Andre Noll2019-10-30
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | Merge branch 'master' into nextAndre Noll2019-10-25
|\| | | | | | | | | | | | | | | | | | | | | | | * master: daemon_init(): Do not set umask to zero. Fix logic to append slash to the source directory.
| * | | daemon_init(): Do not set umask to zero.Andre Noll2019-10-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | Fix logic to append slash to the source directory.Andre Noll2019-10-25
| | | | | | | | | | | | | | | | | | | | | | | | This bug was introduced recently in commit dd3f58c0bdf1 (create_rsync_argv(): Allocate correctly sized arg array) which redefined N.
* | | | Merge branch 'master' into nextAndre Noll2019-10-13
|\| | | | | | | | | | | | | | | | | | | * master: Simplify split_args().
| * | | Simplify split_args().Andre Noll2019-10-13
| | | | | | | | | | | | | | | | | | | | Both callers pass the same value for the delimiters, so we can remove the last argument of the function.
* | | | Merge branch 'refs/heads/t/prune' into nextAndre Noll2019-09-21
|\ \ \ \ | | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
| * | | Introduce prune --disk-space.Andre Noll2019-09-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | Revamp com_prune().Andre Noll2019-09-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | Factor out find_removable_snapshot().Andre Noll2019-09-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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().
| * | | prune Simplify rm exit code logic.Andre Noll2019-09-21
| | | | | | | | | | | | | | | | | | | | We can rely on the fact that wait_for_remove_process() sets snapshot_removal_status to the correct value on success.
| * | | find_oldest_removable_snapshot(): Improve log message.Andre Noll2019-09-21
| | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | prune: Print a message if there is nothing to prune.Andre Noll2019-09-21
| | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | get_snapshot_list(): Add comment about sorting.Andre Noll2019-09-21
| | | | | | | | | | | | | | | | | | | | Callers rely on the returned snapshot list being sorted by creation time, so let's document this fact.
| * | | prune: Fail gracefully if pre-rm hook fails.Andre Noll2019-09-21
| |/ / | | | | | | | | | | | | | | | 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.
* | | Merge branch 'refs/heads/t/svg-logo' into nextAndre Noll2019-09-18
|\ \ \ | | |/ | |/| | | | | | | * refs/heads/t/svg-logo: Redo the logo as svg.
| * | Redo the logo as svg.Andre Noll2019-09-18
| |/ | | | | | | | | | | | | | | | | 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.
* | Merge branch 'master' into nextAndre Noll2019-09-18
|\| | | | | | | * master:
| * Merge branch 'refs/heads/t/multiple-source-dirs'Andre Noll2019-09-18
| |\ | | | | | | | | | | | | | | | | | | | | | 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.
* | \ Merge branch 'refs/heads/t/multiple-source-dirs' into nextAndre Noll2019-09-03
|\ \ \ | | |/ | |/| | | | | | | * refs/heads/t/multiple-source-dirs: create_rsync_argv(): Allocate correctly sized arg array.
| * | create_rsync_argv(): Allocate correctly sized arg array.Andre Noll2019-09-03
| | | | | | | | | | | | | | | | | | 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.
* | | Merge branch 'master' into nextAndre Noll2019-02-11
|\ \ \ | | |/ | |/| | | | | | | | | | * master: Remove stale comment. Improve comment of snapshot_currently_being_removed.
| * | Remove stale comment.Andre Noll2019-02-10
| | | | | | | | | | | | | | | | | | 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 *.
| * | Improve comment of snapshot_currently_being_removed.Andre Noll2019-02-10
| | | | | | | | | | | | The old comment did not provide any information at all..
* | | Merge remote-tracking branch 'refs/remotes/bthcx/next' into nextAndre Noll2019-02-10
|\ \ \ | | | | | | | | | | | | * refs/remotes/bthcx/next:
| * | | Merge branch 'master' into nextAndre Noll2019-02-10
| |\| | | | |/ | |/| | | | | | | * master: Add link to author homepage.
* | | Merge branch 'master' into nextAndre Noll2019-02-09
|\ \ \ | |/ / |/| / | |/ | | * master: Add link to author homepage.
| * Add link to author homepage.Andre Noll2019-02-01
| | | | | | | | | | People who like dss might also be interested in other projects of the author.
* | Support multiple source directories.Andre Noll2018-06-08
|/ | | | | | | | | | | 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>
* Fixed typo.Sanja Jasek2018-06-04
| | | | Signed-off-by: Andre Noll <maan@tuebingen.mpg.de>
* dss-1.0.0.v1.0.0Andre Noll2017-11-19
|
* Add missing newline to --version output.Andre Noll2017-11-19
|
* run: Don't kill children twice.Andre Noll2017-11-19
| | | | | | | | | | | | | | | 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.
* Fix compute_next_snapshot_time().Andre Noll2017-11-19
| | | | | | | | | | | | | | | | | 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.
* ipc.c: Remove a dead store.Andre Noll2017-11-19
| | | | | scan-build correctly points out that the value stored to 'name' is never read.
* Silence a bogus scan-build warning.Andre Noll2017-11-19
| | | | | | | 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.
* Replace license boilerplate with single line SPDX comments.Andre Noll2017-11-19
| | | | | | | | | | | | | | | | | | | | 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.
* Merge branch 'refs/heads/t/kill-w'Andre Noll2017-11-18
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * kill: New option --wait.Andre Noll2017-11-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * run: Wait for children to die.Andre Noll2017-11-02
| | | | | | | | | | | | | | | | 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.
* | Merge branch 'refs/heads/t/exit-hook'Andre Noll2017-11-17
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | 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.