From https://bugs.freebsd.org/248536: if you try to use a directory base name with a hyphen in it, you get a confusing error message. The man page for periodic says:
Since one specifies information about a directory using shell variables containing the string, <basedir>, <basedir> must only contain characters that are valid within a sh(1) variable name, alphanumerics and underscores, and the first character may not be numeric.
This patch adds an explicit check of the directory name, so you'll get a sensible error message if you try to do this.
Additionally, periodic gives an error if it can't find a directory passed in with an absolute path, but it does not give an error if it was passed in with a relative path. This patch adds an error for that.
Finally, this patch replaces ${x##*/}, which removes everything before and including the last slash in a path x, with $(basename x). The old version works for paths like a/b/c, but not ones like a/b/c/.