summaryrefslogtreecommitdiff
path: root/string.c (unfollow)
Commit message (Collapse)Author
2025-02-01Dedoxify the source.Andre Noll
The doxygen comments actually make the source code harder to read, because they tend to document the obvious. Besides, they are not used uniformly accross the code base anyway.
2024-08-08dss-1.0.2.v1.0.2Andre Noll
2024-07-18New subcommand: help.Andre Noll
It's sometimes handy to just type e.g. "dss help run" to see the synopsis and the options of the ls subcommand.
2024-07-02Provide a static binary.Andre Noll
For users which can't be bothered to use git or compile from source.
2024-07-02build: Move m4-only definitions to separate file.Andre Noll
We currently pass a number of variables to m4 by specifying command line options of the form -D var=val. This approach makes the output of "make V=1" very verbose due to the three multi-line descriptions. To addresses this issue, introduce defs.m4 which contains one m4 macro definition for each former make variable. The end result should be identical. We tweak the M4 make variable to always read defs.m4 before the first regular input file so that the suite and the web page see the definitions. The third user of the former make variables is the README phony target. To convert this as well, we rename the README file to README.m4 and adjust the rule of the README phony target to run m4 on this file. Switch to saner m4 quoting characters while at it.
2024-07-02Move snapshot distribution explanation to separate man section.Andre Noll
Since the new section contains a table, we have to tell groff to run the tbl preprocessor to generate the html version of the man page. We now pass -I image to the groff postprocessor so that the png image file gets a predictable name. We'd love to pass --image‐directory=build/ to place the png file in the build directory, but this also creates html like <img src="build/image1.png">, which does not work because index.html is in build/. Change the cwd to the build directory to work around this.
2024-07-02Add phony targets distclean and maintainer-clean.Andre Noll
With the patch applied, "make clean" keeps files generated by lopsub and m4, "make distclean" removes the build directory, and "make maintainer-clean" removes all untracked files except Makefile.local.
2024-07-02index.html: Inline the svg image.Andre Noll
This way the web page can be installed by copying a single html file. It also speeds up page loading since no additional http request is needed to download the image file.
2024-07-02build: New phony target "www".Andre Noll
This saves some typing as the simple "make www" now builds index.html and the html version of the man page.
2024-07-02build: Move recipe for index.html to proper place.Andre Noll
There's no reason for this to be after the README stuff.
2024-07-02build: Generate intermediate files in build/.Andre Noll
This way the intermediate files don't clobber the top level of the working directory. Also the clean phony target becomes simpler.
2024-07-02index.html: Adjust font size for code.Andre Noll
At least on some firefox versions, the characters of the default monospace font look a bit small.
2024-07-02index.html: Right-justify the text.Andre Noll
This looks much better. We don't want that for table cells, though.
2024-07-02index.html: Remove navigation menu.Andre Noll
The page has become simple enough, making the navigation links useless. The page no longer contains any <hr> tags, so remove the corresponding part of the style sheet.
2024-07-02index.html: Inline style sheet.Andre Noll
This should speed up page loading because it saves the additional http connection to the web server to download dss.css.
2024-07-02No longer include NEWS in index.html.Andre Noll
It's not like the dss project saw lots of news lately, and the old news items only clutter the web page. This removes the last invocation of markdown(1), making the build independent of the discount converter. We keep maintaining the NEWS file in the repo, however. It's just no longer part of the web page.
2024-07-02index.html: Simplify make rule.Andre Noll
This avoids index.html.in and parses index.html.m4 only once.
2024-07-02Kill INSTALL.Andre Noll
Move the installation instructions to index.html.m4 and the configuration bits to the new examples section of the man page. Streamline the installation instructions and recommend to install the debian package of lopsub.
2024-07-02index.html: Move man page to separate web page.Andre Noll
This shortens index.html and simplifies the build because we can ditch the sed command which cuts out the body of the html generated by groff(1).
2024-07-02index.html: Replace license section from index.html by simple link.Andre Noll
No need to have a full section for a single sentence. Just add an item in the resource section which states the same information.
2024-07-02Centralize meta information about dss.Andre Noll
This defines a couple of package related variables in Makefile, renames dss.suite -> dss.suite.m4 and index.html.in -> index.html.m4, and tweaks the recipes to generate dss.suite and index.html.in from the m4 files, referring to these variables. The contents of the README file are moved into Makefile so that the three paragraphs can be printed with make README.
2024-07-02Improve README.Andre Noll
This streamlines the text to some extent, omitting the comparison to tape backups, which is not really interesting for most users.
2024-07-02build: Compress the man page.Andre Noll
Run gzip with -n to make the build reproducible.
2024-07-02Avoid rebuilds of lopsub-generated files.Andre Noll
Without having the .PRECIOUS special target depending on these, the files get removed after a successful build and a subsequent make run has to rebuild them.
2024-07-02build: Use variables for lobsubgen, groff and rm commands.Andre Noll
2024-07-02Make the build quiet by default.Andre Noll
This teaches make(1) to give all lines of the recipe to a single shell invocation, speeding up the build and facilitating the simple SAY function to quieten the build. The old verbose output can still be obtained by running make V=1.
2024-07-02build: Dynamic dependency creation and versioning.Andre Noll
This gets rid of Makefile.deps in favor of one auto-generated .d file per .c file, and adds version-gen.sh, a shell script executed by make(1) which tries to determine the version number that is going to be incorporated into the executable via the generated version.c.
2024-06-26Consult $HOME and $LOGNAME rather than calling getpwuid(),Andre Noll
Quiting getpwnam(3): An application that wants to determine its user’s home directory should inspect the value of HOME (rather than the value getpwuid(getuid())->pw_dir) since this allows the user to modify their notion of "the home directory" during a login session. The old behaviour of get_homedir() to return "/tmp" in the error case is misleading at best, so abort in this case.
2024-06-26Kill COMPILE_TIME_LOGLEVEL.Andre Noll
Nobody has ever used this, and the build gets never tested with non-default compile time loglevel, so...
2024-05-23Compute ipc key only once.Andre Noll
It's easier if dss.c passes the hash of the the config file path to the ipc functions than to pass a char pointer.
2024-05-23Resolve config file path only once.Andre Noll
Currently we call get_config_file_name() before each call call to a public function of ipc.c because those functions compute the IPC key from the filename. This is unnecessary and caused several bugs. Clean up this mess by computing the filename only once and store it in a global variable.
2024-05-23Use standard realpath(3).Andre Noll
These days we may rely on the POSIX 2008 semantics of this function, so remove our open-coded version.
2024-04-25Support local make files.Andre Noll
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.
2023-11-07Fix --config-file for relative paths.Andre Noll
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.
2020-05-17Avoid duplicate error message.Andre Noll
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().
2019-11-08dss-1.0.1.v1.0.1Andre Noll
2019-10-25daemon_init(): Do not set umask to zero.Andre Noll
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.
2019-10-25Fix logic to append slash to the source directory.Andre Noll
This bug was introduced recently in commit dd3f58c0bdf1 (create_rsync_argv(): Allocate correctly sized arg array) which redefined N.
2019-10-13Simplify split_args().Andre Noll
Both callers pass the same value for the delimiters, so we can remove the last argument of the function.
2019-09-21Introduce prune --disk-space.Andre Noll
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.
2019-09-21Revamp com_prune().Andre Noll
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.
2019-09-21Factor out find_removable_snapshot().Andre Noll
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().
2019-09-21prune Simplify rm exit code logic.Andre Noll
We can rely on the fact that wait_for_remove_process() sets snapshot_removal_status to the correct value on success.
2019-09-21find_oldest_removable_snapshot(): Improve log message.Andre Noll
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.
2019-09-21prune: Print a message if there is nothing to prune.Andre Noll
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.
2019-09-21get_snapshot_list(): Add comment about sorting.Andre Noll
Callers rely on the returned snapshot list being sorted by creation time, so let's document this fact.
2019-09-21prune: Fail gracefully if pre-rm hook fails.Andre Noll
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.
2019-09-18Redo the logo as svg.Andre Noll
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.
2019-09-03create_rsync_argv(): Allocate correctly sized arg array.Andre Noll
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.
2019-02-10Remove stale comment.Andre Noll
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 *.