aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFiles
2020-12-08Global env statement.Sergey Poznyakoff24
* NEWS: Update. * doc/pies.texi: Document the global env statement. * src/pies.c: Modify "env" callbacks to expect a envop_t ** as modifiable target. Introduce global env statement. * tests/envglobal.at: New test. * tests/Makefile.am: Add new file.
2020-12-08Improve syslog redirectionSergey Poznyakoff3
* NEWS: Change wording a bit. * src/progman.c (redirect_to_file): Close and deregister the descriptor on error and EOF. * src/syslog.c (pies_log_tag): Rename to log_tag. (reopen_logger): Use PIES_LOG_DEV if log_dev is NULL. (pies_syslog_set_dev): Free previously allocated log_tag (if any).
2020-12-07BugfixSergey Poznyakoff2
* src/syslog.c (pies_syslog_set_dev): Fix the return value.
2020-12-07Fix changing of the syslog dev. Fix bugs in closing unnecessary fds. Version ↵Sergey Poznyakoff7
1.4.96 * lib/closefds.c [HAVE_FUNC_PROC_PIDINFO] (close_fds_sys): Fix algorithm. * src/pies.c (cb_syslog_dev): New callback. Handle "dev" using it. (main): Don't close fd 2 before restarting. * src/pies_syslog.h (pies_syslog_set_dev): New proto. * src/progman.c (prog_start,run_command): Don't close necessary fds. * src/syslog.c (pies_log_dev): Mark as static. (pies_syslog_set_dev): New function.
2020-12-07Version 1.4.95Sergey Poznyakoff6
* NEWS: Version 1.4.95 * configure.ac: Likewise. * doc/ctl.texi: Fix formatting of JSON selectors. @deffn is unable to handle them properly. * doc/pies.texi: Minor changes. * src/progman.c (open_redirector): Minor change to avoid spurious varning. * src/syslog.c: Assume conservative value instead of unportable HOST_NAME_MAX.
2020-12-07Add missing fileSergey Poznyakoff1
2020-12-07New API endpoint /alive. Improve documentation.Sergey Poznyakoff7
* doc/Makefile.am: Add ctl.texi * doc/ctl.texi: New file. * doc/pies.texi: Add anchors for ctl.texi * src/ctl.c (json_error_reply_create): Set status depending on the HTTP response code. Use "message", instead of "error_message". New endpoint: /alive * src/inetd.c: Use grecs_getline instead of getline. * src/sysvinit.c: Likewise. * src/piesctl.c: Inspect "message", instead of "error_message".
2020-12-05Remove the component.facility keyword. Update the docs.Sergey Poznyakoff9
* NEWS: Update. * doc/pies.texi: Update. * src/pies.h (component): Remove the facility field. * src/comp.c: Likewise. * configure.ac: Select interface to use to close fds (imported from mailutils). * lib/closefds.c: New file (imported from mailutils). * lib/Makefile.am: Add closefds.c * lib/libpies.h (pies_close_fds): New proto. * src/pies.c: Use pies_close_fds * src/progman.c: Likewise.
2020-12-05Accept full facility.priority in std{out,err} syslog statement.Sergey Poznyakoff2
* src/pies.c (string_to_syslog_facility): Take additional length argument. (string_to_syslog_fp): New function. (_cb_redir): Accept full facility.priority specification. * src/piesctl.c: Remove legacy redirector support.
2020-12-04Rewrite stdout/stderr redirectionSergey Poznyakoff12
Instead of spawning a subprocess for each redirection, read the output directly from pipe and send it to syslog using an asynchronous syslog implementation. * src/syslog.c: New file. * src/pies_syslog.h: New file. * src/Makefile.am: Add syslog.c and pies_syslog.h * src/comp.c (component_create): Use pies_log_facility. * src/ctl.c (auth_prog) (prog_serialize): Remove TYPE_REDIRECTOR case * src/diag.c (syslog_printer): Use pies_vsyslog. (syslog_open): Use pies_syslog_open. (syslog_close): Use pies_syslog_close. (diag_setup): Use pies_syslog_open. * src/pies.c (log_facility, log_tag): Remove globals. Use pies_log_facility and pies_log_tag instead. New configuration statement syslog.dev * src/pies.h: Include pies_syslog.h (register_socket,register_program_socket): Additional argument: free_data. * src/prog.h (TYPE_REDIRECTOR): Remove. (prog.v.p.redir): Change data type. (prog.v.r): Remove. * src/progman.c (prog_tag) (destroy_prog) (progman_cleanup): Remove TYPE_REDIRECTOR case (prog_stop_redirectors): Deregister fds (redir_tag,register_redir) (update_redir): Remove. (open_redirector): Rewrite. Set up direct reader from the stream, instead of spawning a subprocess. (prog_start): Change open_redirector actual arguments. * src/socket.c (sockinst): New member: free_data. (register_socket): Initialize the free_data member. (register_program_socket): Likewise.
2020-12-02Version 1.4.94Sergey Poznyakoff2
2020-12-02Actually fix the reporting of argv when expandenv is set.Sergey Poznyakoff1
* src/progman.c (prog_start_prologue): Split into two functions: prog_init, invoked before fork, and prog_start_prologue proper, invoked after fork. prog_init initializes the environment, argc, and argv associated with prog. (progman_run_comp): Call prog_init before calling prog_start_prologue (the function is called from child process). (prog_start): Run prog_init before forking.
2020-12-02Fix reporting of the argv over the control interface (improves c0f4c3b99b)Sergey Poznyakoff7
2020-12-02Version 1.4.92Sergey Poznyakoff2
2020-12-02Improve documentationSergey Poznyakoff3
* doc/pies.texi: Improve documentation of variable expansion and the use of pies in docker entry points. * src/pies.h (vlogmsg): New proto. * src/progman.c (prog_start_prologue): Set ws_error member to ensure errors from ${X:?WORD} construct are properly reported.
2020-12-02Minor fixes in the docsSergey Poznyakoff1
2020-12-02New component flag: expandenvSergey Poznyakoff10
* NEWS: Update. * doc/pies.texi: Document the expandenv flag. * src/comp.c (component_finish): Warn if both "shell" and "expandenv" are used together. Expand command to argc/argv only unless the CF_EXPANDENV flag is given. * src/pies.c (str_to_cf): New flag: expandenv * src/pies.h (CF_EXPANDENV): New define. * src/prog.h (struct prog): New member: argv. * src/progman.c (destroy_prog): Free argv. (prog_start_prologue): Expand the command line taking into account the current environment if CF_EXPANDENV flag is given. Otherwise, copy the component argv to the prog. (prog_execute): Use prog->v.p.argv * tests/Makefile.am: Add expandenv.at * tests/testsuite.at: Likewise. * tests/expandenv.at: New file.
2020-10-18Fix cyclic dependecy detection and reporting.Sergey Poznyakoff6
Use modified Floyd-Warshall algorithm for cyclic dependecy detection. The computed next vertex indices are used when reporting the cycles found. This fixes dead loops that occurred in earlier versions when trying to report cycles. One of inputs that caused such behavior is used as a new test in cyclic.at. * src/depmap.c: Rewrite using modified Floyd-Warshall algorithm. (depmap_cycle_detect,depmap_path_free): New functions. * src/comp.c (report_cyclic_dependency): Take struct depmap_path * as argument. (component_build_depmap): Use depmap_cycle_detect to detect cyclic dependencies. (depmap_dump): Special handling for zero-sized depmap. * tests/cyclic.at: Add new test. * src/pies.h (depmap_dim, depmap_free) (depmap_cycle_detect,depmap_path_free): New protos. * NEWS: Document changes.
2020-10-17Update copyright yearsSergey Poznyakoff94
2020-10-17Automatically detect if pies is started from dockerSergey Poznyakoff6
* lib/envop.c: Include sys/types.h (for ssize_t). * src/pies.c (is_docker,no_init_option,init_detect): New functions. (main): Call init_detect. * src/utmp.c: Additional cpp magic to determine WTMPX_FILE and UTMPX_FILE. * NEWS: Document the changes. * doc/pies.texi: Likewise. Also, fix improper node name (inetd.conf). * configure.ac: Version 1.4.91
2020-10-12Make sure exited preprocessor gets cleaned up when running with PID 1.Sergey Poznyakoff3
* NEWS: Version 1.4.90 * configure.ac: Version 1.4.90 * src/pies.c (main): When running with PID 1, install a minimal SIGCHLD handler before parsing configuration files.
2020-06-14Fix datetime testsSergey Poznyakoff1
* tests/builtin.at (IT_SPECIAL): Force TZ=0 to avoid false failures due to DST.
2020-06-14Use grecs with wordsplit v1.1Sergey Poznyakoff1
2019-07-10Switch to grecs b06fb7d3Sergey Poznyakoff3
2019-07-02Fix doc/manual generationSergey Poznyakoff1
2019-07-02Version 1.4release-1.4Sergey Poznyakoff3
2019-06-24Add missing libintl libraries in testsSergey Poznyakoff1
2019-06-24Minor changesSergey Poznyakoff10
* configure.ac: Minor changes * lib/libpies.h: Add missing include. * src/Makefile.am (pies_LDADD piesctl_LDADD): Add libintl libs * src/progman.c: Remove useless code. * tests/accept.at: Use canonical ordering of options and arguments. * tests/builtin.at: Likewise. * tests/inet.at: Likewise. * tests/maxinst.at: Likewise. * tests/passfd.at: Likewise. * tests/version.at: Don't expect GNU sed
2019-06-24Enable/disable SystemV init code at compile timeSergey Poznyakoff11
* configure.ac: New option --enable-sysvinit. Disable the init code if RUN_LVL is not available. (PIES_SYSVINIT_ENABLED): New configuration define. (PIES_COND_SYSVINIT): New condition Print configuration settings summary. * src/pies.h (is_sysvinit): Check for PIES_SYSVINIT_ENABLED. (SYSVINIT_ACTIVE): New macro. * grecs: Upgrade. * src/Makefile.am: Conditionally link sysvinit-related code. * src/cmdline.opt: Disable the --telinit option if sysvinit support is not available. (parse_options): Use SYSVINIT_ACTIVE in the conditional. * src/comp.c (component_verify): Check if component definition is allowed by the current state of the sysvinit support. * src/ctl.c: Disable the /runlevel entry point if sysvinit support is not compiled. * src/diag.c (stderr_open): Make sure sysvinit-related code is not compiled if the sysvinit support is not available. * src/pies.c (config_syntax_tab): Add entry for CONF_INITTAB only if sysvinit support is available. (_cb_initdefault,_cb_runlevels): Remove. Use cb_initdefault and cb_runlevels instead. (component_keywords): Disable runlevels without sysvinit support. (pies_keywords): Same for initdefault. Use SYSVINIT_ACTIVE to suppress compilation of sysvinit code without sysvinit support. * src/progman.c: Use SYSVINIT_ACTIVE to suppress compilation of sysvinit code without sysvinit support. * src/sysvinit.c (cb_initdefault,cb_runlevels): New functions.
2019-06-13Minor fixesSergey Poznyakoff2
* grecs: Pull 12304127b5 * src/pies.c: Fix help message.
2019-06-12Version 1.3.92Sergey Poznyakoff10
2019-06-12More tests for built-in servicesSergey Poznyakoff3
* tests/builtin.at: Check tcpmux services. * tests/nt.c: Add tcpmux support, improve error checking. * tests/chargen.c: Improve error checking.
2019-06-12Check accept components and inet built-in services.Sergey Poznyakoff14
* src/comp.c (component_verify,component_finish): Fix check for the presense of the "command" statement. * src/pies.c (component_keywords): Reorder some entries for the consistency of config-help output. * tests/.gitignore: Add new files. * tests/Makefile.am: Add new tests and noinst programs. * tests/accept.at: New test. * tests/builtin.at: New test. * tests/chargen.c: New file. * tests/readtime.c: New file. * tests/recvfd.c: Rewrite for testing both accept and pass-fd components. * tests/passfd.at: Pass -s option to recvfd * tests/testsuite.at: Add new tests. * tests/lines.c: Minor changes. * tests/nt.c: Minor changes. * tests/to.c: Minor changes.
2019-06-11Test pass-fd componentsSergey Poznyakoff7
* tests/recvfd.c: New source. * tests/.gitignore: Update. * tests/passfd.at: New test. * tests/Makefile.am: Add new test. * tests/testsuite.at: Add new test. * tests/nt.c: Check all revents bits.
2019-06-11Improve the nt tool. Test inet running instance limit.Sergey Poznyakoff8
* tests/Makefile.am: Add new test. * tests/aux/in.test (PIESCTL): Provide the necessary options. Discontinue the use of STOPCMD environment variable. New commands: enable, sleep, touch. * tests/testsuite.at (PIES_CONTROL_INIT): Rename pidfile to PIES_PIDFILE and ctlsock to PIES_CTLSOCK. Export both. Include maxinst.at * tests/control.at: Use new variables. * tests/inet.at: Remove the env block. * tests/iobuf.h (iobuf_copy): Return number of bytes copied. * tests/maxinst.at: New file. * tests/nt.c (netcat_stream_disconnect): New function. (netcat_stream_read): Disconnect the peer stream if no more input is available and the peer is not available for output (i.e. its output buffer is empty). (netcat_stream_write): Stop polling if output buffer is empty. (netcat): Fix event mask
2019-06-10Fix coredumpSergey Poznyakoff1
* src/comp.c (component_build_depmap): Defer removal of the component to the end of the run
2019-06-10BugfixSergey Poznyakoff1
* tests/nt.c: Trivial fixes
2019-06-09Test inetd components.Sergey Poznyakoff12
* lib/Makefile.am: Add urlconn.c * lib/libpies.h (url_connect): New proto. * lib/urlconn.c: New file. * src/piesctl.c (shttp_connect): Use url_connect. * tests/.gitignore: Update. * tests/Makefile.am: New auxtool: aux/in.test New test: inet.at * tests/aux/in.test: New file. * tests/inet.at: New file. * tests/iobuf.h: New file. * tests/nt.c: New file. * tests/testsuite.at: Add new test. * tests/to.c: explicitly terminate the child process on timeout.
2019-06-07Implement additional env.eval statementSergey Poznyakoff4
2019-06-06Bugfix in grecs (pull c31f6e9769)Sergey Poznyakoff1
2019-06-06Change syntax of the env.clear statement.Sergey Poznyakoff6
It no longer requires an argument. The correct syntax is env { clear; }
2019-06-06Update the grecs submoduleSergey Poznyakoff11
* configure.ac (GRECS_SETUP): Request the tree-api * grecs: Pull a0c096190f * lib/envop.c (environ_set): Call wordsplit_free unconditionally. * lib/grecsasrt.c (assert_grecs_value_type) (assert_scalar_stmt): Remove. (conf_callback_url): Switch to tree-api. * lib/grecsasrt.h: Likewise. * src/acl.c: Rewrite grecs callbacks in the tree API style. Use grecs assertions. * src/acl.h: Likewise. * src/meta1parse.c: Likewise. * src/pies.c: Likewise. * src/piesctl.c: Likewise. * src/comp.c (component_finish): Check whether the "command" statement was used.
2019-06-03Minor fixesSergey Poznyakoff1
2019-06-03Finish the env re-implementationSergey Poznyakoff9
* NEWS: Document the "env" statement and the PIES_MASTER_PID environment variable. Version 1.3.91 * configure.ac: Version 1.3.91 * doc/pies.texi: Document the new "env" statement syntax. Provide instructions on how to convert legacy "env" statement to the new form. * lib/envop.c (environ_unset): Take reference value as argument. If supplied, unset the variable only if its value matches the reference one. * lib/envop.h (environ_unset): Change proto. * src/pies.c (parse_legacy_env): Minor changes. (_cb_env_unset): Allow to specify value. * src/progman.c (run_command): Define PIES_MASTER_PID. * tests/env.at: Check the legacy env syntax. * tests/envop.at: Additional checks.
2019-06-02Speed up tests.Sergey Poznyakoff8
Presence of the ~/.netrc file can slow down execution because of eventual DNS calls in hostcmp. Provide an option to disable netrc parsing and use it in tests. * src/piesctl-cl.opt: New option: --no-netrc. * doc/pies.texi: Document --no-netrc * src/piesctl.c (shttp_connect): Don't read ~/.netrc if given --no-netrc. * tests/env.at: Pass --no-netrc to piesctl. * tests/respawn.at: Likewise. * tests/shell.at: Likewise. * tests/shutdown.at: Likewise. * tests/startup.at: Likewise.
2019-06-02Rewrite the testsuiteSergey Poznyakoff17
The aim is to run pies in foreground if possible. Limit execution time using external wrapper. * src/pies.c: (_cb_redir): Consistently return 1 on errors. * tests/aux/sleepexit: New file. * tests/aux/startcheck: New file. * tests/aux/touchfile: Change arguments. * tests/aux/respawn: Rewrite. * tests/lines.c: New noinst program. * tests/to.c: New noinst program. * tests/.gitignore: Add new programs. * tests/Makefile.am: Update. * tests/env.at: Use to to avoid hanging forever. Add missing popdef. * tests/redirect.at: Use echo as component program. * tests/respawn.at: Run pies in foreground. Use to to limit execution time. * tests/shell.at: Likewise. * tests/shutdown.at: Likewise. * tests/startup.at: Likewise. * tests/ret-exec.at: Use sleepexit as component program. * tests/ret-notify.at: Likewise.
2019-06-02New configuration statement for manipulating the environment.Sergey Poznyakoff16
The "env" statement is now a compound statement. It can contain four substatements: "clear" to clear the environment, "keep" to retain certain variable while clearing it, "set" to set a variable, and "unset" to unset a variable or variables. Both "keep" and "unset" can take globbing pattern as their argument, in which case they affect all variable matching that pattern. The value part in the "set" statement is subject to variable expansion, e.g. set "MANPATH=$MANPATH${MANPATH:+:}/usr/local/man" The support for the old one-line syntax of "env" is retained for backward compatibility. This commit also fixes redirection to a file: new data are appended to the file, instead of overwriting it. * lib/Makefile.am: Add new files. * lib/envop.c: New file. * lib/envop.h: New file. * lib/wildmatch.c: New file. * src/comp.c (component_free): Update. * src/pies.c (argv_free): New function. (parse_legacy_env): New function. (_cb_env): Remove. (cb_env_section_parser): New function. (cb_env_keywords): New keywords for the "env" block statement: clear, keep, set, unset. (component_keywords): New compount statement: env. Old usage retained for backward compatibility. * src/pies.h: Include "envop.h" (component)<env>: Remove. <envop>: New field. * src/prog.h (prog)<env>: New field. * src/progman.c (redirect_to_file): Position to the end of file. (DEBUG_ENVIRON): Remove macro. (debug_environ): New function. (environ_setup): Remove. (prog_sockenv): Use environ_set to modify local copy of environment. (prog_start_prologue): Use environ_create + envop_exec to create and modify the environment. (prog_execute): Set environment to prog-local copy. * tests/.gitignore: Build envtest * tests/Makefile.am: Add new tests. * tests/testsuite.at: Add environment tests. * tests/envop.at: New file. * tests/envtest.c: New file. * tests/env.at: New file. * tests/redirect.at: Check first two lines of the output file.
2019-05-31Minor fixSergey Poznyakoff1
* tests/shell.at: Append to the outfile instead of overwriting it.
2019-05-31Provide an option to run commands via sh -cSergey Poznyakoff10
The new flag "shell" instructs pies to run the command marked with it as '/bin/sh -c $command'. Alternative shell can be supplied ising the 'program' statement. This is useful if the command line uses shell-specific features (command or variable expansion, redirection, pipes, etc.) This commit also fixes a bug in the 'env' statement handling: a single argument with embedded whitespaces was undergoing word splitting and thus incorrectly handled as multiple arguments. * NEWS: Document changes. * doc/pies.texi: Likewise. * src/comp.c (component_free): Free command. (component_finish): Split command into argv/argc as directed by the CF_SHELL flag. * src/pies.c (_cb_command): Remove. Functionality moved to component_finish(). (_cb_env): Bugfix. Don't split arguments. * src/pies.h (CF_SHELL): New flag. (component) <command>: New member. * tests/Makefile.am: Add new tests. * tests/testsuite.at: Add new tests. * tests/aux/respawn: Change default timeout to 1 second. * tests/respawn.at: Minor change. * tests/shell.at: New test.
2019-05-28Permit stdout redirection for startup and shutdown components.Sergey Poznyakoff1
* src/progman.c (register_prog0): Preserve comp->redir[RETR_OUT].type for exec, startup, and shutdown components.

Return to:

Send suggestions and report system problems to the System administrator.