source: clfs-embedded/patches/busybox-1.12.1-fixes-1.patch@ b327081

Last change on this file since b327081 was 2567553, checked in by Joe Ciccone <jciccone@…>, 16 years ago

Updated Busybox to 1.12.1.
Patched uClibc so struct flock doesn't get redefined.

  • Property mode set to 100644
File size: 13.0 KB
  • coreutils/basename.c

    Submitted By: Joe Ciccone <jciccone@gmail.com>
    Date: 2008-11-08
    Origin: Busybox FTP
    Initial Package Version: 1.12.1
    Upstream Status: From Upstream
    Descriprion: Apply fixes from upstream
                     busybox-1.12.1-basename.patch
                     busybox-1.12.1-grep.patch
                     busybox-1.12.1-lineedit.patch
                     busybox-1.12.1-login.patch
                     busybox-1.12.1-modprobe.patch
                     busybox-1.12.1-standalone.patch
                     busybox-1.12.1-vi.patch
    
    diff -Naur busybox-1.12.1.orig/coreutils/basename.c busybox-1.12.1/coreutils/basename.c
    old new  
    4848
    4949        /* puts(s) will do, but we can do without stdio this way: */
    5050        s[m++] = '\n';
    51         return full_write(STDOUT_FILENO, s, m) == (ssize_t)m;
     51        return full_write(STDOUT_FILENO, s, m) != (ssize_t)m;
    5252}
  • coreutils/env.c

    diff -Naur busybox-1.12.1.orig/coreutils/env.c busybox-1.12.1/coreutils/env.c
    old new  
    2929 * - use xfunc_error_retval
    3030 */
    3131
     32/* This is a NOEXEC applet. Be very careful! */
     33
    3234#include "libbb.h"
    3335
    3436#if ENABLE_FEATURE_ENV_LONG_OPTIONS
     
    119121 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    120122 * SUCH DAMAGE.
    121123 */
    122 
    123 
  • busybox-1.12.1

    diff -Naur busybox-1.12.1.orig/editors/vi.c busybox-1.12.1/editors/vi.c
    old new  
    291291#define INIT_G() do { \
    292292        SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
    293293        last_file_modified = -1; \
     294        /* "" but has space for 2 chars */ \
     295        USE_FEATURE_VI_SEARCH(last_search_pattern = xzalloc(2);) \
    294296} while (0)
    295297
    296298
     
    29742976        const char *msg = msg; // for compiler
    29752977        char c1, *p, *q, *save_dot;
    29762978        char buf[12];
    2977         int dir = dir; // for compiler
     2979        int dir;
    29782980        int cnt, i, j;
    29792981
    29802982//      c1 = c; // quiet the compiler
     
    33163318                q = get_input_line(buf);        // get input line- use "status line"
    33173319                if (q[0] && !q[1]) {
    33183320                        if (last_search_pattern[0])
    3319                             last_search_pattern[0] = c;
     3321                                last_search_pattern[0] = c;
    33203322                        goto dc3; // if no pat re-use old pat
    33213323                }
    33223324                if (q[0]) {       // strlen(q) > 1: new pat- save it and find
     
    33463348                        do_cmd(c);
    33473349                }                               // repeat cnt
    33483350 dc3:
    3349                 if (last_search_pattern == 0) {
    3350                         msg = "No previous regular expression";
    3351                         goto dc2;
    3352                 }
    3353                 if (last_search_pattern[0] == '/') {
    3354                         dir = FORWARD;  // assume FORWARD search
    3355                         p = dot + 1;
    3356                 }
     3351                dir = FORWARD;  // assume FORWARD search
     3352                p = dot + 1;
    33573353                if (last_search_pattern[0] == '?') {
    33583354                        dir = BACK;
    33593355                        p = dot - 1;
  • findutils/grep.c

    diff -Naur busybox-1.12.1.orig/findutils/grep.c busybox-1.12.1/findutils/grep.c
    old new  
    363363                                                 * (unless -v: -Fov doesnt print anything at all) */
    364364                                                if (found)
    365365                                                        print_line(gl->pattern, strlen(gl->pattern), linenum, ':');
    366                                         } else {
     366                                        } else while (1) {
     367                                                char old = line[gl->matched_range.rm_eo];
    367368                                                line[gl->matched_range.rm_eo] = '\0';
    368369                                                print_line(line + gl->matched_range.rm_so,
    369370                                                                gl->matched_range.rm_eo - gl->matched_range.rm_so,
    370371                                                                linenum, ':');
    371                                         }
     372                                                line[gl->matched_range.rm_eo] = old;
     373#if !ENABLE_EXTRA_COMPAT
     374                                                break;
     375#else
     376                                                if (re_search(&gl->compiled_regex, line, line_len,
     377                                                                gl->matched_range.rm_eo, line_len - gl->matched_range.rm_eo,
     378                                                                &gl->matched_range) < 0)
     379                                                        break;
     380#endif
     381                                        }
    372382                                } else {
    373383                                        print_line(line, line_len, linenum, ':');
    374384                                }
  • include/applets.h

    diff -Naur busybox-1.12.1.orig/include/applets.h busybox-1.12.1/include/applets.h
    old new  
    136136USE_ED(APPLET(ed, _BB_DIR_BIN, _BB_SUID_NEVER))
    137137USE_FEATURE_GREP_EGREP_ALIAS(APPLET_ODDNAME(egrep, grep, _BB_DIR_BIN, _BB_SUID_NEVER, egrep))
    138138USE_EJECT(APPLET(eject, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    139 USE_ENV(APPLET(env, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     139USE_ENV(APPLET_NOEXEC(env, env, _BB_DIR_USR_BIN, _BB_SUID_NEVER, env))
    140140USE_ENVDIR(APPLET_ODDNAME(envdir, chpst, _BB_DIR_USR_BIN, _BB_SUID_NEVER, envdir))
    141141USE_ENVUIDGID(APPLET_ODDNAME(envuidgid, chpst, _BB_DIR_USR_BIN, _BB_SUID_NEVER, envuidgid))
    142142USE_ETHER_WAKE(APPLET_ODDNAME(ether-wake, ether_wake, _BB_DIR_USR_BIN, _BB_SUID_NEVER, ether_wake))
     
    171171USE_GUNZIP(APPLET(gunzip, _BB_DIR_BIN, _BB_SUID_NEVER))
    172172USE_GZIP(APPLET(gzip, _BB_DIR_BIN, _BB_SUID_NEVER))
    173173USE_HALT(APPLET(halt, _BB_DIR_SBIN, _BB_SUID_NEVER))
    174 USE_HD(APPLET_ODDNAME(hd, hexdump, _BB_DIR_USR_BIN, _BB_SUID_NEVER, hd))
     174USE_HD(APPLET_NOEXEC(hd, hexdump, _BB_DIR_USR_BIN, _BB_SUID_NEVER, hd))
    175175USE_HDPARM(APPLET(hdparm, _BB_DIR_SBIN, _BB_SUID_NEVER))
    176176USE_HEAD(APPLET(head, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    177177USE_HEXDUMP(APPLET_NOEXEC(hexdump, hexdump, _BB_DIR_USR_BIN, _BB_SUID_NEVER, hexdump))
  • libbb/getopt32.c

    diff -Naur busybox-1.12.1.orig/libbb/getopt32.c busybox-1.12.1/libbb/getopt32.c
    old new  
    515515                }
    516516        }
    517517
    518         /* In case getopt32 was already called:
    519          * reset the libc getopt() function, which keeps internal state.
    520          *
    521          * BSD-derived getopt() functions require that optind be set to 1 in
    522          * order to reset getopt() state.  This used to be generally accepted
    523          * way of resetting getopt().  However, glibc's getopt()
    524          * has additional getopt() state beyond optind, and requires that
    525          * optind be set to zero to reset its state.  So the unfortunate state of
    526          * affairs is that BSD-derived versions of getopt() misbehave if
    527          * optind is set to 0 in order to reset getopt(), and glibc's getopt()
    528          * will core dump if optind is set 1 in order to reset getopt().
    529          *
    530          * More modern versions of BSD require that optreset be set to 1 in
    531          * order to reset getopt().   Sigh.  Standards, anyone?
    532          */
    533 #ifdef __GLIBC__
    534         optind = 0;
    535 #else /* BSD style */
    536         optind = 1;
    537         /* optreset = 1; */
    538 #endif
    539         /* optarg = NULL; opterr = 0; optopt = 0; - do we need this?? */
    540518        pargv = NULL;
    541519
    542520        /* Note: just "getopt() <= 0" will not work well for
  • libbb/lineedit.c

    diff -Naur busybox-1.12.1.orig/libbb/lineedit.c busybox-1.12.1/libbb/lineedit.c
    old new  
    14151415        if ((state->flags & SAVE_HISTORY) && state->hist_file)
    14161416                load_history(state->hist_file);
    14171417#endif
    1418         state->cur_history = state->cnt_history;
     1418        if (state->flags & DO_HISTORY)
     1419                state->cur_history = state->cnt_history;
    14191420
    14201421        /* prepare before init handlers */
    14211422        cmdedit_y = 0;  /* quasireal y, not true if line > xt*yt */
  • libbb/setup_environment.c

    diff -Naur busybox-1.12.1.orig/libbb/setup_environment.c busybox-1.12.1/libbb/setup_environment.c
    old new  
    3232
    3333void FAST_FUNC setup_environment(const char *shell, int clear_env, int change_env, const struct passwd *pw)
    3434{
     35        /* Change the current working directory to be the home directory
     36         * of the user */
     37        if (chdir(pw->pw_dir)) {
     38                xchdir("/");
     39                bb_error_msg("can't chdir to home directory '%s'", pw->pw_dir);
     40        }
     41
    3542        if (clear_env) {
    3643                const char *term;
    3744
    38                 /* Change the current working directory to be the home directory
    39                  * of the user */
    40                 if (chdir(pw->pw_dir)) {
    41                         xchdir("/");
    42                         bb_error_msg("can't chdir to home directory '%s'", pw->pw_dir);
    43                 }
    44 
    4545                /* Leave TERM unchanged. Set HOME, SHELL, USER, LOGNAME, PATH.
    4646                   Unset all other environment variables.  */
    4747                term = getenv("TERM");
  • libbb/vfork_daemon_rexec.c

    diff -Naur busybox-1.12.1.orig/libbb/vfork_daemon_rexec.c busybox-1.12.1/libbb/vfork_daemon_rexec.c
    old new  
    125125        int rc, argc;
    126126
    127127        applet_name = APPLET_NAME(applet_no);
     128
    128129        xfunc_error_retval = EXIT_FAILURE;
    129130
    130131        /* Special flag for xfunc_die(). If xfunc will "die"
     
    132133         * die_sleep and longjmp here instead. */
    133134        die_sleep = -1;
    134135
    135         /* option_mask32 = 0; - not needed */
     136        /* In case getopt() or getopt32() was already called:
     137         * reset the libc getopt() function, which keeps internal state.
     138         *
     139         * BSD-derived getopt() functions require that optind be set to 1 in
     140         * order to reset getopt() state.  This used to be generally accepted
     141         * way of resetting getopt().  However, glibc's getopt()
     142         * has additional getopt() state beyond optind, and requires that
     143         * optind be set to zero to reset its state.  So the unfortunate state of
     144         * affairs is that BSD-derived versions of getopt() misbehave if
     145         * optind is set to 0 in order to reset getopt(), and glibc's getopt()
     146         * will core dump if optind is set 1 in order to reset getopt().
     147         *
     148         * More modern versions of BSD require that optreset be set to 1 in
     149         * order to reset getopt().  Sigh.  Standards, anyone?
     150         */
     151#ifdef __GLIBC__
     152        optind = 0;
     153#else /* BSD style */
     154        optind = 1;
     155        /* optreset = 1; */
     156#endif
     157        /* optarg = NULL; opterr = 1; optopt = 63; - do we need this too? */
     158        /* (values above are what they initialized to in glibc and uclibc) */
     159        /* option_mask32 = 0; - not needed, no applet depends on it being 0 */
    136160
    137161        argc = 1;
    138162        while (argv[argc])
     
    161185                        rc = 0;
    162186        }
    163187
    164         /* Restoring globals */
     188        /* Restoring some globals */
    165189        restore_nofork_data(old);
     190
     191        /* Other globals can be simply reset to defaults */
     192#ifdef __GLIBC__
     193        optind = 0;
     194#else /* BSD style */
     195        optind = 1;
     196#endif
     197
    166198        return rc & 0xff; /* don't confuse people with "exitcodes" >255 */
    167199}
    168200
  • modutils/modprobe.c

    diff -Naur busybox-1.12.1.orig/modutils/modprobe.c busybox-1.12.1/modutils/modprobe.c
    old new  
    263263        return TRUE;
    264264}
    265265
    266 static int include_conf_recursive(struct include_conf_t *conf, const char *filename)
     266static int include_conf_recursive(struct include_conf_t *conf, const char *filename, int flags)
    267267{
    268         return recursive_action(filename, ACTION_RECURSE,
     268        return recursive_action(filename, ACTION_RECURSE | flags,
    269269                                include_conf_file_act,
    270270                                include_conf_dir_act,
    271271                                conf, 1);
     
    362362                        char *includefile;
    363363
    364364                        includefile = skip_whitespace(line_buffer + 8);
    365                         include_conf_recursive(conf, includefile);
     365                        include_conf_recursive(conf, includefile, 0);
    366366                } else if (ENABLE_FEATURE_MODPROBE_BLACKLIST &&
    367367                                (is_conf_command(line_buffer, "blacklist"))) {
    368368                        char *mod;
     
    559559                if (ENABLE_FEATURE_2_6_MODULES) {
    560560                        if (include_conf_file(&conf, "/etc/modprobe.conf"))
    561561                                r = TRUE;
    562                         if (include_conf_recursive(&conf, "/etc/modprobe.d"))
     562                        if (include_conf_recursive(&conf, "/etc/modprobe.d", ACTION_QUIET))
    563563                                r = TRUE;
    564564                }
    565565                if (ENABLE_FEATURE_2_4_MODULES && !r)
  • busybox-1.12.1

    diff -Naur busybox-1.12.1.orig/shell/ash.c busybox-1.12.1/shell/ash.c
    old new  
    69646964
    69656965#if ENABLE_FEATURE_SH_STANDALONE
    69666966        if (applet_no >= 0) {
    6967                 if (APPLET_IS_NOEXEC(applet_no))
     6967                if (APPLET_IS_NOEXEC(applet_no)) {
     6968                        while (*envp)
     6969                                putenv(*envp++);
    69686970                        run_applet_no_and_exit(applet_no, argv);
     6971                }
    69696972                /* re-exec ourselves with the new arguments */
    69706973                execve(bb_busybox_exec_path, argv, envp);
    69716974                /* If they called chroot or otherwise made the binary no longer
     
    1201412017        char *name;
    1201512018        const char *p;
    1201612019        char **aptr;
    12017         int flag = argv[0][0] == 'r'? VREADONLY : VEXPORT;
     12020        int flag = argv[0][0] == 'r' ? VREADONLY : VEXPORT;
    1201812021
    1201912022        if (nextopt("p") != 'p') {
    1202012023                aptr = argptr;
  • util-linux/getopt.c

    diff -Naur busybox-1.12.1.orig/util-linux/getopt.c busybox-1.12.1/util-linux/getopt.c
    old new  
    142142 * Other settings are found in global variables.
    143143 */
    144144#if !ENABLE_GETOPT_LONG
    145 #define generate_output(argv,argc,optstr,longopts) generate_output(argv,argc,optstr)
     145#define generate_output(argv,argc,optstr,longopts) \
     146        generate_output(argv,argc,optstr)
    146147#endif
    147148static int generate_output(char **argv, int argc, const char *optstr, const struct option *longopts)
    148149{
     
    156157        if (quiet_errors) /* No error reporting from getopt(3) */
    157158                opterr = 0;
    158159
    159         /* Reset getopt(3) (see libbb/getopt32.c for long rant) */
    160 #ifdef __GLIBC__
    161         optind = 0;
    162 #else /* BSD style */
    163         optind = 1;
    164         /* optreset = 1; */
    165 #endif
    166 
    167160        while (1) {
    168161                opt =
    169162#if ENABLE_GETOPT_LONG
Note: See TracBrowser for help on using the repository browser.