Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/debianutils


Ignore:
Timestamp:
Dec 20, 2016, 4:07:32 PM (7 years ago)
Author:
Bruno Cornec
Message:

New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.

Location:
branches/3.3
Files:
7 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/3.3/mindi-busybox/debianutils/Config.src

    r2725 r3621  
    88INSERT
    99
    10 config MKTEMP
    11     bool "mktemp"
    12     default y
    13     help
    14       mktemp is used to create unique temporary files
    15 
    16 config PIPE_PROGRESS
    17     bool "pipe_progress"
    18     default y
    19     help
    20       Display a dot to indicate pipe activity.
    21 
    22 config RUN_PARTS
    23     bool "run-parts"
    24     default y
    25     help
    26       run-parts is a utility designed to run all the scripts in a directory.
    27 
    28       It is useful to set up a directory like cron.daily, where you need to
    29       execute all the scripts in that directory.
    30 
    31       In this implementation of run-parts some features (such as report
    32       mode) are not implemented.
    33 
    34       Unless you know that run-parts is used in some of your scripts
    35       you can safely say N here.
    36 
    37 config FEATURE_RUN_PARTS_LONG_OPTIONS
    38     bool "Enable long options"
    39     default y
    40     depends on RUN_PARTS && LONG_OPTS
    41     help
    42       Support long options for the run-parts applet.
    43 
    44 config FEATURE_RUN_PARTS_FANCY
    45     bool "Support additional arguments"
    46     default y
    47     depends on RUN_PARTS
    48     help
    49       Support additional options:
    50       -l --list print the names of the all matching files (not
    51                 limited to executables), but don't actually run them.
    52 
    53 config START_STOP_DAEMON
    54     bool "start-stop-daemon"
    55     default y
    56     help
    57       start-stop-daemon is used to control the creation and
    58       termination of system-level processes, usually the ones
    59       started during the startup of the system.
    60 
    61 config FEATURE_START_STOP_DAEMON_FANCY
    62     bool "Support additional arguments"
    63     default y
    64     depends on START_STOP_DAEMON
    65     help
    66       Support additional arguments.
    67       -o|--oknodo ignored since we exit with 0 anyway
    68       -v|--verbose
    69       -N|--nicelevel N
    70 
    71 config FEATURE_START_STOP_DAEMON_LONG_OPTIONS
    72     bool "Enable long options"
    73     default y
    74     depends on START_STOP_DAEMON && LONG_OPTS
    75     help
    76       Support long options for the start-stop-daemon applet.
    77 
    78 config WHICH
    79     bool "which"
    80     default y
    81     help
    82       which is used to find programs in your PATH and
    83       print out their pathnames.
    84 
    8510endmenu
  • branches/3.3/mindi-busybox/debianutils/Kbuild.src

    r2725 r3621  
    88
    99INSERT
    10 lib-$(CONFIG_MKTEMP)            += mktemp.o
    11 lib-$(CONFIG_PIPE_PROGRESS)     += pipe_progress.o
    12 lib-$(CONFIG_RUN_PARTS)         += run_parts.o
    13 lib-$(CONFIG_START_STOP_DAEMON) += start_stop_daemon.o
    14 lib-$(CONFIG_WHICH)             += which.o
  • branches/3.3/mindi-busybox/debianutils/mktemp.c

    r3232 r3621  
    3131 *        -p; else /tmp [deprecated]
    3232 */
     33//config:config MKTEMP
     34//config:   bool "mktemp"
     35//config:   default y
     36//config:   help
     37//config:     mktemp is used to create unique temporary files
     38
     39//applet:IF_MKTEMP(APPLET(mktemp, BB_DIR_BIN, BB_SUID_DROP))
     40
     41//kbuild:lib-$(CONFIG_MKTEMP) += mktemp.o
    3342
    3443//usage:#define mktemp_trivial_usage
  • branches/3.3/mindi-busybox/debianutils/pipe_progress.c

    r3232 r3621  
    77 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
    88 */
     9//config:config PIPE_PROGRESS
     10//config:   bool "pipe_progress"
     11//config:   default y
     12//config:   help
     13//config:     Display a dot to indicate pipe activity.
     14
     15//applet:IF_PIPE_PROGRESS(APPLET(pipe_progress, BB_DIR_BIN, BB_SUID_DROP))
     16
     17//kbuild:lib-$(CONFIG_PIPE_PROGRESS) += pipe_progress.o
    918
    1019//usage:#define pipe_progress_trivial_usage NOUSAGE_STR
  • branches/3.3/mindi-busybox/debianutils/run_parts.c

    r3232 r3621  
    2222 * report mode. As the original run-parts support only long options, I've
    2323 * broken compatibility because the BusyBox policy doesn't allow them.
    24  * The supported options are:
    25  * -t           test. Print the name of the files to be executed, without
    26  *              execute them.
    27  * -a ARG       argument. Pass ARG as an argument the program executed. It can
    28  *              be repeated to pass multiple arguments.
    29  * -u MASK      umask. Set the umask of the program executed to MASK.
    3024 */
     25//config:config RUN_PARTS
     26//config:   bool "run-parts"
     27//config:   default y
     28//config:   help
     29//config:     run-parts is a utility designed to run all the scripts in a directory.
     30//config:
     31//config:     It is useful to set up a directory like cron.daily, where you need to
     32//config:     execute all the scripts in that directory.
     33//config:
     34//config:     In this implementation of run-parts some features (such as report
     35//config:     mode) are not implemented.
     36//config:
     37//config:     Unless you know that run-parts is used in some of your scripts
     38//config:     you can safely say N here.
     39//config:
     40//config:config FEATURE_RUN_PARTS_LONG_OPTIONS
     41//config:   bool "Enable long options"
     42//config:   default y
     43//config:   depends on RUN_PARTS && LONG_OPTS
     44//config:   help
     45//config:     Support long options for the run-parts applet.
     46//config:
     47//config:config FEATURE_RUN_PARTS_FANCY
     48//config:   bool "Support additional arguments"
     49//config:   default y
     50//config:   depends on RUN_PARTS
     51//config:   help
     52//config:     Support additional options:
     53//config:     -l --list print the names of the all matching files (not
     54//config:               limited to executables), but don't actually run them.
     55
     56//applet:IF_RUN_PARTS(APPLET_ODDNAME(run-parts, run_parts, BB_DIR_BIN, BB_SUID_DROP, run_parts))
     57
     58//kbuild:lib-$(CONFIG_RUN_PARTS) += run_parts.o
    3159
    3260//usage:#define run_parts_trivial_usage
    33 //usage:       "[-t"IF_FEATURE_RUN_PARTS_FANCY("l")"] [-a ARG]... [-u MASK] DIRECTORY"
     61//usage:       "[-a ARG]... [-u UMASK] "
     62//usage:       IF_FEATURE_RUN_PARTS_LONG_OPTIONS("[--reverse] [--test] [--exit-on-error] "IF_FEATURE_RUN_PARTS_FANCY("[--list] "))
     63//usage:       "DIRECTORY"
    3464//usage:#define run_parts_full_usage "\n\n"
    3565//usage:       "Run a bunch of scripts in DIRECTORY\n"
    36 //usage:     "\n    -t  Dry run"
     66//usage:     "\n    -a ARG      Pass ARG as argument to scripts"
     67//usage:     "\n    -u UMASK    Set UMASK before running scripts"
     68//usage:    IF_FEATURE_RUN_PARTS_LONG_OPTIONS(
     69//usage:     "\n    --reverse   Reverse execution order"
     70//usage:     "\n    --test      Dry run"
     71//usage:     "\n    --exit-on-error Exit if a script exits with non-zero"
    3772//usage:    IF_FEATURE_RUN_PARTS_FANCY(
    38 //usage:     "\n    -l  Print names of matching files even if they are not executable"
     73//usage:     "\n    --list      Print names of matching files even if they are not executable"
    3974//usage:    )
    40 //usage:     "\n    -a ARG  Pass ARG as argument to programs"
    41 //usage:     "\n    -u MASK Set umask to MASK before running programs"
     75//usage:    )
    4276//usage:
    4377//usage:#define run_parts_example_usage
     
    5690
    5791#include "libbb.h"
     92#include "common_bufsiz.h"
    5893
    5994struct globals {
    6095    char **names;
    6196    int    cur;
    62     char  *cmd[1];
     97    char  *cmd[2 /* using 1 provokes compiler warning */];
    6398} FIX_ALIASING;
    64 #define G (*(struct globals*)&bb_common_bufsiz1)
     99#define G (*(struct globals*)bb_common_bufsiz1)
    65100#define names (G.names)
    66101#define cur   (G.cur  )
    67102#define cmd   (G.cmd  )
    68 #define INIT_G() do { } while (0)
     103#define INIT_G() do { setup_common_bufsiz(); } while (0)
    69104
    70105enum { NUM_CMD = (COMMON_BUFSIZE - sizeof(G)) / sizeof(cmd[0]) - 1 };
    71106
    72107enum {
    73     OPT_r = (1 << 0),
    74     OPT_a = (1 << 1),
    75     OPT_u = (1 << 2),
    76     OPT_t = (1 << 3),
    77     OPT_l = (1 << 4) * ENABLE_FEATURE_RUN_PARTS_FANCY,
     108    OPT_a = (1 << 0),
     109    OPT_u = (1 << 1),
     110    OPT_r = (1 << 2) * ENABLE_FEATURE_RUN_PARTS_LONG_OPTIONS,
     111    OPT_t = (1 << 3) * ENABLE_FEATURE_RUN_PARTS_LONG_OPTIONS,
     112    OPT_e = (1 << 4) * ENABLE_FEATURE_RUN_PARTS_LONG_OPTIONS,
     113    OPT_l = (1 << 5) * ENABLE_FEATURE_RUN_PARTS_LONG_OPTIONS
     114            * ENABLE_FEATURE_RUN_PARTS_FANCY,
    78115};
    79 
    80 #if ENABLE_FEATURE_RUN_PARTS_FANCY
    81 #define list_mode (option_mask32 & OPT_l)
    82 #else
    83 #define list_mode 0
    84 #endif
    85116
    86117/* Is this a valid filename (upper/lower alpha, digits,
     
    111142     && (  !(statbuf->st_mode & (S_IFREG | S_IFLNK))
    112143        || invalid_name(file)
    113         || (!list_mode && access(file, X_OK) != 0))
     144        || (!(option_mask32 & OPT_l) && access(file, X_OK) != 0))
    114145    ) {
    115146        return SKIP;
     
    127158    "arg\0"     Required_argument "a"
    128159    "umask\0"   Required_argument "u"
    129     "test\0"    No_argument       "t"
     160//TODO: "verbose\0" No_argument       "v"
     161    "reverse\0" No_argument       "\xf0"
     162    "test\0"    No_argument       "\xf1"
     163    "exit-on-error\0" No_argument "\xf2"
    130164#if ENABLE_FEATURE_RUN_PARTS_FANCY
    131     "list\0"    No_argument       "l"
    132     "reverse\0" No_argument       "r"
    133 //TODO: "verbose\0" No_argument       "v"
     165    "list\0"    No_argument       "\xf3"
    134166#endif
    135167    ;
     
    151183    /* We require exactly one argument: the directory name */
    152184    opt_complementary = "=1:a::";
    153     getopt32(argv, "ra:u:t"IF_FEATURE_RUN_PARTS_FANCY("l"), &arg_list, &umask_p);
     185    getopt32(argv, "a:u:", &arg_list, &umask_p);
    154186
    155187    umask(xstrtou_range(umask_p, 8, 0, 07777));
     
    193225            bb_perror_msg("can't execute '%s'", name);
    194226        else /* ret > 0 */
    195             bb_error_msg("%s exited with code %d", name, ret & 0xff);
     227            bb_error_msg("%s: exit status %u", name, ret & 0xff);
     228
     229        if (option_mask32 & OPT_e)
     230            xfunc_die();
    196231    }
    197232
  • branches/3.3/mindi-busybox/debianutils/start_stop_daemon.c

    r3232 r3621  
    5757        -v,--verbose            Verbose
    5858*/
     59//config:config START_STOP_DAEMON
     60//config:   bool "start-stop-daemon"
     61//config:   default y
     62//config:   help
     63//config:     start-stop-daemon is used to control the creation and
     64//config:     termination of system-level processes, usually the ones
     65//config:     started during the startup of the system.
     66//config:
     67//config:config FEATURE_START_STOP_DAEMON_FANCY
     68//config:   bool "Support additional arguments"
     69//config:   default y
     70//config:   depends on START_STOP_DAEMON
     71//config:   help
     72//config:     Support additional arguments.
     73//config:     -o|--oknodo ignored since we exit with 0 anyway
     74//config:     -v|--verbose
     75//config:     -N|--nicelevel N
     76//config:
     77//config:config FEATURE_START_STOP_DAEMON_LONG_OPTIONS
     78//config:   bool "Enable long options"
     79//config:   default y
     80//config:   depends on START_STOP_DAEMON && LONG_OPTS
     81//config:   help
     82//config:     Support long options for the start-stop-daemon applet.
     83
     84//applet:IF_START_STOP_DAEMON(APPLET_ODDNAME(start-stop-daemon, start_stop_daemon, BB_DIR_SBIN, BB_SUID_DROP, start_stop_daemon))
     85
     86//kbuild:lib-$(CONFIG_START_STOP_DAEMON) += start_stop_daemon.o
    5987
    6088//usage:#define start_stop_daemon_trivial_usage
     
    126154#define WANT_PIDFILE 1
    127155#include "libbb.h"
     156#include "common_bufsiz.h"
    128157
    129158struct pid_list {
     
    164193    smallint signal_nr;
    165194} FIX_ALIASING;
    166 #define G (*(struct globals*)&bb_common_bufsiz1)
     195#define G (*(struct globals*)bb_common_bufsiz1)
    167196#define userspec          (G.userspec            )
    168197#define cmdname           (G.cmdname             )
     
    172201#define signal_nr         (G.signal_nr           )
    173202#define INIT_G() do { \
     203    setup_common_bufsiz(); \
    174204    user_id = -1; \
    175205    signal_nr = 15; \
     
    512542    }
    513543    if (opt & OPT_c) {
    514         struct bb_uidgid_t ugid = { -1, -1 };
     544        struct bb_uidgid_t ugid;
    515545        parse_chown_usergroup_or_die(&ugid, chuid);
    516         if (ugid.uid != (uid_t) -1) {
     546        if (ugid.uid != (uid_t) -1L) {
    517547            struct passwd *pw = xgetpwuid(ugid.uid);
    518             if (ugid.gid != (gid_t) -1)
     548            if (ugid.gid != (gid_t) -1L)
    519549                pw->pw_gid = ugid.gid;
    520550            /* initgroups, setgid, setuid: */
    521551            change_identity(pw);
    522         } else if (ugid.gid != (gid_t) -1) {
     552        } else if (ugid.gid != (gid_t) -1L) {
    523553            xsetgid(ugid.gid);
    524554            setgroups(1, &ugid.gid);
  • branches/3.3/mindi-busybox/debianutils/which.c

    r3232 r3621  
    11/* vi: set sw=4 ts=4: */
    22/*
    3  * Which implementation for busybox
    4  *
    53 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
    64 * Copyright (C) 2006 Gabriel Somlo <somlo at cmu.edu>
    75 *
    86 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
    9  *
    10  * Based on which from debianutils
    117 */
     8//config:config WHICH
     9//config:   bool "which"
     10//config:   default y
     11//config:   help
     12//config:     which is used to find programs in your PATH and
     13//config:     print out their pathnames.
     14
     15//applet:IF_WHICH(APPLET(which, BB_DIR_USR_BIN, BB_SUID_DROP))
     16
     17//kbuild:lib-$(CONFIG_WHICH) += which.o
    1218
    1319//usage:#define which_trivial_usage
     
    2531int which_main(int argc UNUSED_PARAM, char **argv)
    2632{
    27     IF_DESKTOP(int opt;)
    28     int status = EXIT_SUCCESS;
    29     char *path;
    30     char *p;
     33    const char *env_path;
     34    int status = 0;
     35
     36    env_path = getenv("PATH");
     37    if (!env_path)
     38        env_path = bb_default_root_path;
    3139
    3240    opt_complementary = "-1"; /* at least one argument */
    33     IF_DESKTOP(opt =) getopt32(argv, "a");
     41    getopt32(argv, "a");
    3442    argv += optind;
    3543
    36     /* This matches what is seen on e.g. ubuntu.
    37      * "which" there is a shell script. */
    38     path = getenv("PATH");
    39     if (!path) {
    40         path = (char*)bb_PATH_root_path;
    41         putenv(path);
    42         path += 5; /* skip "PATH=" */
    43     }
     44    do {
     45        int missing = 1;
    4446
    45     do {
    46 #if ENABLE_DESKTOP
    47 /* Much bloat just to support -a */
     47        /* If file contains a slash don't use PATH */
    4848        if (strchr(*argv, '/')) {
    49             if (execable_file(*argv)) {
     49            if (file_is_executable(*argv)) {
     50                missing = 0;
    5051                puts(*argv);
    51                 continue;
    5252            }
    53             status = EXIT_FAILURE;
    5453        } else {
    55             char *path2 = xstrdup(path);
    56             char *tmp = path2;
     54            char *path;
     55            char *tmp;
     56            char *p;
    5757
    58             p = find_execable(*argv, &tmp);
    59             if (!p)
    60                 status = EXIT_FAILURE;
    61             else {
    62  print:
     58            path = tmp = xstrdup(env_path);
     59            while ((p = find_executable(*argv, &tmp)) != NULL) {
     60                missing = 0;
    6361                puts(p);
    6462                free(p);
    65                 if (opt) {
    66                     /* -a: show matches in all PATH components */
    67                     if (tmp) {
    68                         p = find_execable(*argv, &tmp);
    69                         if (p)
    70                             goto print;
    71                     }
    72                 }
     63                if (!option_mask32) /* -a not set */
     64                    break;
    7365            }
    74             free(path2);
     66            free(path);
    7567        }
    76 #else
    77 /* Just ignoring -a */
    78         if (strchr(*argv, '/')) {
    79             if (execable_file(*argv)) {
    80                 puts(*argv);
    81                 continue;
    82             }
    83         } else {
    84             char *path2 = xstrdup(path);
    85             char *tmp = path2;
    86             p = find_execable(*argv, &tmp);
    87             free(path2);
    88             if (p) {
    89                 puts(p);
    90                 free(p);
    91                 continue;
    92             }
    93         }
    94         status = EXIT_FAILURE;
    95 #endif
    96     } while (*(++argv) != NULL);
     68        status |= missing;
     69    } while (*++argv);
    9770
    98     fflush_stdout_and_exit(status);
     71    return status;
    9972}
Note: See TracChangeset for help on using the changeset viewer.