On Thursday 17 July 2008 16:24, Bernhard Fischer wrote:
> On Tue, Jul 15, 2008 at 09:41:57PM +0000, Vladimir Dronnikov wrote:
> >I was waiting for a draft to be committed so we could work on
> >particular piece of code. Thank you for applying, Denys!
>
> Folks, looking at the code that was committed, i'm questioning if
> crap^Wstuff like that should be enabled per default since even the
> simplest stuff (nameif) segfaulted.
>
> Either we wait for patches to mature to some degree
The idea was to use config parser on a few applets and shake off
some bugs.
> (do at least
> some minimal testing) or experimental stuff should be put on a hack-away
> branch, really.
>
> Anyway. I've touched the parser now and converted init to use it (see
> r22865 and before). Of course i did _not_ test it, so if init somehow
> fails to chdir to your slash and prints a message telling you that
> it does a countdown for self-destruction then that's somehow expected ;)
/* optional_tty:ignored_runlevel:action:command
* i.e. 4 tokens, minimum number of tokens is 2 ("::sysinit:echo foo")
* We require tokens not to be collapsed -- need exactly 4 tokens.
*/
while (config_read(parser, token, -4, 2, ":", '#') >= 0) {
If you need exactly four tokens, use -4, 4, not -4, 2.
int action = -1;
char *tty = token[0];
char *action_string = token[2];
char *command = token[3];
if (action_string)
action = index_in_strings(actions, action_string);
and then you won't need to check for NULL like you do it here.
if (action < 0 || !command || !strlen(command))
goto bad_entry;
if (tty) {
/* turn .*TTY -> /dev/TTY */
if (!strncmp(tty, "/dev/", 5))
tty += 5;
tty = concat_path_file("/dev/", tty);
} else
tty = ""; /* XXX: ugh. */
char* = const char* doesnt compile for me.
I will work on this
> >2008/7/15, Denys Vlasenko <[EMAIL PROTECTED]>:
> >> On Tuesday 15 July 2008 06:31, Vladimir Dronnikov wrote:
> >>> As I expected the gain regarding the only applet is not big (if any).
> >>> But to develop common interfaces is definitely an important task in
> >>> the long run. Even if not applied directly one may use config_*()
> >>> prototypes inline with some code thrown, and still the logic would
> >>> retain and would provide the right results. There would be no need to
> >>> reinvent the wheel.
> >>
> >> Ok, I applied the patch.
> >>
> >> Making it all cute in one go seems to be difficult, so I propose
> >> the following plan:
> >>
> >> - convert more applets to it
>
> Let's build a list (perhaps in TODO) so we can check if all potential
> users are cought.
>
> + ifupdown
> - init
> + dumpleases ? Does that make sense?
> + inetd
> + bb__pgsreader()
>
> >> - ifupdowm will require "comment only if # is first non-space char" fix
>
> It would be fancy if we can avoid using regexes. To recognize "/* */"
> style comments, perhaps some variant of index_in_strings-kind of comment
> skipper would be useful or needed? (well no. for C-style comments we
> would have to resort to carefully chosen regex, i fear)
> >> - etc
> >> - code size in config_read() calls: add define magic to collapse
> >> ntokens/mintokens/comment params into one int param (similar to
> >> #define xrealloc_vector trick)
> >> - optimize runtime space usage even more by collapsing consecutive
> >> delimiters
> >> - speed up
> >> - see big fat comment at libbb/get_line_from_file.c how to spped up
> >> line reads (and maybe even fix sed in the process)
> >> - fix "mdev -s" to not rescan config file two zillion times
> >>
> >> I do not mean that _you_ (or anyone else) *must* to work on this.
> >> (But this would be nice of you if you do).
> >> It is meant to be an explanation "why we just committed 300+ bloat,
> >> and how we will fix it" :)
Well, there are positive sides. Vladimir has ideas for code size
reduction which I dont, and also he is farly active.
Just look how many new applets he contributed.
--
vda
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox