Ignore:
Timestamp:
Nov 6, 2007, 11:01:53 AM (16 years ago)
Author:
Bruno Cornec
Message:
  • Better output for mindi-busybox revision
  • Remove dummy file created on NFS - report from Arnaud Tiger <arnaud.tiger_at_hp.com>
  • strace useful for debug
  • fix new versions for pb (2.0.0 for mindi and 1.7.2 for mindi-busybox)
  • fix build process for mindi-busybox + options used in that version (dd for label-partitions-as-necessary)
  • fix typo in label-partitions-as-necessary which doesn't seem to work
  • Update to busybox 1.7.2
  • perl is now required at restore time to support uuid swap partitions (and will be used for many other thigs

in the future for sure)

  • next mindi version will be 2.0.0 due to all the changes made in it (udev may break working distros)
  • small optimization in mindi on keyboard handling (one single find instead of multiple)
  • better interaction for USB device when launching mindi manually
  • attempt to automatically guess block disk size for ramdisk
  • fix typos in bkphw
  • Fix the remaining problem with UUID support for swap partitions
  • Updates mondoarchive man page for USB support
  • Adds preliminary Hardware support to mindi (Proliant SSSTK)
  • Tries to add udev support also for rhel4
  • Fix UUID support which was still broken.
  • Be conservative in test for the start-nfs script
  • Update config file for mindi-busybox for 1.7.2 migration
  • Try to run around a busybox bug (1.2.2 pb on inexistant links)
  • Add build content for mindi-busybox in pb
  • Remove distributions content for mindi-busybox
  • Fix a warning on inexistant raidtab
  • Solve problem on tmpfs in restore init (Problem of inexistant symlink and busybox)
  • Create MONDO_CACHE and use it everywhere + creation at start
  • Really never try to eject a USB device
  • Fix a issue with &> usage (replaced with 1> and 2>)
  • Adds magic file to depllist in order to have file working + ldd which helps for debugging issues
  • tty modes correct to avoid sh error messages
  • Use ext3 normally and not ext2 instead
  • USB device should be corrected after reading (take 1st part)
  • Adds a mount_USB_here function derived from mount_CDROM_here
  • usb detection place before /dev detection in device name at restore time
  • Fix when restoring from USB: media is asked in interactive mode
  • Adds USB support for mondorestore
  • mount_cdrom => mount_media
  • elilo.efi is now searched throughout /boot/efi and not in a fixed place as there is no standard
  • untar-and-softlink => untar (+ interface change)
  • suppress useless softlinks creation/removal in boot process
  • avoids udevd messages on groups
  • Increase # of disks to 99 as in mindi at restore time (should be a conf file parameter)
  • skip existing big file creation
  • seems to work correctly for USB mindi boot
  • Adds group and tty link to udev conf
  • Always load usb-torage (even 2.6) to initiate USB bus discovery
  • Better printing of messages
  • Attempt to fix a bug in supporting OpenSusE 10.3 kernel for initramfs (mindi may now use multiple regex for kernel initrd detection)
  • Links were not correctly done as non relative for modules in mindi
  • exclusion of modules denied now works
  • Also create modules in their ordinary place, so that classical modprobe works + copy modules.dep
  • Fix bugs for DENY_MODS handling
  • Add device /dev/console for udev
  • ide-generic should now really be excluded
  • Fix a bug in major number for tty
  • If udev then adds modprobe/insmod to rootfs
  • tty0 is also cretaed with udev
  • ide-generic put rather in DENY_MODS
  • udevd remove from deplist s handled in mindi directly
  • better default for mindi when using --usb
  • Handles dynamically linked busybox (in case we want to use it soon ;-)
  • Adds fixed devices to create for udev
  • ide-generic should not be part of the initrd when using libata v2
  • support a dynamically linked udev (case on Ubuntu 7.10 and Mandriva 2008.0 so should be quite generic) This will give incitation to move to dyn. linked binaries in the initrd which will help for other tasks (ia6 4)
  • Improvement in udev support (do not use cl options not available in busybox)
  • Udev in mindi
    • auto creation of the right links at boot time with udev-links.conf(from Mandriva 2008.0)
    • rework startup of udev as current makes kernel crash (from Mandriva 2008.0)
    • add support for 64 bits udev
  • Try to render MyInsmod silent at boot time
  • Adds udev support (mandatory for newest distributions to avoid remapping of devices in a different way as on the original system)
  • We also need vaft format support for USB boot
  • Adds libusual support (Ubuntu 7.10 needs it for USB)
  • Improve Ubuntu/Debian keyboard detection and support
  • pbinit adapted to new pb (0.8.10). Filtering of docs done in it
  • Suppress some mondo warnings and errors on USB again
  • Tries to fix lack of files in deb mindi package
  • Verify should now work for USB devices
  • More log/mesages improvement for USB support
  • - Supress g_erase_tmpdir_and_scratchdir
  • Improve some log messages for USB support
  • Try to improve install in mindi to avoid issues with isolinux.cfg not installed vene if in the pkg :-(
  • Improve mindi-busybox build
  • In conformity with pb 0.8.9
  • Add support for Ubuntu 7.10 in build process
  • Add USB Key button to Menu UI (CD streamer removed)
  • Attempt to fix error messages on tmp/scratch files at the end by removing those dir at the latest possible.
  • Fix a bug linked to the size of the -E param which could be used (Arnaud Tiger/René Ribaud).
  • Integrate ~/.pbrc content into mondorescue.pb (required project-builder >= 0.8.7)
  • Put mondorescue in conformity with new pb filtering rules
  • Add USB support at restore time (no test done yet). New start-usb script PB varibale added where useful
  • Unmounting USB device before removal of temporary scratchdir
  • Stil refining USB copy back to mondo (one command was not executed)
  • No need to have the image subdor in the csratchdir when USB.
  • umount the USB partition before attempting to use it
  • Remove useless copy from mindi to mondo at end of USB handling

(risky merge, we are raising the limits of 2 diverging branches. The status of stable is not completely sure as such. Will need lots of tests, but it's not yet done :-()
(merge -r1692:1769 $SVN_M/branches/2.2.5)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mindi-busybox/coreutils/uudecode.c

    r821 r1770  
     1/* vi: set sw=4 ts=4: */
    12/*
    23 *  Copyright 2003, Glenn McGrath <bug1@iinet.net.au>
     
    1213
    1314
    14 #include <stdio.h>
    15 #include <errno.h>
    16 #include <getopt.h> /* optind */
    17 #include <string.h>
    18 #include <stdlib.h>
    19 #include "busybox.h"
    20 
    21 static int read_stduu(FILE *src_stream, FILE *dst_stream)
     15#include "libbb.h"
     16
     17static void read_stduu(FILE *src_stream, FILE *dst_stream)
    2218{
    2319    char *line;
    2420
    25     while ((line = bb_get_chomped_line_from_file(src_stream)) != NULL) {
     21    while ((line = xmalloc_getline(src_stream)) != NULL) {
    2622        int length;
    2723        char *line_ptr = line;
    2824
    2925        if (strcmp(line, "end") == 0) {
    30             return(EXIT_SUCCESS);
     26            return;
    3127        }
    3228        length = ((*line_ptr - 0x20) & 0x3f)* 4 / 3;
     
    3733        }
    3834        if (length > 60) {
    39             bb_error_msg_and_die("Line too long");
     35            bb_error_msg_and_die("line too long");
    4036        }
    4137
    4238        line_ptr++;
    43         /* Tolerate an overly long line to acomadate a possible exta '`' */
     39        /* Tolerate an overly long line to accomodate a possible exta '`' */
    4440        if (strlen(line_ptr) < (size_t)length) {
    45             bb_error_msg_and_die("Short file");
     41            bb_error_msg_and_die("short file");
    4642        }
    4743
     
    6864        free(line);
    6965    }
    70     bb_error_msg_and_die("Short file");
     66    bb_error_msg_and_die("short file");
    7167}
    7268
    73 static int read_base64(FILE *src_stream, FILE *dst_stream)
     69static void read_base64(FILE *src_stream, FILE *dst_stream)
    7470{
    75     static const char base64_table[] =
    76         "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n";
    77     char term_count = 0;
     71    int term_count = 1;
    7872
    7973    while (1) {
     
    8579            int ch;
    8680
    87             /* Get next _valid_ character */
     81            /* Get next _valid_ character.
     82             * global vector bb_uuenc_tbl_base64[] contains this string:
     83             * "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n"
     84             */
    8885            do {
    8986                ch = fgetc(src_stream);
    9087                if (ch == EOF) {
    91                     bb_error_msg_and_die("Short file");
     88                    bb_error_msg_and_die("short file");
    9289                }
    93             } while ((table_ptr = strchr(base64_table, ch)) == NULL);
    94 
    95             /* Convert encoded charcter to decimal */
    96             ch = table_ptr - base64_table;
     90                table_ptr = strchr(bb_uuenc_tbl_base64, ch);
     91            } while (table_ptr == NULL);
     92
     93            /* Convert encoded character to decimal */
     94            ch = table_ptr - bb_uuenc_tbl_base64;
    9795
    9896            if (*table_ptr == '=') {
    9997                if (term_count == 0) {
    100                     translated[count] = 0;
     98                    translated[count] = '\0';
    10199                    break;
    102100                }
    103101                term_count++;
    104             }
    105             else if (*table_ptr == '\n') {
     102            } else if (*table_ptr == '\n') {
    106103                /* Check for terminating line */
    107104                if (term_count == 5) {
    108                     return(EXIT_SUCCESS);
     105                    return;
    109106                }
    110107                term_count = 1;
     
    118115
    119116        /* Merge 6 bit chars to 8 bit */
    120         fputc(translated[0] << 2 | translated[1] >> 4, dst_stream);
     117        if (count > 1) {
     118            fputc(translated[0] << 2 | translated[1] >> 4, dst_stream);
     119        }
    121120        if (count > 2) {
    122121            fputc(translated[1] << 4 | translated[2] >> 2, dst_stream);
     
    128127}
    129128
     129int uudecode_main(int argc, char **argv);
    130130int uudecode_main(int argc, char **argv)
    131131{
    132     int (*decode_fn_ptr) (FILE * src, FILE * dst);
    133     FILE *src_stream;
     132    FILE *src_stream = stdin;
    134133    char *outname = NULL;
    135134    char *line;
    136     int opt;
    137 
    138     opt = bb_getopt_ulflags(argc, argv, "o:", &outname);
    139 
    140     if (optind == argc) {
    141         src_stream = stdin;
    142     } else if (optind + 1 == argc) {
    143         src_stream = bb_xfopen(argv[optind], "r");
    144     } else {
    145         bb_show_usage();
    146     }
     135
     136    opt_complementary = "?1"; /* 1 argument max */
     137    getopt32(argv, "o:", &outname);
     138    argv += optind;
     139
     140    if (argv[0])
     141        src_stream = xfopen(argv[0], "r");
    147142
    148143    /* Search for the start of the encoding */
    149     while ((line = bb_get_chomped_line_from_file(src_stream)) != NULL) {
    150         char *line_ptr = NULL;
    151 
    152         if (line == NULL) {
    153             break;
    154         } else if (strncmp(line, "begin-base64 ", 13) == 0) {
     144    while ((line = xmalloc_getline(src_stream)) != NULL) {
     145        void (*decode_fn_ptr)(FILE * src, FILE * dst);
     146        char *line_ptr;
     147        FILE *dst_stream;
     148        int mode;
     149
     150        if (strncmp(line, "begin-base64 ", 13) == 0) {
    155151            line_ptr = line + 13;
    156152            decode_fn_ptr = read_base64;
     
    158154            line_ptr = line + 6;
    159155            decode_fn_ptr = read_stduu;
    160         }
    161 
    162         if (line_ptr) {
    163             FILE *dst_stream;
    164             int mode;
    165             int ret;
    166 
    167             mode = strtoul(line_ptr, NULL, 8);
    168             if (outname == NULL) {
    169                 outname = strchr(line_ptr, ' ');
    170                 if ((outname == NULL) || (*outname == '\0')) {
    171                     break;
    172                 }
    173                 outname++;
    174             }
    175             if (strcmp(outname, "-") == 0) {
    176                 dst_stream = stdout;
    177             } else {
    178                 dst_stream = bb_xfopen(outname, "w");
    179                 chmod(outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO));
    180             }
     156        } else {
    181157            free(line);
    182             ret = decode_fn_ptr(src_stream, dst_stream);
    183             bb_fclose_nonstdin(src_stream);
    184             return(ret);
     158            continue;
     159        }
     160
     161        /* begin line found. decode and exit */
     162        mode = strtoul(line_ptr, NULL, 8);
     163        if (outname == NULL) {
     164            outname = strchr(line_ptr, ' ');
     165            if ((outname == NULL) || (*outname == '\0')) {
     166                break;
     167            }
     168            outname++;
     169        }
     170        dst_stream = stdout;
     171        if (NOT_LONE_DASH(outname)) {
     172            dst_stream = xfopen(outname, "w");
     173            chmod(outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO));
    185174        }
    186175        free(line);
     176        decode_fn_ptr(src_stream, dst_stream);
     177        /* fclose_if_not_stdin(src_stream); - redundant */
     178        return EXIT_SUCCESS;
    187179    }
    188     bb_error_msg_and_die("No `begin' line");
     180    bb_error_msg_and_die("no 'begin' line");
    189181}
     182
     183/* Test script.
     184Put this into an empty dir with busybox binary, an run.
     185
     186#!/bin/sh
     187test -x busybox || { echo "No ./busybox?"; exit; }
     188ln -sf busybox uudecode
     189ln -sf busybox uuencode
     190>A_null
     191echo -n A >A
     192echo -n AB >AB
     193echo -n ABC >ABC
     194echo -n ABCD >ABCD
     195echo -n ABCDE >ABCDE
     196echo -n ABCDEF >ABCDEF
     197cat busybox >A_bbox
     198for f in A*; do
     199    echo uuencode $f
     200    ./uuencode    $f <$f >u_$f
     201    ./uuencode -m $f <$f >m_$f
     202done
     203mkdir unpk_u unpk_m 2>/dev/null
     204for f in u_*; do
     205    ./uudecode <$f -o unpk_u/${f:2}
     206    diff -a ${f:2} unpk_u/${f:2} >/dev/null 2>&1
     207    echo uudecode $f: $?
     208done
     209for f in m_*; do
     210    ./uudecode <$f -o unpk_m/${f:2}
     211    diff -a ${f:2} unpk_m/${f:2} >/dev/null 2>&1
     212    echo uudecode $f: $?
     213done
     214*/
Note: See TracChangeset for help on using the changeset viewer.