Add two new tests for para_server. In a (non-public) development branch the add subcommand was broken although t0004-server exercises this subcommand and reported no error. The bug went unnoticed because it would only bite when the subcommand was given a directory to add, but the test specifies a pathname which refers to a regular file. To detect such breakage early, add a test which tries to add a directory and another which exercises the rm command.
Add test to check whether empty mood arguments are rejected. To make sure a recent bug won't be re-introduced. The test succeeds but fails with commit 2c2d3a6ec34d983cb698b245facb8d6240aec1b3 reverted. We have to add at least one mood to trigger the bug. Since addmood is a stdin command we must redirect stdin for the para_client command. It does not hurt to do this for all commands, not just the new one.
t0004: Always create PEM keys. New versions of ssh-keygen create RFC4716 keys by default, which breakes the test suite. Fortunately, the fix is easy and works also for old versions of openssh/ssh-keygen.
Introduce lsu.{c,h}, implement help --long for para_server. This adds the --long option to the server help subcommand. The former help output becomes the long help while the short help text is shown if --long is not given. Although only the help command of para_server is converted in this patch, the new functionality is implemented in a generic way so that the help commands of para_audiod and para_play can use the same implementation. Those will be converted in subsequent patches. t0004 parses the help output and thus needs to be changed to include --long.
server: Remove -F option to ls. Quoting the current help text of the option: This option is the default, so it does nothing. Deprecated as of v0.6.0, scheduled for removal in v0.6.1. This patch gets rid of the option and also adjusts the test suite, which still used it.
server: Convert non-afs commands to lopsub. Currently the server commands are divided into two group: those commands which are handled by the server process and those which communicate with the afs process. This commit converts the commands of the former group and the corresponding completers for para_client to the lopsub suite format while the afs commands will be converted in subsequent commits. After this change para_server needs to be linked with -llopsub. To this aim the options and help texts of of the server commands are transferred from server.cmd to the new server_cmd.suite.m4, enabling long-style options in the progress. Moreover, an introduction is added at the beginning of the list of server commands which describes how server commands are executed. Command permissions are now handled by making use of the aux_info feature of lopsub. To keep those commands working which do not have any permission bit set, we need to add a new identifier NO_PERMISSION_REQUIRED to enum server_command_permissions of user_list.h. The value of this identifier is zero of course. Naturally the bulk of the change takes place in command.c where all server commands are implemented. The command handlers are modified to take a pointer to a struct lls_parse result as an additional argument. A new helper, send_errctx(), is introduced to avoid code duplication. Since command.h now refers to a lopsub parse result, all files which include command.h, including those which implement only afs commands, need to include the system header lopsub.h. To keep afs commands working, some compatibility code in run_command() is added. This will go away after all commands have been converted. A couple of macros in command.h ease the handling of the long symbolic constants exposed by the generated lopsub header file. Although only the non-afs commands are converted, the change allows for a couple of cleanups: * The E_BAD_COMMAND error code is no longer needed and has been removed. * cmd_perms_itohuman() has become unused and is removed. * The server_cmds[] array is empty and can be removed, along with the loop in send_list_of_commands() which iterated over the array. The patch also adjusts tests t0004 and t0005 since the help output format changed slightly, breaking the expectations of these tests.
t0004: Specify proper options for ls commands. The -p option is deprecated, and the default behaviour (if none of -p, -F and -b is given) will change in v0.6.0. Although the tests succeed at the moment, it seems prudent to switch to the modern syntax to make sure the tests won't break when -p is removed and the default behaviour is changed.
test suite: Fail test if para_server could not be started. In t0004-server.sh, we start the server in daemon mode without checking the exit code. If it fails to start, there is no point in trying to run the tests of this file. This commit adds the missing check.
Add test that exercises attribute code. This test would fail without the previous fix that changed the shifted integers to 64 bit.
t0004: Switch to new syntax for ls command. The old way of specifying ls options is deprecated and should no longer be used.
aft: Store resolved paths when adding files. Currently the add command performs some sanity checks on the given paths, but stores them unmodified in the audio file table if they pass the checks. This commit removes the checks in favor of a call to realpath(3) to get the canonicalized absolute pathname to be stored in the audio file table. The new code relies on POSIX.1-2008 semantics. That is, it calls realpath() with second argument NULL to let the function allocate a suitably sized buffer. This should not be a problem, since the old POSIX.1-2001 version is broken by design, and all moderately recent systems support the new semantics. This change breaks t0004 which expects the ls -p command to print the same paths that were used earlier to add audio files, which is no longer true. We fix the test by simply running ls without the -p option.
test suite: Change underscores to dashes also in tests script options. The previous commit broke t0004. Fix is trivial.
Fix t0004-server. Currently we try to generate an ssh key and start para_server even if the ssh-keygen executable was not found or para_server was not built. Fix this by starting para_server only of both executables exist.
testsuite: Introduce a new test for para_server. This adds t0004-server.sh, a new test script which starts para_server and tries to connect to it using the loopback device.