[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: [PATCH] mcookie applet
From: Bernhard Reutner-Fischer <rep.dot.nop () gmail ! com>
Date: 2015-01-31 22:27:23
Message-ID: FEB10324-C11A-479B-BBCE-9DAF1142C57E () gmail ! com
[Download RAW message or body]
On January 31, 2015 7:44:09 PM GMT+01:00, Denys Vlasenko <vda.linux@googlemail.com> \
wrote:
> On Thu, Jan 29, 2015 at 10:16 AM, Bernhard Reutner-Fischer
> <rep.dot.nop@gmail.com> wrote:
> > I have this applet lying around in my tree for some time now.
> > Denys, ok for me to install this one?
> >
> > An alternative would of course be to start a multicall shell script,
> say
> > busybox.sh, installed as /bin/busybox.sh, linked to e.g.
> > /usr/bin/mcookie like:
> >
> > ---8<---
> > #!/bin/sh
> > # Copyright (c) 2012 Bernhard Reutner-Fischer
> > # Licensed under GPLv2 or later
> >
> > case $0 in
> > *mcookie)
> > dd if=/dev/urandom bs=16 count=1 2>/dev/null | hexdump -e
> '"%08x"'
> > ;;
> > *) cat <<-EOH
> > BusyBox v1.24.0.git (2015-01-21 19:22:23 CET) multi-call shell script
> > BusyBox is copyrighted by many authors between 1998-2015.
> > Licensed under GPLv2 or later. See source distribution for detailed
> > copyright notices.
> > EOH
> > ;;
> > esac
> > ---8<---
> >
> > I can whip up the needed infrastructure to host this "applet" and
> other
> > such helpers that can be implemented ontop of existing C applets if
> you
> > prefer.
>
> I certainly prefer this!
> There are a few candidates already in applets_sh/*
I completely missed these, thanks!
>
> I feel it is not obvious it makes sense to have a multi-call shell
> script.
> What are we saving this way?
> Do we plan to have many helper functions there?
> If not, then there is no net win on file size, even some losses -
> you need to have case statement to run different applets.
Fine with me either way.
>
> There is another problem. applets_sh/unix2dos:
>
> #!/bin/sh
> [ $# -ne 0 ] && DASH_I=-i
> sed $DASH_I -e 's/$/\r/' "$@"
>
> This would break if any of "$@" start with dash. If we do this:
>
> [ $# -ne 0 ] && DASH_I="-i --"
> sed -e 's/$/\r/' $DASH_I "$@"
>
> then any argument will be treated as a filename, even "-something"
> or "--" (!!!!) or "--help" - this can break scripts, since unix2dos
> _has_ options,
> and people can call it with options.
>
> http://linux.die.net/man/1/unix2dos
>
> So, maybe we _will_ need non-trivial helper functions to massage arg
> lists,
> handle --help etc, after all.
Individual scripts are OK for me too.
So..
I will have to hardcode the sh-applets into kbuild config hunks and will think about \
a simple way to install them to some predefined location.
Thanks,
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic