ifup run-parts not found

Denys Vlasenko vda.linux at googlemail.com
Thu Jun 18 06:43:29 UTC 2009


On Wednesday 17 June 2009 23:55, Rob Landley wrote:
> > I do not want to translate anything. Its a huge PITA with no real
> > gain. Command line users already know English well enough
> > to understand the simple subset of it used in messages.
> 
> Sounds good to me.
> 
> > > which doesn't seem like something
> > > you'd want to do to a search path.
> >
> > Thus, messages.c is more like strings.c.
> 
> I still find its existence a bit confusing.  The first string in there, 
> bb_msg_memory_exhausted, exists so things like ash can reimplement xmalloc() 
> and xrealloc() and xstrdup() and friends.  I'm really not sure why they do 
> that, considering that even on a 32 bit system allocation calls will only ever 
> return 0 if you've exhausted _virtual_ address space, and a lack of _physical_ 
> memory will get detected later at page fault time by the OOM killer, so it's 
> not a very useful indicator of anything.  (Unless ash is going to start 
> supporting nommu systems soon?  Even so, why does it have a different mechanism 
> than the rest of busybox?  Historical reasons?)
> 
> Common messages like that make me think "common code is being reimplemented in 
> multiple places".  Otherwise why would multiple places need to use the same 
> messages?

Because ash historically has some funky allocator (I know nothing
about it, don't ask). xsetenv() is another good example where it is needed:

# grep -r -B4 bb_msg_memory_exhausted .
./libbb/messages.c-
./libbb/messages.c-const char bb_banner[] ALIGN1 = BANNER;
./libbb/messages.c-
./libbb/messages.c-
./libbb/messages.c:const char bb_msg_memory_exhausted[] ALIGN1 = "memory exhausted";
--
./libbb/xfuncs_printf.c-void* FAST_FUNC malloc_or_warn(size_t size)
./libbb/xfuncs_printf.c-{
./libbb/xfuncs_printf.c-        void *ptr = malloc(size);
./libbb/xfuncs_printf.c-        if (ptr == NULL && size != 0)
./libbb/xfuncs_printf.c:                bb_error_msg(bb_msg_memory_exhausted);
--
./libbb/xfuncs_printf.c-void* FAST_FUNC xmalloc(size_t size)
./libbb/xfuncs_printf.c-{
./libbb/xfuncs_printf.c-        void *ptr = malloc(size);
./libbb/xfuncs_printf.c-        if (ptr == NULL && size != 0)
./libbb/xfuncs_printf.c:                bb_error_msg_and_die(bb_msg_memory_exhausted);
--
./libbb/xfuncs_printf.c-void* FAST_FUNC xrealloc(void *ptr, size_t size)
./libbb/xfuncs_printf.c-{
./libbb/xfuncs_printf.c-        ptr = realloc(ptr, size);
./libbb/xfuncs_printf.c-        if (ptr == NULL && size != 0)
./libbb/xfuncs_printf.c:                bb_error_msg_and_die(bb_msg_memory_exhausted);
--
./libbb/xfuncs_printf.c-
./libbb/xfuncs_printf.c-        t = strdup(s);
./libbb/xfuncs_printf.c-
./libbb/xfuncs_printf.c-        if (t == NULL)
./libbb/xfuncs_printf.c:                bb_error_msg_and_die(bb_msg_memory_exhausted);
--
./libbb/xfuncs_printf.c-        va_end(p);
./libbb/xfuncs_printf.c-#endif
./libbb/xfuncs_printf.c-
./libbb/xfuncs_printf.c-        if (r < 0)
./libbb/xfuncs_printf.c:                bb_error_msg_and_die(bb_msg_memory_exhausted);
--
./libbb/xfuncs_printf.c-
./libbb/xfuncs_printf.c-void FAST_FUNC xsetenv(const char *key, const char *value)
./libbb/xfuncs_printf.c-{
./libbb/xfuncs_printf.c-        if (setenv(key, value, 1))
./libbb/xfuncs_printf.c:                bb_error_msg_and_die(bb_msg_memory_exhausted);
--
./shell/ash.c-ckrealloc(void * p, size_t nbytes)
./shell/ash.c-{
./shell/ash.c-  p = realloc(p, nbytes);
./shell/ash.c-  if (!p)
./shell/ash.c:          ash_msg_and_raise_error(bb_msg_memory_exhausted);
--
./shell/ash.c-ckstrdup(const char *s)
./shell/ash.c-{
./shell/ash.c-  char *p = strdup(s);
./shell/ash.c-  if (!p)
./shell/ash.c:          ash_msg_and_raise_error(bb_msg_memory_exhausted);
--
./shell/ash.c-          if (blocksize < MINSIZE)
./shell/ash.c-                  blocksize = MINSIZE;
./shell/ash.c-          len = sizeof(struct stack_block) - MINSIZE + blocksize;
./shell/ash.c-          if (len < blocksize)
./shell/ash.c:                  ash_msg_and_raise_error(bb_msg_memory_exhausted);
--
./shell/ash.c-  size_t newlen;
./shell/ash.c-
./shell/ash.c-  newlen = g_stacknleft * 2;
./shell/ash.c-  if (newlen < g_stacknleft)
./shell/ash.c:          ash_msg_and_raise_error(bb_msg_memory_exhausted);
--
./shell/msh.c-# define bb_dev_null "/dev/null"
./shell/msh.c-# define DEFAULT_SHELL "/proc/self/exe"
./shell/msh.c-# define bb_banner "busybox standalone"
./shell/msh.c-# define ENABLE_FEATURE_SH_STANDALONE 0
./shell/msh.c:# define bb_msg_memory_exhausted "memory exhausted"
--
./shell/msh.c-                  *v = tp;
./shell/msh.c-                  return "no shell";
./shell/msh.c-
./shell/msh.c-          case ENOMEM:
./shell/msh.c:                  return (char *) bb_msg_memory_exhausted;
--
./shell/msh.c-  DBGPRINTF3(("GRAVE: i is %p\n", io));
./shell/msh.c-
./shell/msh.c-  if (i < 0) {
./shell/msh.c-          closepipe(pf);
./shell/msh.c:          err((char *) bb_msg_memory_exhausted);
--
./include/libbb.h-
./include/libbb.h-extern const char *applet_name;
./include/libbb.h-/* "BusyBox vN.N.N (timestamp or extra_version)" */
./include/libbb.h-extern const char bb_banner[];
./include/libbb.h:extern const char bb_msg_memory_exhausted[];

> > Because I want to cheat:
> 
> Always a good reason. :)
> 
> > bb_PATH_root_path + sizeof("PATH=/sbin:/usr/sbin") is a non-root PATH.
> 
> It might be nice to add a comment in the source code acknowledging that 
> _PATH_STDPATH exists and we've chosen not to use it because XXX.

It is sort-of-documented: include/libbb.h:

/* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin,
 * but I want to save a few bytes here */
extern const char bb_PATH_root_path[]; /* "PATH=/sbin:/usr/sbin:/bin:/usr/bin" */
#define bb_default_root_path (bb_PATH_root_path + sizeof("PATH"))
#define bb_default_path      (bb_PATH_root_path + sizeof("PATH=/sbin:/usr/sbin"))

--
vda


More information about the busybox mailing list