Slashdot Mirror


iTunes 2.0 Installer Deletes Hard Drives

Cheviot writes: "It seems Apple's new iTunes 2 installer deletes the contents of users' hard drives if the drives have been partitioned. I personally lost more than 100gb of data. More information is available at Apples Discussions board. (registration required). Apple has pulled the installer, but for hundreds, if not thousands, the damage is already done." The iTunes download page has a nice warning about the problem. Ouch.

4 of 511 comments (clear)

  1. quote by Jotham · · Score: 4, Informative
    the bug is apparently caused by the lack of quote marks in the install script.

    Apparently it only strikes if you 1) havn't uninstalled iTunes first 2) have multiple partitions and 3) have spaces in the name of your partitions

    This from MacSlash (posted by Graff as AC):

    Well, there is a fixed installer up now. Looks like the following change was made to the "Preflight" file inside the "iTunes.pkg" package:

    old version:

    #!/bin/sh

    # if iTunes application currently exists, delete it
    if [ -e $2Applications/iTunes.app ] ; then
    rm -rf $2Applications/iTunes.app 2> /dev/null
    fi

    exit 0

    new version:

    #!/bin/sh

    # if iTunes application currently exists, delete it
    if [ -e "$2Applications/iTunes.app" ] ; then
    rm -rf "$2Applications/iTunes.app" 2> /dev/null
    fi

    exit 0

    As you can see, they basically placed quotes around the file paths so that any characters such as spaces in path names would not mess up the rm command. So easy, and yet even the best of us forget to do it at times. That's one of the things about the command line - lots of power when used properly, but also many powerful ways to mess everything up.

    - Graff

  2. bogus shell quoting rules by mj6798 · · Score: 5, Informative
    This is really a problem in how the Bourne shell handles variables. Lots of UNIX scripts fail when file names contain spaces, which is why most people don't use spaces in file names.

    The folks at Bell Labs seem to have realized that this was a mistake, which is why the "rc" shell (also available for Linux) now handles things differently: variable substitution does not result in re-tokenizing.

  3. the REAL code, and how this did happen by Anonymous Coward · · Score: 4, Informative

    In the installer is a small shell script to remove any old copies of iTunes. It contained the following line of code:

    rm -rf $2Applications/iTunes.app 2
    where "$2" is the name of the drive iTunes is being installed on.

    The problem is, since the pathname is not in quotes, if the drive name has a space, and there are other drives named similarly then the installer will delete the similarly named drive (for instance if your drives are: "Disk", "Disk 1", and Disk 2" and you install on "Disk 1" then the command will become "rm -rf Disk 1/Applications/iTunes.app 2

    The new updated version of the installer replaced that line of code with:

    rm -rf "$2Applications/iTunes.app" 2
    so things should work fine now.

  4. Possible Fix... by DragonPup · · Score: 4, Informative

    Andrew Welch of Ambrosia Software posted a method that MIGHT work on recovering the files here. Basically sometimes the installer, according to Andrew, just messes with file permissions and visability, not actually deleting them.

    I didn't test this because iTunes didn't mess up my 5 partitions, thankfully.

    -Henry

    --
    "Useless organic meatbag" -HK-47