00TODO: Tasks left to accomplish before rc is complete Unfinished business Manpage options incorrectly specifies multiple rc.funcs. Manpage reorganization lacks important option combination info. What when multiple command interpreters and one --print or --eval given? File rc.func totally undocumented, but logic should be clear. Check combo options for correctness, like config contains exc, evl, prn. Consider forking at rc_proc.c:procRun/exec so rc keeps in control afterwards. Remove termination of pRc->m_pAnal->m_szRcs[nIter] chain, obselete by m_nRcs. Work with Ralf to explore his idea of arbitrary section regex substring spec. Probably get rid of all warning exceptions, since ctrl flow doesn't continue. Control flow Explain logical ordering of multiple section spanning multiple rcfiles. Give example semantics of a common scenario. No error semantics in pseudocode. Remove all character strings from code to rc_const.h rc_script.c:254 isspace nimmt nicht char sondern unsigned char her Known bugs Not multithreaded (too many potentials for race conditions or overwrite) Not efficient (reads whole files when only parts are needed...) What's going on with ^ in patterns? Something is broken. Resolve memory leaks with Dmalloc, ask for help. Original rc logic is probably wrong, because with globbing multiple sections of a rcfile are not kept together (logic copied anyways.) Rc file prefix rc. is hardcoded, and when wildcard is given, the prefix is used in selecting files. Location is not properly used. See rc_anal.c. when a section is not found, the config is also not executed Eval mode is temporarily broken Eval and print mode, when -u given '#u' printed, but not always This is a problem if the following section is printed without '#u' Document Refs, pri, user, group, ci, go only in normal (not special) sections. Section definition regular expressions need to follow a format ()\2. Questions Should location regex specify a directory and prefix separately, or files*? Should we just parse %config of labels which have matching %<...> sections? Under which user/priority does the %config and %common sections run? Are there bugs due to unused 'volatile' identifiers? Variation to OpenPKG rc OpenPKG puts sections with no -p at end, but we give them implicitly -p 200 Temp files no longer have pids in their file names during eval mode Consider Nice to have feature for ex, a pEx->pObj->strErr(pEx->Value); Removing the OSSP_RC_DEACT deactivation feature (thl.) Offer include directive in config file. Dynamic handling of command interpreter option. Use anchored regexs (PCRE_ANCHORED) so that bar/.* doesn't match foobar/quux. If a requested section doesn't exist, should the rcfile's %config be added? Interpreter option irgendwo dass hat global scope. Als variable in %config Section? Option --search (for .saved postfix), and section %found (for --search) Must do Translate rc bourne shell script to ISO C. Finish man page. Start latex or Docbook guide. If a variable is defined for which no default exists, warn user (Scholli.) Make own config, get rid of val because it doesn't hold strings. Write interlocking increment for thread-safe increments. Config object probably doesn't need a m_nLocks mutex, though. Convert some normal assert() to real runtime checks. Use str_hash von ossp str or static RC_XXX_VAL array from rc_option.h. Restore lost multiple location merging logic. Use OSSP cfg library for dotconf parsing, ask Ralf to help. Make rc_section_t correspond to rc_section.c with own operators. Make consistent, sectionGetdata and scriptTostring should have same names Add printVerbal() to section class, removing 'if (configGetval(RC_VRB_VAL))' Allow multiple identical section names (having different -u values) Implementation Correct assertion, sanity check, and if () checks according to one standard. Make variable naming standard m_pksz?, and correct throughout. Correct according to a method naming standard like Method. Remove redundant method prototypes in main header file. Relocate rc_anal_t and other to approproate header files rc_anal.h. I think rc_anal is violating the singleton configuration. Totally remove warnings from the exception logic Additional Request 14 was acted upon. This is a comment. It is not sent to the Requestor(s). _________________________________________________________________________ URL: https://rt.openpkg.org/id/14 Ticket: [OpenPKG #14] Subject: apache: invalid rc script arguments are ignored Requestors: markus.sander@de.cw.com Queue: openpkg Owner: Nobody Status: new Transaction: Comments added by rse Time: Tue Jun 03 16:45:08 2003 _________________________________________________________________________ This should be fixed with the new OSSP rc, but unfortunately the situation is complex: on "rc foo bad", "rc" could complain if rc.foo does not contain a "%bad". But what should it do on "rc all bad"? I think, in this situation is should not complain for all rc.* which do not contain "%bad", of course. Except: IF ALL rc.* DO NOT CONTAIN %bad! mlelstv: What we need is some kind of sanity checking. For example, the rc file could prevent a service from beeing started when there is a .rpmsave configuration present. Change data type locations to private for additional abstraction Index: ossp-pkg/cfg/cfg_buf.c ============================================================ +struct cfg_buf_st { + char *buf_ptr; + size_t buf_size; + size_t buf_len; +}; + Index: ossp-pkg/cfg/cfg_buf.h ============================================================ struct cfg_buf_st; typedef struct cfg_buf_st cfg_buf_t; -struct cfg_buf_st { - char *buf_ptr; - size_t buf_size; - size_t buf_len; -}; - Release plan ------------ Version 0.8 DropIn Milestone 1, Drop in replacement for OpenPKG. Version 0.9 FeatureComplete Milestone 2, Additional features in build. Version 1.0 StableRelease Milestone 3, Cleanup and bugfix. Version 1.2 Milestone 4, Krasse L2 Logging und eigene Sprache Dreams Log to an L2 channel Channel specification could go in rc.conf Processing language !if !else (conditional processing can cross-reference local config vars) !print (print something to stdout) !logit (log something, mstone1-3 to syslog, mstone4 to L2) !lineno [LAST] (the current line number or last successful command) !rcfile [EXISTS|ABSOLUTE] (info about an rcfile) # Is there a way to merge rcfile and rc processor contexts? !envarpush (push an environment variable on the rc stack) !envarpop (pop an environment variable from the rc stack) !throw [var] (returns var to rc processor and ask rc to return -1) !exit [var] (returns var to the rc processor and asks rc to abort execution) !return (signals end of section and returns var to rc processor) ... /-------------------OSSP rc Inhalt------------------\ | Manpage | | rc.1 Section 1 oder 8-Konflict? | | rc-sample.5 Vielleicht umnennen rc.samples.5 | | rc.conf.5 Beschreibung aber kein Beispiel | | | | Geliefert | | rc.env Leer | | rc.conf Ausgekommentet Beispiel | | | | Beispiele | | rc.example Soll rc.foo umgenannt werden | \---------------------------------------------------/ Pseudocode *********************************** * psoudocode implementation of rc * *********************************** parse command line merge all 'rc.conf' files read environment variables build option table parse 'Locate' Locate /cw/etc/rc.d/rc.%{RCFILE:s/^all$/*/} Locate /cw/local/etc/rc.d/rc.%{RCFILE:s/^all$/*/} Locate %{RCFILE}/.duerc Locate ${HOME}/.duerc:m/^(.*)<\/dir>/i Locate ${HOME}/.duerc.%{RCFILE:s/^\///:s/[\/]/-/g} Locate path/file/regex:regex_inside_file for each 'Locate' { for each (all rcfiles after variable expansion and shell globbing) { apply path conversion to rcfilename continue if (absolute path seen previously) // avoid duplicates if (filename matches given rcfile) if (securitycheck(RequireUmask, RequireOwner, RequireGroup)) read and strip file ('Locate' regex, after colon) } } for each rcfile_fraction { parse into blocks according to --ParseSectionDef take out %config section according to --NameConfig take out %common section according to --NameCommon take out %error section according to --NameError take out %default section according to --NameDefault app.mapSections; // create the section map } mapSections () // Map nonexisting %sections to %default { // from now on, 'section' implies 'section->lookupMapval' while (tempSection := ParsedCLI->nextSection) // CLI = command line iface if (rcfile_fraction->has(tempSection)) rcfile_fraction->sectionNames += tempSection; else if (rcfile_fraction->has(%default)) rcfile_fraction->sectionNames += %default; else handle error } for each section on command line { if (multiple rcfiles, i.e. all) sort rcfiles by section priority (%defaults are last) for each rcfile { script = ""; script += %config from rcfile script += rc.env (overriding any duplicate values) create_rcfile_script(script, section, recurse=no) expand internal variables execute, print, or printeval script with user & group priveleges and command interpreter according to options or section header } } EXIT create_rcfile_script(script, section, recurse) { script += "${body}" // start with a pseudo value if (!recurse) { // only one rc.func is possible if no ${body} in rc.func->%common prepend ${body} to rc.func->%common replace script->${body} with rc.func->%common } if no ${body} in rcfile->%common prepend ${body} to rcfile->%common replace script->${body} with rcfile->%common if (!recurse) { // only one rc.func is possible if no ${body} in rc.func->%section prepend ${body} to rc.func->%section replace script->${body} with rc.func->%section } replace script->${body} with rcfile->%section while (ref := ParseSectionRef(script)) ref->create_rcfile_script(recurse=yes); } Test cases ********************* * Test cases for rc * ********************* Pre: tar zxvf ossprc-0.9.tar.gz cd ossprc-0.9 ./configure make su make install export OSSP_RC_ROOT=/etc/ossprc/ Assume: Installed program 'mycom' in /usr/local/bin/mycom Valid OSSP run command file rc.mycom in /etc/ossprc/rc.d File rc.mycom contains the sections start, sync, and restart Begin: $ rc mycom start sync restart Output: Post: Procedure: