Ignore:
Timestamp:
Nov 6, 2007, 11:01:53 AM (12 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/chown.c

    r821 r1770  
    88 */
    99
    10 /* BB_AUDIT SUSv3 defects - unsupported options -h, -H, -L, and -P. */
    11 /* BB_AUDIT GNU defects - unsupported options -h, -c, -f, -v, and long options. */
    12 /* BB_AUDIT Note: gnu chown does not support -H, -L, or -P. */
     10/* BB_AUDIT SUSv3 defects - none? */
     11/* BB_AUDIT GNU defects - unsupported long options. */
    1312/* http://www.opengroup.org/onlinepubs/007904975/utilities/chown.html */
    1413
    15 #include <stdlib.h>
    16 #include <unistd.h>
    17 #include <string.h>
    18 #include "busybox.h"
     14#include "libbb.h"
    1915
    20 static uid_t uid = -1;
    21 static gid_t gid = -1;
     16/* This is a NOEXEC applet. Be very careful! */
    2217
    23 static int (*chown_func)(const char *, uid_t, gid_t) = chown;
     18
     19#define OPT_STR     ("Rh" USE_DESKTOP("vcfLHP"))
     20#define BIT_RECURSE 1
     21#define OPT_RECURSE (option_mask32 & 1)
     22#define OPT_NODEREF (option_mask32 & 2)
     23#define OPT_VERBOSE (USE_DESKTOP(option_mask32 & 0x04) SKIP_DESKTOP(0))
     24#define OPT_CHANGED (USE_DESKTOP(option_mask32 & 0x08) SKIP_DESKTOP(0))
     25#define OPT_QUIET   (USE_DESKTOP(option_mask32 & 0x10) SKIP_DESKTOP(0))
     26/* POSIX options
     27 * -L traverse every symbolic link to a directory encountered
     28 * -H if a command line argument is a symbolic link to a directory, traverse it
     29 * -P do not traverse any symbolic links (default)
     30 * We do not conform to the following:
     31 * "Specifying more than one of -H, -L, and -P is not an error.
     32 * The last option specified shall determine the behavior of the utility." */
     33/* -L */
     34#define BIT_TRAVERSE 0x20
     35#define OPT_TRAVERSE (USE_DESKTOP(option_mask32 & BIT_TRAVERSE) SKIP_DESKTOP(0))
     36/* -H or -L */
     37#define BIT_TRAVERSE_TOP (0x20|0x40)
     38#define OPT_TRAVERSE_TOP (USE_DESKTOP(option_mask32 & BIT_TRAVERSE_TOP) SKIP_DESKTOP(0))
     39
     40typedef int (*chown_fptr)(const char *, uid_t, gid_t);
     41
     42static struct bb_uidgid_t ugid = { -1, -1 };
    2443
    2544static int fileAction(const char *fileName, struct stat *statbuf,
    26         void ATTRIBUTE_UNUSED *junk)
     45        void *cf, int depth)
    2746{
    28     if (!chown_func(fileName,
    29                 (uid == (uid_t)-1) ? statbuf->st_uid : uid,
    30                 (gid == (gid_t)-1) ? statbuf->st_gid : gid)) {
     47    uid_t u = (ugid.uid == (uid_t)-1) ? statbuf->st_uid : ugid.uid;
     48    gid_t g = (ugid.gid == (gid_t)-1) ? statbuf->st_gid : ugid.gid;
     49
     50    if (!((chown_fptr)cf)(fileName, u, g)) {
     51        if (OPT_VERBOSE
     52         || (OPT_CHANGED && (statbuf->st_uid != u || statbuf->st_gid != g))
     53        ) {
     54            printf("changed ownership of '%s' to %u:%u\n",
     55                    fileName, (unsigned)u, (unsigned)g);
     56        }
    3157        return TRUE;
    3258    }
    33     bb_perror_msg("%s", fileName);  /* A filename could have % in it... */
     59    if (!OPT_QUIET)
     60        bb_perror_msg("%s", fileName);  /* A filename can have % in it... */
    3461    return FALSE;
    3562}
    3663
    37 #define FLAG_R 1
    38 #define FLAG_h 2
    39 
     64int chown_main(int argc, char **argv);
    4065int chown_main(int argc, char **argv)
    4166{
     67    int retval = EXIT_SUCCESS;
    4268    int flags;
    43     int retval = EXIT_SUCCESS;
    44     char *groupName;
     69    chown_fptr chown_func;
    4570
    46     flags = bb_getopt_ulflags(argc, argv, "Rh");
     71    opt_complementary = "-2";
     72    getopt32(argv, OPT_STR);
     73    argv += optind;
    4774
    48     if (flags & FLAG_h) chown_func = lchown;
    49 
    50     if (argc - optind < 2) {
    51         bb_show_usage();
     75    /* This matches coreutils behavior (almost - see below) */
     76    chown_func = chown;
     77    if (OPT_NODEREF
     78        /* || (OPT_RECURSE && !OPT_TRAVERSE_TOP): */
     79        USE_DESKTOP( || (option_mask32 & (BIT_RECURSE|BIT_TRAVERSE_TOP)) == BIT_RECURSE)
     80    ) {
     81        chown_func = lchown;
    5282    }
    5383
    54     argv += optind;
     84    flags = ACTION_DEPTHFIRST; /* match coreutils order */
     85    if (OPT_RECURSE)
     86        flags |= ACTION_RECURSE;
     87    if (OPT_TRAVERSE_TOP)
     88        flags |= ACTION_FOLLOWLINKS_L0; /* -H/-L: follow links on depth 0 */
     89    if (OPT_TRAVERSE)
     90        flags |= ACTION_FOLLOWLINKS; /* follow links if -L */
    5591
    56     /* First, check if there is a group name here */
    57     if ((groupName = strchr(*argv, '.')) == NULL) {
    58         groupName = strchr(*argv, ':');
    59     }
    60 
    61     /* Check for the username and groupname */
    62     if (groupName) {
    63         *groupName++ = '\0';
    64         gid = get_ug_id(groupName, bb_xgetgrnam);
    65     }
    66     if (--groupName != *argv) uid = get_ug_id(*argv, bb_xgetpwnam);
    67     ++argv;
     92    parse_chown_usergroup_or_die(&ugid, argv[0]);
    6893
    6994    /* Ok, ready to do the deed now */
     95    argv++;
    7096    do {
    71         if (! recursive_action (*argv, (flags & FLAG_R), FALSE, FALSE,
    72                                 fileAction, fileAction, NULL)) {
     97        if (!recursive_action(*argv,
     98                flags,          /* flags */
     99                fileAction,     /* file action */
     100                fileAction,     /* dir action */
     101                chown_func,     /* user data */
     102                0)              /* depth */
     103        ) {
    73104            retval = EXIT_FAILURE;
    74105        }
     
    77108    return retval;
    78109}
     110
     111/*
     112Testcase. Run in empty directory.
     113
     114#!/bin/sh
     115t1="/tmp/busybox chown"
     116t2="/usr/bin/chown"
     117create() {
     118    rm -rf $1; mkdir $1
     119    (
     120    cd $1 || exit 1
     121    mkdir dir dir2
     122    >up
     123    >file
     124    >dir/file
     125    >dir2/file
     126    ln -s dir linkdir
     127    ln -s file linkfile
     128    ln -s ../up dir/linkup
     129    ln -s ../dir2 dir/linkupdir2
     130    )
     131    chown -R 0:0 $1
     132}
     133tst() {
     134    create test1
     135    create test2
     136    echo "[$1]" >>test1.out
     137    echo "[$1]" >>test2.out
     138    (cd test1; $t1 $1) >>test1.out 2>&1
     139    (cd test2; $t2 $1) >>test2.out 2>&1
     140    (cd test1; ls -lnR) >out1
     141    (cd test2; ls -lnR) >out2
     142    echo "chown $1" >out.diff
     143    if ! diff -u out1 out2 >>out.diff; then exit 1; fi
     144    rm out.diff
     145}
     146tst_for_each() {
     147    tst "$1 1:1 file"
     148    tst "$1 1:1 dir"
     149    tst "$1 1:1 linkdir"
     150    tst "$1 1:1 linkfile"
     151}
     152echo "If script produced 'out.diff' file, then at least one testcase failed"
     153>test1.out
     154>test2.out
     155# These match coreutils 6.8:
     156tst_for_each "-v"
     157tst_for_each "-vR"
     158tst_for_each "-vRP"
     159tst_for_each "-vRL"
     160tst_for_each "-vRH"
     161tst_for_each "-vh"
     162tst_for_each "-vhR"
     163tst_for_each "-vhRP"
     164tst_for_each "-vhRL"
     165tst_for_each "-vhRH"
     166# Fix `name' in coreutils output
     167sed 's/`/'"'"'/g' -i test2.out
     168# Compare us with coreutils output
     169diff -u test1.out test2.out
     170
     171*/
Note: See TracChangeset for help on using the changeset viewer.