paraslash.git
7 years agoConvert para_client to lopsub.
Andre Noll [Sun, 10 Apr 2016 20:29:29 +0000 (22:29 +0200)]
Convert para_client to lopsub.

This replaces the gengetopt command line parser for para_client by a
lopsub suite and links para_client against the lopsub library. The ggo
file for para_client was the last user of m4/gengetopt/complete.m4,
so this file can be removed.

The tricky part is create_merged_lpr(), which replaces
make_client_argv(). It is called from the i9e line handler and from
the completers. The new function merges the original parse result
with the arguments given at the command line to produce the parse
result stored in the client task structure.

The completers no longer duplicate the possible options each server
subcommand because the header file generated by lopsubgen exposes
an array of string literals which is suitable as the opts argument
of i9e_complete_option().

7 years agoConvert receivers to lopsub.
Andre Noll [Mon, 22 Aug 2016 13:13:40 +0000 (15:13 +0200)]
Convert receivers to lopsub.

This converts the four receivers (afh, http, dccp, udp) to use the
lopsub library instead of gengetopt.

The command line options of the receivers are implemented as
subcommands of the new recv_cmd lopsub suite. Hence the four gengetopt
command line parsers and ->ggo_help of struct receiver can be removed.

This change allows to get rid of the receiver array which was defined
through the DEFINE_RECEIVER_ARRAY macro.  We now store each receiver
structure in the user_data pointer provided by lopsub.

Since this structure is initialized at compile time (and constant since
->ggo_help is gone), ->init() of struct receiver is no longer needed to
initialize the various function pointers. The function is now optional
and does not take an argument any more. At the moment, only the afh
receiver needs ->init() to initialize all supported audio format handlers.

t0005 needs slight adjustment since the section headers of the help text
have changed a bit.

7 years agoConvert audioc to lopsub.
Andre Noll [Sun, 7 Aug 2016 22:01:19 +0000 (00:01 +0200)]
Convert audioc to lopsub.

This changes para_audioc to use the lopsub library rather than
gengetopt for parsing the command line options. The gengetopt input
file m4/gengetopt/audioc.m4 is replaced by an equivalent suite file,
audioc.c is adjusted to call the lopsub primitives instead if the
gengetopt parsers, and para_audioc is linked against lopsub. Moreover,
the manual page of audioc is now generated with lopsubgen.

Since this is the first executable which is converted, the commit
introduces a fair amount of infrastructure which will also be used
by other executables. Specifically:

* Common command line options (--help, --detailed-help, --version,
--loglevel, --history_file, --complete) are stored in per-option
files below m4/lls/include. Each of these files is included from
audioc.suite.m4. To tell make which files audioc.suite depends on,
we use the line synchronization feature of m4 and a simple awk script
to create a .m4d file which contains these dependencies, similar to
the .d files which describe dependencies of .c and .h files. The new
m4_lls_deps make variable contains the set of .m4d files.

* A generic copyright section for the man page which refers to the
COPYRIGHT_YEAR macro, defined from the make variable in Makefile.real.

* The new make variable LOGLEVELS. We need to know the set of loglevels
in the suite files as well as in the C code, so the variable avoids
to duplicate this information.

7 years agoRemove *.cmd and command_util.bash.
Andre Noll [Sat, 31 Dec 2016 19:07:33 +0000 (20:07 +0100)]
Remove *.cmd and command_util.bash.

The four *.cmd files are no longer needed and can be removed,
along with the script which transformed these files into C code. The
directory for the generated files, $(build_dir)/cmdlist, can go away
as well.

With command_util.bash gone, the Makefile can also be cleaned up
considerably. In particular, the ugly TOUPPER make function can be
removed because it was only used by the command_util recipe. Moreover,
The dependencies for the *.command_list.* files are no longer needed.

Finally, the sed command which fixed up the dependencies in the *.d
files can be simplified.

7 years agoplay: Remove support for non-lopsub commands.
Andre Noll [Mon, 7 Sep 2015 21:40:58 +0000 (23:40 +0200)]
play: Remove support for non-lopsub commands.

This cleans up play.c to get rid of struct pp_command, the array of
command handlers and the compatibility code for non-lopsub commands
in run_command() and com_help().

Also the FOR_EACH_COMMAND() macro to iterate over all non-lopsub
commands can go away and we no longer need to include the
play.command_list.h header generated by command_util.bash.

7 years agoplay: Convert com_quit() to lopsub.
Andre Noll [Mon, 28 Mar 2016 03:52:25 +0000 (03:52 +0000)]
play: Convert com_quit() to lopsub.

This converts the last subcommand of para_play. Cleanups are done in
subsequent patches although the declarations of the command handlers
are removed here because they have become unused and triggered
compiler warnings.

7 years agoplay: Convert com_tasks() to lopsub.
Andre Noll [Mon, 28 Mar 2016 03:51:23 +0000 (03:51 +0000)]
play: Convert com_tasks() to lopsub.

Nothing to see here: only the usual changes to the command handler,
and no changes to the help text.

7 years agoplay: Convert com_pause() to lopsub.
Andre Noll [Mon, 28 Mar 2016 03:50:36 +0000 (03:50 +0000)]
play: Convert com_pause() to lopsub.

The argc check can be removed from the command handler of this
subcommand. Other than that no changes to (the body of) com_pause()
are necessary.

7 years agoplay: Convert com_play() to lopsub.
Andre Noll [Mon, 28 Mar 2016 03:49:45 +0000 (03:49 +0000)]
play: Convert com_play() to lopsub.

Straight forward conversion, slight improvement of the help text.

7 years agoplay: Convert com_info() to lopsub.
Andre Noll [Mon, 28 Mar 2016 03:48:50 +0000 (03:48 +0000)]
play: Convert com_info() to lopsub.

This also improves the help text slightly to be more specific about
the output of the subcommand.

7 years agoplay: Convert com_ls() to lopsub.
Andre Noll [Mon, 28 Mar 2016 03:47:55 +0000 (03:47 +0000)]
play: Convert com_ls() to lopsub.

This also gets rid of the undocumented pattern matching. The command
now takes no arguments and always lists all files.

7 years agoplay: Convert com_ff() to lopsub.
Andre Noll [Mon, 28 Mar 2016 03:47:07 +0000 (03:47 +0000)]
play: Convert com_ff() to lopsub.

Converting com_ff() is analogous to com_jmp() since both subcommands
take a single integer argument. See the commit message of the previous
commit which converted com_jmp() for more information.

7 years agoplay: Convert com_jmp() to lopsub.
Andre Noll [Mon, 28 Mar 2016 16:55:58 +0000 (16:55 +0000)]
play: Convert com_jmp() to lopsub.

The command handler needs to check that there is a single argument
which is an integer between 0 and 100. This check needs to be modified
to use the lopsub primitives rather than accessing the argument
vector directly.

Unfortunately we can not perform the conversion of the string argument
into an int value with lopsub since the given percentage is an unnamed
option rather than an argument of an option.

The patch also rewords the summary and the help text of the jmp
subcommand slightly to be more clear.

7 years agoplay: Convert com_bg() to lopsub.
Andre Noll [Mon, 28 Mar 2016 16:55:42 +0000 (16:55 +0000)]
play: Convert com_bg() to lopsub.

There is not much to convert since the command takes no arguments,
and thus lpr is unused. The commit gets rid of the argc check which
is performed by lopsub and fixes a typo in the command summary:
s/input/insert.

7 years agoplay: Convert com_prev() to lopsub.
Andre Noll [Mon, 7 Sep 2015 20:30:31 +0000 (22:30 +0200)]
play: Convert com_prev() to lopsub.

The arg count check can be removed from the command handler, and the
pointless help text of the commit has been removed because it said
more or less the same as the summary text.

7 years agoplay: Convert com_next() to lopsub.
Andre Noll [Mon, 28 Mar 2016 04:05:14 +0000 (04:05 +0000)]
play: Convert com_next() to lopsub.

com_next() is also called from com_jmp(), where we needed to pass
a fake argv. This is no longer necessary as com_next() now takes
a parse result pointer which is unused. So we may just pass NULL
from com_jmp().

7 years agoplay: Convert com_fg() to lopsub.
Andre Noll [Mon, 28 Mar 2016 04:04:56 +0000 (04:04 +0000)]
play: Convert com_fg() to lopsub.

Lopsub fails to parse the command line if one or more arguments are
given, allowing to remove the check from the command handler.

The commit also extends the help text of the subcommand to mention
that the colon key can also be used to return to input mode.

7 years agoplay: Link against lopsub and convert com_help() to lopsub.
Andre Noll [Sun, 10 Apr 2016 20:02:10 +0000 (22:02 +0200)]
play: Link against lopsub and convert com_help() to lopsub.

This introduces the play_cmd suite for the subcommands of para_play,
like play, pause, fg, bg, etc. The new suite contains only the
"help" subcommand so far. Other commands will be converted one by one
in subsequent patches.

We make use of the lopsub user_data feature to store a pointer to the
command handler in the lls_command structure generated by lopsubgen.
This pointer is initialized by the new EXPORT_PLAY_CMD_HANDLER macro
in play.c.

The suite has no supercommand, therefore lopsubgen adds a special
"unavailable" identifier to play.lsg.h. We must therefore provide a
dummy completer for the fake supercommand.

Until all subcommands are converted, the run_command() and com_help()
subcommand need to iterate over two command lists. Afterwards, this
compatibility code can be removed.

7 years agoafs.c: Remove compatibility code in action_if_pattern_matches().
Andre Noll [Fri, 2 Oct 2015 02:34:53 +0000 (02:34 +0000)]
afs.c: Remove compatibility code in action_if_pattern_matches().

This is no longer needed as there are no more non-lopsub
commands left. Now pmd->lpr is non-NULL for all commands which
call action_if_pattern_matches(), which allows to simplify the
function. Moreover, ->patterns of struct pattern_match_data is unused
and can be dropped.

7 years agoserver: Remove ->argc, ->argv from struct command_context.
Andre Noll [Sun, 22 May 2016 11:37:48 +0000 (13:37 +0200)]
server: Remove ->argc, ->argv from struct command_context.

Command handlers should not look at the argv[] vector directly
but only use the lopsub library functions to access the parsed
command line.

In fact, the only function which accesses the argv vector is
run_command(). Defining argc and argv as local variables in this
function allows to drop the two members from the command context
structure.

7 years agoserver: Remove support for non-lopsub commands.
Andre Noll [Sun, 31 Jul 2016 08:32:57 +0000 (10:32 +0200)]
server: Remove support for non-lopsub commands.

Now that all commands have been converted to lopsub, struct
server_command is no longer needed and can be removed, along with
the helper functions for lookup and permission checking.

7 years agoafs: Remove unused call_callback helpers.
Andre Noll [Sun, 6 Sep 2015 19:01:41 +0000 (21:01 +0200)]
afs: Remove unused call_callback helpers.

send_option_arg_callback_request() and send_standard_callback_request()
have both become unused now that all server commands have been
converted to lopsub. This patch gets rid of these functions and
removes their declarations from afs.h.

7 years agoEnable partial matching for server commands.
Andre Noll [Mon, 5 Sep 2016 15:34:53 +0000 (17:34 +0200)]
Enable partial matching for server commands.

The feature was deactivated in an earlier commit which converted the
lsatt command to lopsub. The problem was that "ls" would have been
interpreted as lsatt because lsatt was the only converted command
that started with ls.

Now that all server commands are converted, the lopsub library function
lls_lookup_subcmd() does the right thing, so this patch removes the
additional test for an exact match.

7 years agols conversion cleanup
Andre Noll [Mon, 26 Dec 2016 14:04:18 +0000 (15:04 +0100)]
ls conversion cleanup

7 years agoserver: Convert com_ls() to lopsub.
Andre Noll [Sun, 27 Dec 2015 22:04:29 +0000 (22:04 +0000)]
server: Convert com_ls() to lopsub.

This is the final server command to be converted to the lopsub API.
Besides the conversion to lopsub, the patch changes the semantics
of the ls command in two ways: The deprecated -p option is removed,
and the -F option is made the default so that full paths are printed
if -b is not given.

Regarding the conversion, the patch removes enum ls_flags which used to
contain the various flags of the ls command. This information can now
be extracted in the callback from the deserialized parse result. Also
write_score() is kind of pointless and is replaced by inlining it.

Note that make_status_items() is also affected by this patch because
it makes use of the infrastructure of the ls command. This function
is called from the event handler of the audio file table for events
of type AFSI_CHANGE and AFHI_CHANGE.

Since no more non-lopsub server commands are left after this patch,
several cleanups are possible. These are dealt with in subsequent
patches.

7 years agoserver: Convert blob commands to lopsub.
Andre Noll [Sun, 20 Mar 2016 18:41:25 +0000 (18:41 +0000)]
server: Convert blob commands to lopsub.

This converts all blob commands (ls, cat rm, mv) in one go to lopsub,
making the patch rather large.

The addblob commands are special in that we must pass not only the
blob name given at the command line to the callback but also the
blob data which was read from stdin. The command handler does not
serialize the parse result like most other commands do, but constructs
a query object containing name and data for the callback. Therefore
the command handler does not call send_lls_callback_request() but
send_callback_request(). We continue to follow this scheme.

blob.c contains a few macros which expand to a set of functions,
one for each type of bloc (mood, playlist, image, lyrics). These
macros have to be adjusted to take another argument because we need
the prefixes (e.g., lyr for lyrics) in both upper and lower case and
there is no preprocessor toupper().

7 years agoserver: Convert com_addatt() to lopsub.
Andre Noll [Fri, 2 Oct 2015 21:13:33 +0000 (21:13 +0000)]
server: Convert com_addatt() to lopsub.

Another simple command without options which is easy to convert. The
only thing worth noting is that we now fail the command early if more
than 64 arguments are given when previously we only checked that at
least one argument is given.

7 years agoserver: Convert com_touch() to lopsub.
Andre Noll [Fri, 2 Oct 2015 21:10:36 +0000 (21:10 +0000)]
server: Convert com_touch() to lopsub.

Another open-coded option parser bites the dust.

This also gets rid of struct com_touch_options, along with the ugly
convention of passing -1 to the action handler to indicate that the
option was not given.

The documentation was enhanced slightly and now explains in the
[description] section the general concept of the touch command.

7 years agoserver: Convert com_select() to lopsub.
Andre Noll [Fri, 2 Oct 2015 21:15:06 +0000 (21:15 +0000)]
server: Convert com_select() to lopsub.

Pretty straight-forward conversion since the command does not have
any arguments. In the callback handler, we we can't return directly
any more since we need to free the serialized parse result.

7 years agoserver: Convert com_rm() to lopsub.
Andre Noll [Sun, 11 Oct 2015 00:17:55 +0000 (00:17 +0000)]
server: Convert com_rm() to lopsub.

This gets rid of the open-coded command line parser in com_rm() and
of enum rm_flags. Patterns are now passed to for_each_matching_row()
and from there to the action handler remove_audio_file() via ->lpr
of struct pattern_match_data.

7 years agoserver: Convert com_rmatt() to lopsub.
Andre Noll [Fri, 2 Oct 2015 21:18:42 +0000 (21:18 +0000)]
server: Convert com_rmatt() to lopsub.

No change to the action handler, remove_attribute(), necessary.

7 years agoserver: Convert com_cpsi() to lopsub.
Andre Noll [Fri, 2 Oct 2015 21:17:09 +0000 (21:17 +0000)]
server: Convert com_cpsi() to lopsub.

Allows to get rid of enum cpsi_flags as we pass the flags via the
serialized parse result to the callback and the action handler
(copy_selector_info()).

Also the open-coded command line parser in com_cpsi() can be removed.

7 years agoserver: Convert com_check() to lopsub.
Andre Noll [Sun, 20 Mar 2016 18:40:50 +0000 (18:40 +0000)]
server: Convert com_check() to lopsub.

Gets rid of enum com_check_flags and the open-coded option parser
of com_check().

Also streamlines the help text of the options a bit.

7 years agoserver: Convert com_mvatt() to lopsub.
Andre Noll [Fri, 2 Oct 2015 21:21:11 +0000 (21:21 +0000)]
server: Convert com_mvatt() to lopsub.

We need to cast the obj->data pointer to a non-constant type because
the osl library functions expect void *, which results in a warning
without the cast.

7 years agoserver: Convert com_setatt() to lopsub.
Andre Noll [Fri, 2 Oct 2015 21:22:01 +0000 (21:22 +0000)]
server: Convert com_setatt() to lopsub.

Introduces ->input_skip for struct pattern_match data. The setatt
command uses this to strip the attribute modifies off the unnamed
arguments in the lopsub parse result. The remaining arguments are
the patterns which are to be matched against each file in the audio
file table.

7 years agoserver: Convert com_lsatt() to lopsub.
Andre Noll [Sun, 20 Mar 2016 18:40:19 +0000 (18:40 +0000)]
server: Convert com_lsatt() to lopsub.

This is the first afs subcommand which needs to pass a pattern list
to its callback. The new send_lls_callback_request() provides this
functionality. It serializes the parse result into a buffer and passes
this buffer to the callback.

Since there are non-lopsub commands which also pass a pattern list,
action_if_pattern_matches() is patched to receive the pattern
list either from the serialized parse result or in the old way via
pmd->data. To achieve this, a parse result pointer is added to struct
pattern_match_data. If this pointer is not NULL, we are dealing with
a subcommand that has been converted.

Since the ls subcommand has not been converted yet, lopsub will
regard "ls" as a uniqe abbreviation of the lsatt command, which
breaks t0004. To work around this, we deactivate prefix matching by
only accepting exact matches in run_command(). This workaround can
be removed after com_ls() has been converted.

7 years agoserver: Convert com_init() to lopsub.
Andre Noll [Fri, 2 Oct 2015 21:23:54 +0000 (21:23 +0000)]
server: Convert com_init() to lopsub.

No change necessary for the callback as the init command does
not have any options. The only information that must travel from the
command handler to the callback is the set of tables to create. The
corresponding bitmask is passed without serializing the parse result.

7 years agoserver: Convert com_add() to lopsub.
Andre Noll [Sun, 15 May 2016 16:53:50 +0000 (18:53 +0200)]
server: Convert com_add() to lopsub.

In the callback structure for the add command, replace the flags
field by the serialized callback result. This way the callback
has access to the full parse result structure.

7 years agoserver: Convert non-afs commands to lopsub.
Andre Noll [Sun, 12 Jun 2016 13:36:21 +0000 (15:36 +0200)]
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.

7 years agoConvert audiod commands to lopsub.
Andre Noll [Sat, 7 May 2016 08:59:01 +0000 (10:59 +0200)]
Convert audiod commands to lopsub.

The four command lists (server, afs, audiod, play) and all executables
will be converted to the long option parser library (lopsub). This
first patch converts the audiod commands (on, off, cycle...) and adds
the necessary infrastructure to the build system. The option parser
for para_audiod is still generated by gengetopt and will be converted
in a subsequent patch.

The build system is updated to include an autoconf test which
checks for the lopsub library and the lopsubgen executable. If the
check fails, it prints instructions on how to download the lopsub
package. Moreover, a section on lopsub is added to the INSTALL file
and the library is listed as a required tool in the manual.

The options and help texts of all audiod commands are moved from
audiod.cmd to the new file audiod_cmd.suite.m4. Until all command
lists are converted, man_util.bash needs an ugly hack to deal with
the two kinds of files.

The help texts have been reworked slightly, but no syntactical
changes were performed. However, one side effect of the change is
that options to audiod commands now accept short and long options,
and that short options may be combined in the usual way.

The error subsystem of paraslash is extended to treat lopsub errors
analogous to errors from the osl libary: we reserve a new bit for
error codes returned from lopsub library functions and a lls() wrapper
function that must be used for all lopsub functions which return a
lopsub error code on failure. The E_INVALID_AUDIOD_CMD error code
can be removed since invalid commands are now detected by the lopsub
library, which returns its own error code in this case.

As a result of the conversion, struct audiod_command can be removed.
Command handlers now take a pointer to a lopsub parse result instead
of the (argc, argv) pair.

The patch also changes the completers for audiod commands in
audioc.c. to use the information in the generated audioc_cmd.lsg.h
header file instead of duplicating this information.

With the patch applied, para_audiod and para_audioc need to be linked
with -llopsub.

We still need to include ggo.h from audiod_command.c until receivers,
filters and writers have been converted as well.

7 years agot0001: Prefer shasum over sha1sum.
Andre Noll [Sun, 8 Jan 2017 16:21:04 +0000 (17:21 +0100)]
t0001: Prefer shasum over sha1sum.

Both programs reliably find mismatches, and the latter is not installed
on FreeBSD.

7 years agoMerge branch 'maint'
Andre Noll [Sun, 19 Mar 2017 15:30:33 +0000 (16:30 +0100)]
Merge branch 'maint'

Two fixes that have been cooking in for-maint for a while.

* maint:
  i9e: Restore file status flags on exit.
  NEWS,md: Add introductory text for v0.5.7.

7 years agoi9e: Restore file status flags on exit.
Andre Noll [Sat, 28 Jan 2017 18:33:26 +0000 (19:33 +0100)]
i9e: Restore file status flags on exit.

The i9e subsystem sets the stdin and stdout fds passed to i9e_open()
to nonblocking mode but misses to restore the original flags in
i9e_close(). This causes terminal applications like dialog to fail
if they are started in the same terminal after e.g. para_play was
executed.

This commit modifies i9e_open() to fetch and save the file status
flags before setting the O_NONBLOCK flag, and i9e_close() to restore
the original value. STDERR is not affected.

7 years agoNEWS,md: Add introductory text for v0.5.7.
Andre Noll [Sun, 22 Jan 2017 22:01:43 +0000 (23:01 +0100)]
NEWS,md: Add introductory text for v0.5.7.

Of course this text should have been added before v0.5.7 was released,
but somehow it got lost.

7 years agoafh.h: Fix typo in prototype of ->get_file_info().
Andre Noll [Wed, 21 Dec 2016 13:27:27 +0000 (14:27 +0100)]
afh.h: Fix typo in prototype of ->get_file_info().

The structure is called afhi throughout the tree.

7 years agoogg_afh_common.c: Remove pointless variable.
Andre Noll [Sun, 25 Dec 2016 23:55:02 +0000 (00:55 +0100)]
ogg_afh_common.c: Remove pointless variable.

The "len" variable is initialized once and never changes.

7 years agoMerge branch 'maint'
Andre Noll [Fri, 6 Jan 2017 15:18:15 +0000 (16:18 +0100)]
Merge branch 'maint'

* maint:
  base64: Remove an unused variable.

7 years agobase64: Remove an unused variable.
Andre Noll [Wed, 4 Jan 2017 20:58:12 +0000 (21:58 +0100)]
base64: Remove an unused variable.

This is only reported on gcc-6 or newer. Not a serious issue, but
still annoying.

7 years agoMerge branch 'maint'
Andre Noll [Sun, 1 Jan 2017 01:24:17 +0000 (02:24 +0100)]
Merge branch 'maint'

* maint:
  Update copyright year to 2017.

7 years agoUpdate copyright year to 2017.
Andre Noll [Sun, 1 Jan 2017 01:21:36 +0000 (02:21 +0100)]
Update copyright year to 2017.

7 years agoparaslash 0.5.7 v0.5.7
Andre Noll [Sat, 31 Dec 2016 20:49:52 +0000 (21:49 +0100)]
paraslash 0.5.7

7 years agoMerge branch 'maint'
Andre Noll [Sat, 31 Dec 2016 20:12:33 +0000 (21:12 +0100)]
Merge branch 'maint'

A trivial conflict in configure.ac and remove/modify conflicts in
web/index.in.html and NEWS. The last file has been renamed to NEWS.md
in master. The conflict was resolved by copying the new text of the
NEWS file from maint (the release notes for v0.4.14) to NEWS.md and
to adjust the formatting to markdown syntax.

7 years agoparaslash 0.4.14 v0.4.14
Andre Noll [Sat, 31 Dec 2016 19:40:51 +0000 (20:40 +0100)]
paraslash 0.4.14

7 years agoMerge branch 'refs/heads/t/simple_error_codes'
Andre Noll [Sat, 31 Dec 2016 15:50:02 +0000 (16:50 +0100)]
Merge branch 'refs/heads/t/simple_error_codes'

Two patches which get rid of the concept of per-subsystem error
codes. The host-compiled error2.c program can be removed, configure.ac
and error.h simplified.

The merge conflicted because both sides modified error.h, but this
was easy to resolve.

* refs/heads/t/simple_error_codes:
  Sort errors alphabetically.
  Simplify the error subsystem, get rid of error2.[ch].

7 years agoMerge branch 'refs/heads/t/doc'
Andre Noll [Sat, 31 Dec 2016 15:43:01 +0000 (16:43 +0100)]
Merge branch 'refs/heads/t/doc'

The contributing section for the user manual and a few other
documentation updates.

* refs/heads/t/doc:
  signal.h: Add documentation of signal_pre_select().
  manual: Fix kernel coding style link.
  user manual: Add section on contributing.

7 years agoMerge branch 'refs/heads/t/invalid-ids'
Andre Noll [Fri, 30 Dec 2016 14:58:41 +0000 (15:58 +0100)]
Merge branch 'refs/heads/t/invalid-ids'

A single patch that was in misc for a while, and two follow up fixups
that were detected after the branch was merged into next.

* refs/heads/t/invalid-ids (cooking for two weeks):
  Makefile: Don't compile with -Wformat-signedness unconditionally.
  aft.c: Use correct format string for error output.
  touch: Refuse to set an invalid image or lyrics ID.

7 years agoMakefile: Don't compile with -Wformat-signedness unconditionally.
Andre Noll [Fri, 30 Dec 2016 14:49:59 +0000 (15:49 +0100)]
Makefile: Don't compile with -Wformat-signedness unconditionally.

This went in by mistake in the previous patch.

7 years agosignal.h: Add documentation of signal_pre_select().
Andre Noll [Tue, 27 Dec 2016 01:01:55 +0000 (02:01 +0100)]
signal.h: Add documentation of signal_pre_select().

It is a public function which should be annotated.

7 years agomanual: Fix kernel coding style link.
Andre Noll [Mon, 26 Dec 2016 20:37:26 +0000 (21:37 +0100)]
manual: Fix kernel coding style link.

The location of the coding style document for the linux kernel
has moved.

7 years agouser manual: Add section on contributing.
Andre Noll [Mon, 26 Dec 2016 16:13:28 +0000 (17:13 +0100)]
user manual: Add section on contributing.

7 years agot0004: Specify proper options for ls commands.
Andre Noll [Wed, 28 Dec 2016 20:40:42 +0000 (21:40 +0100)]
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.

7 years agoMerge branch 'refs/heads/t/format-signedness'
Andre Noll [Wed, 28 Dec 2016 19:38:34 +0000 (20:38 +0100)]
Merge branch 'refs/heads/t/format-signedness'

This series fixes all warnings produced by compiling with
-Wformat-signedness and adds the flag to CFLAGS if the compiler
supports it.

* refs/heads/t/format-signedness (cooking for ~2 weeks):
  gcrypt: Fix a few format-signedness issues.
  Compile with -Wformat-signedness if possible.
  Fix signedness issues in format strings.

7 years agoresample: Simplify initialization().
Andre Noll [Tue, 27 Dec 2016 18:29:38 +0000 (19:29 +0100)]
resample: Simplify initialization().

In resample_init(), the first check removed in this commit was bogus
because in case there is no parent buffer tree node, we must only
abort if there is no input pending either.

In resample_post_select(), we move up the check of the node status
so that we now call resample_init() only after we know that there
is input available. This makes the second check in resample_init()
pointless as the condition can never be true.

7 years agoafh: Make sure we never return a negative chunk number.
Andre Noll [Tue, 20 Dec 2016 20:18:27 +0000 (21:18 +0100)]
afh: Make sure we never return a negative chunk number.

With the old code this could happen if chunk zero is empty.

7 years agofade: Add documentation for main() and include it in doxygen.
Andre Noll [Wed, 28 Dec 2016 01:08:54 +0000 (02:08 +0100)]
fade: Add documentation for main() and include it in doxygen.

The two mixer implementations for OSS and ALSA are also included,
both of which are only used by para_fade. So it makes sense to include
para_fade as well. main() is the only a non-static function, so let's
doxify that.

7 years agosched: Log task termination status.
Andre Noll [Sat, 29 Oct 2016 20:23:14 +0000 (22:23 +0200)]
sched: Log task termination status.

This is generally useful information, so let's include it in the
log message.

7 years agoMerge branch 'refs/heads/t/wma_fixes'
Andre Noll [Wed, 28 Dec 2016 12:05:34 +0000 (13:05 +0100)]
Merge branch 'refs/heads/t/wma_fixes'

The series also contains a fix for a silly bug which causes the decoder
to abort on empty output sizes, and a couple of cosmetic cleanups.

* refs/heads/t/wma_fixes (cooking for two weeks):
  wmadec: Remove two pointless variables.
  wmadec: Remove a pointless cast.
  wmadec: Set data size to 0 if nothing was decoded.
  wma: Fix packet size calculation.
  wmadec: Properly handle empty outputs.
  wma_common: Fix typo in log message.

7 years agoMerge branch 'refs/heads/t/openssl-1.1'
Andre Noll [Tue, 27 Dec 2016 15:29:29 +0000 (16:29 +0100)]
Merge branch 'refs/heads/t/openssl-1.1'

In openssl-1.1 several structures have been made opaque, breaking both
the stream cipher and the public key functions in crypt.c. This series
deals with these issues, trying to minimize the ifdeffery.

* refs/heads/t/openssl-1.1 (cooking for three months):
  openssl: RSA fixes for openssl-1.1.
  openssl: Use EVP API for AES.

7 years agoMerge branch 'refs/heads/t/ls-p_deprecation'
Andre Noll [Mon, 26 Dec 2016 12:27:01 +0000 (13:27 +0100)]
Merge branch 'refs/heads/t/ls-p_deprecation'

Preparation for changing the semantics of the -p option to com_ls()
of para_server. Cooking for four months.

* refs/heads/t/ls-p_deprecation:
  server: Deprecate ls -p.

7 years agoweb: Fix link to git branches.
Andre Noll [Sun, 25 Dec 2016 21:47:14 +0000 (22:47 +0100)]
web: Fix link to git branches.

The link broke several months ago in commit a2c5e36 which converted
the manual to markdown.

7 years agoafh.h: Trivial whitespace fix.
Andre Noll [Sun, 25 Dec 2016 15:02:26 +0000 (16:02 +0100)]
afh.h: Trivial whitespace fix.

Git complains about this: "space before tab in indent".

7 years agoMerge branch 'refs/heads/t/daemonize-fix'
Andre Noll [Sat, 24 Dec 2016 22:25:54 +0000 (23:25 +0100)]
Merge branch 'refs/heads/t/daemonize-fix'

Two bug fixes for race conditions during server startup, and an
improved log message. Cooking for two months.

* refs/heads/t/daemonize-fix:
  server: Fix race condition in afs startup.
  daemon: Fix race condition in daemonize().
  daemon: Improve "daemonizing" log message.

7 years agoportable_io.h: Provide big-endian versions and use them for aac.
Andre Noll [Mon, 16 Dec 2013 21:18:27 +0000 (22:18 +0100)]
portable_io.h: Provide big-endian versions and use them for aac.

The aac audio format handler code contains some instances that read a
big-endian encoded 32 or 64 bit number from a buffer. While for the
32 bit case there is a helper function aac_read_int32(), the 64 bit
case is open-coded.

We already have similar functions for the conversion of little-endian
entities. This patch adds their big endian counterparts as inline
functions to portable_io.h and changes the callers to use those.

The patch also gets rid of two fprintf() statements in write_portable()
which were commented out for ages.

7 years agoaac: Switch from unsigned char to char.
Andre Noll [Mon, 16 Dec 2013 21:06:44 +0000 (22:06 +0100)]
aac: Switch from unsigned char to char.

The faad library functions take unsigned char pointers while most of
the paraslash code prefers plain char *. It's easier to use char *
in all paraslash functions and cast the arguments of the faad library
function calls than to have a mix of both types.

7 years agoplay: Minor log message improvements.
Andre Noll [Tue, 31 Mar 2015 01:33:11 +0000 (01:33 +0000)]
play: Minor log message improvements.

open_new_file() returns an error code on failure, so it should not print
the corresponding strerror text.

The patch also adds messages which logs the active decoder and the
buffer tree with loglevel INFO.

7 years agoSort errors alphabetically.
Andre Noll [Sun, 28 Aug 2016 17:00:11 +0000 (19:00 +0200)]
Sort errors alphabetically.

Keeping the list sorted minimizes the potential for merge conflicts in the
common case where two branches introduce new error codes.

7 years agoSimplify the error subsystem, get rid of error2.[ch].
Andre Noll [Sun, 28 Aug 2016 16:46:22 +0000 (18:46 +0200)]
Simplify the error subsystem, get rid of error2.[ch].

This commit removes error2.c and the surrounding infrastructure of
the build system, getting rid of ~600 LOC.

After the change there are no more subsystems for error codes, and we
don't need to host-compile error2.c any more. Since all executables
now contain the text of every error code, the change has some impact
on the sizes of the (stripped) executables:

     Before:                         After:

 64K para_afh               71K para_afh
 43K para_audioc            47K para_audioc
256K para_audiod           259K para_audiod
 64K para_client            71K para_client
 39K para_fade              47K para_fade
141K para_filter           144K para_filter
 51K para_gui               59K para_gui
252K para_play             255K para_play
 97K para_recv             104K para_recv
227K para_server           230K para_server
 60K para_write             67K para_write

This increase in size is justified by the major simplification.

7 years agoMerge branch 'refs/heads/t/base64'
Andre Noll [Tue, 20 Dec 2016 14:40:09 +0000 (15:40 +0100)]
Merge branch 'refs/heads/t/base64'

A couple of patches which move the base64 code to a separate file,
and improve on it. Was cooking for several months.

* refs/heads/t/base64:
  base64: Speed up decoder by using a table.
  base64: Use para_isspace() everywhere.
  base64: Trivial whitespace fixes.
  base64: Replace Pad64 variable by macro.
  base64: Remove unnecessary overflow checks.
  base64: Saner semantics for base64_decode() and uudecode().
  Move base64 implementation to own file.

7 years agoaft.c: Use correct format string for error output.
Andre Noll [Mon, 19 Dec 2016 23:12:19 +0000 (00:12 +0100)]
aft.c: Use correct format string for error output.

Both ->image_id and ->lyrics_id are of signed type.

7 years agoMerge branch 'refs/heads/t/rm_source_browser'
Andre Noll [Mon, 19 Dec 2016 17:06:52 +0000 (18:06 +0100)]
Merge branch 'refs/heads/t/rm_source_browser'

Cooking for five months.

A single patch which gets rid of the source browser generated with
global, reducing the size of the web pages considerably.

* refs/heads/t/rm_source_browser:
  web: Remove extra source browser.

7 years agowmadec: Remove two pointless variables.
Andre Noll [Thu, 8 Dec 2016 23:22:57 +0000 (00:22 +0100)]
wmadec: Remove two pointless variables.

The local variables n and incr of wma_decode_frame() shadow the
values of their counterparts in struct private_wmadec_data, and they
remain constant within the function. Referring directly to the private
structure instead makes the code shorter and improves readability.

7 years agowmadec: Remove a pointless cast.
Andre Noll [Thu, 8 Dec 2016 22:59:26 +0000 (23:59 +0100)]
wmadec: Remove a pointless cast.

The address of "in" is already of type char **.

7 years agowmadec: Set data size to 0 if nothing was decoded.
Andre Noll [Thu, 8 Dec 2016 20:32:32 +0000 (21:32 +0100)]
wmadec: Set data size to 0 if nothing was decoded.

Without this, we might feed uninitialized data into the output stream.

7 years agowma: Fix packet size calculation.
Andre Noll [Tue, 1 Nov 2016 10:44:53 +0000 (11:44 +0100)]
wma: Fix packet size calculation.

Usually the (fixed) packet size of a wma file equals the block align
value plus WMA_FRAME_SKIP. However, this is not true in general,
and if the two values differ, we fail to decode the file and bail
out with an "incoherent block length" error.

This patch adds code to read the correct packet size from the file
properties object and uses this value in the decoder and the audio
format handler.

7 years agogcrypt: Fix a few format-signedness issues.
Andre Noll [Sun, 11 Dec 2016 10:55:31 +0000 (11:55 +0100)]
gcrypt: Fix a few format-signedness issues.

These were missed in the first batch because gcrypt.c is not compiled
in unless --enable-cryptolib=gcrypt is given.

7 years agowmadec: Properly handle empty outputs.
Andre Noll [Tue, 1 Nov 2016 05:10:00 +0000 (06:10 +0100)]
wmadec: Properly handle empty outputs.

If out_size is zero we try to shrink the buffer to size zero. POSIX
says that the behavior is implementation-defined in this case, and
para_realloc() aborts due to an assert() statement that checks for
size zero. This patch makes sure the wma decoder never calls realloc()
with a zero size argument.

7 years agowma_common: Fix typo in log message.
Andre Noll [Sun, 30 Oct 2016 16:51:50 +0000 (17:51 +0100)]
wma_common: Fix typo in log message.

7 years agoCompile with -Wformat-signedness if possible.
Andre Noll [Wed, 23 Nov 2016 22:17:10 +0000 (23:17 +0100)]
Compile with -Wformat-signedness if possible.

We can't activate this warning unconditionally because it is not
supported on older compilers, including clang. Therefore we introduce
a build time check and add the option only if the compiler supports it.

7 years agoFix signedness issues in format strings.
Andre Noll [Wed, 23 Nov 2016 22:16:50 +0000 (23:16 +0100)]
Fix signedness issues in format strings.

Compiling with -Wformat-signedness (not enabled so far) causes many
warnings because of format strings which specify an unsigned type but
correspond to an argument of signed type, or vice versa. This commit
fixes all these mismatches.

For "%u", "%d", "%lu", "%ld" we let the format string match the
type of the argument, but for "%x" we need to cast the argument to
a suitable unsigned type.

After this patch the tree compiles cleanly with -Wformat-signedness
given. The warning will be enabled in a subsequent commit.

7 years agoMerge branch 'refs/heads/t/sideband-cleanup'
Andre Noll [Sun, 4 Dec 2016 10:10:36 +0000 (11:10 +0100)]
Merge branch 'refs/heads/t/sideband-cleanup'

started on 2016-07-03, cooking since 2016-07-16

para_server announces sideband as an optional feature, which is
pointless since sideband connections have become mandatory in
paraslash-0.5.x, so they are always used. This patch set removes
the feature negitiation during the initial handshake. The sideband
protocol remains and is not affected.

Overwiew of the handshake in v0.5.x:
(SA) server announces sideband
(CC) client fails connection if server did not announce sideband
(CR) client requests sideband
(SC) server fails connection if sideband was not requested
already broken
- client-0.4/server-0.5 (!CR, SC)
- client-0.5/server-0.4 (!SA, CC)

Conversion plan:
rm (CC): breaks nothing
rm (SC): breaks nothing
rm (CR): breaks cl-0.6/server-0.5 (!CR, SC)
rm (SA): breaks cl-0.5/server-0.6 (!SA, CC)
server fails connection if client requests sideband

In this series only the first two conversion steps are done as they
can be merged early without breaking anything.

* refs/heads/t/sideband-cleanup:
  server: Do not fail if client does not request sideband.
  client: No longer fail connection if sideband was not announced.

7 years agoserver: Fix race condition in afs startup.
Andre Noll [Tue, 23 Aug 2016 20:58:46 +0000 (22:58 +0200)]
server: Fix race condition in afs startup.

After server_init() returns, the server accepts connections on the
TCP command socket. If an afs command arrives on the command socket,
the server process forks and the resulting child process (the command
handler) connects to the local afs socket. However, this socket is
created by the afs process which was forked from the server process
in server_init(). It is therefore possible that the command handler
connects before the afs process started to listen on the local afs
socket. In this case, the connection, hence the command fails.

This commit fixes the race condition by letting the parent process
block on read(2) on the afs socket. The afs process writes a byte
to the other end of the socket after it has completed its setup,
causing the parent process to resume.

For this to work, we need a connection-mode byte stream for the
communication between the server and the afs process, rather
than the connectionless datagram socket we have now. There is no
particular reason to prefer a datagram socket here, so let's switch
to SOCK_STREAM.

7 years agodaemon: Fix race condition in daemonize().
Andre Noll [Thu, 16 Jun 2016 18:17:21 +0000 (20:17 +0200)]
daemon: Fix race condition in daemonize().

If parent_waits is true, the parent process waits for a signal from
the child before it exits. However, this signal can arive before the
parent has set up its signal handler.

This patch closes the race window by switching from signals to
pipes. We now create a pipe before the new process is forked, and
let the parent block on read(2) until the child exits or indicates
success by writing a byte to one end of the pipe. The child process
receives the file descriptor of the writing end of the pipe as the
return value of daemonize().

The only user of the parent_waits feature is para_server, which is
changed accordingly.

7 years agotouch: Refuse to set an invalid image or lyrics ID.
Andre Noll [Sat, 26 Mar 2016 22:27:09 +0000 (22:27 +0000)]
touch: Refuse to set an invalid image or lyrics ID.

This makes the callback of the touch command fail the command if the
given ID does not exist in the corresponding blob table.

To this aim we call blob_get_name_by_id() to look up the ID. Since
we are not interested in the name, the function now allows a NULL
result pointer in which case it only checks whether the ID is valid.

With this patch applied the attempt to set an invalid image or lyrics
ID results in an error message like this:

invalid image ID: 456565
remote: key not found in rbtree
main: command failed

7 years agotest-lib: Fix a bash-4.4 issue.
Andre Noll [Sun, 25 Sep 2016 13:56:43 +0000 (15:56 +0200)]
test-lib: Fix a bash-4.4 issue.

Apparently bash-4.4 changed how unquoted here strings are treated.
We want to process only the first line of the output, so the right
thing to do is to ask awk to exit after processing the first line.
This works regardless of the bash version.

7 years agodaemon: Improve "daemonizing" log message.
Andre Noll [Mon, 26 Sep 2016 16:44:39 +0000 (18:44 +0200)]
daemon: Improve "daemonizing" log message.

The function name "daemonize" is shown anyway, so let's print the
path to the log file instead.

7 years agoserver: Deprecate ls -p.
Andre Noll [Wed, 24 Aug 2016 20:18:36 +0000 (22:18 +0200)]
server: Deprecate ls -p.

In v0.6.0 the -p option will have the same meaning as for the rm and
touch commands: perform pathname match. Also the default for the ls
command will be changed to list full paths while the new -b option
must be given to print only the basename (i.e., the current behaviour
if -p is not given).

This commit is a preparation for these incompatible changes which
does not break existing scripts. It does the following

* The -p option is deprecated in favor of its synonym, the new -F
option (for full path).

* The new -b option instructs the command to perform basename matching
and print only the basename of the matching files. It is currently
a no-op.

With the patch applied, scripts are supposed to specify either -b or
-F as appropriate.  In v0.6.0 the semantics of -p will be changed as
described above, the default will be changed to print the full path,
and -F will be deprecated because it is a no-op then.

7 years agoopenssl: RSA fixes for openssl-1.1.
Andre Noll [Sun, 28 Aug 2016 13:35:11 +0000 (15:35 +0200)]
openssl: RSA fixes for openssl-1.1.

In openssl-1.1 the RSA structure has been made opaque, causing
compilation of crypt.c to fail because the code accesses ->n and ->e
directly to set the modulus and the public exponent according to the
values read from the public ssh key.

With openssl-1.1 applications are supposed to call RSA_set0_key()
to set n and e. Unfortunately, this function does not exist in
openssl-1.0.2.

This patch adds a configure check which defines HAVE_RSA_SET0_KEY if
RSA_set0_key() is available. In crypt.c we either call the function
or set ->n and ->e directly, depending on whether HAVE_RSA_SET0_KEY
is defined. This results in code which works on both openssl-1.0.2
and openssl-1.1.0.

7 years agoopenssl: Use EVP API for AES.
Andre Noll [Sun, 28 Aug 2016 13:35:53 +0000 (15:35 +0200)]
openssl: Use EVP API for AES.

opensssl-1.1 no longer exports AES_set_encrypt_key() and
AES_ctr128_encrypt(). Applications are supposed to use the high-level
EVP interface instead.

Fortunately, the EVP library functions necessary for our use of
the AES_ctr128 stream cipher are available in openssl version 1.0.1
and above, so switching to the EVP API makes the code work with all
versions >= 1.0.1.

7 years agobuild: Remove target "dep".
Andre Noll [Sat, 16 Jul 2016 20:47:57 +0000 (22:47 +0200)]
build: Remove target "dep".

It is not needed at all. The attempt to include non-existent or
outdated .d files instructs make to rebuild them.

7 years agoafs: Fix error handling of the select command.
Andre Noll [Sat, 11 Jun 2016 18:44:01 +0000 (20:44 +0200)]
afs: Fix error handling of the select command.

com_select() returns success even if the mood or playlist could not
be activated. This commit changes the function to return the error
code from activate_mood_or_playlist() instead.

The function had another minor issue: If the current mood is the
dummy mood, and we failed to switch to the given mood or playlist,
and also failed to switch back to the dummy mood, we try a second
time to activate the dummy mood. This should not happen, but let's
fix it anyway.