Slashdot Mirror


Data Loss Bug In OS X 10.5 Leopard

An anonymous reader writes "Leopard's Finder has a glaring bug in its directory-moving code, leading to horrendous data loss if a destination volume disappears while a move operation is in progress. This author first came across it when Samba crashed while he was moving a directory from his desktop over to a Samba mount on his FreeBSD server."

24 of 603 comments (clear)

  1. That's silly. by ackthpt · · Score: 5, Funny

    Normally while moving you ensure the copy completed before deleting the original. Apple must be using some discount programmers.

    --

    A feeling of having made the same mistake before: Deja Foobar
    1. Re:That's silly. by Hatta · · Score: 5, Informative

      Why don't you just use rsync?

      --
      Give me Classic Slashdot or give me death!
    2. Re:That's silly. by Frothy+Walrus · · Score: 5, Informative

      Oh yeah, rsync. Is that one still broken on 10.5? Apple's build of rsync on 10.4 consistently choked on a few files when my dad started using it on his Mac Pro.

    3. Re:That's silly. by ackthpt · · Score: 5, Informative

      So what happens if you're moving a 120GB folder one directory level on a 150GB disk?

      Typically if you are moving within the same logical device the file pointer is moved and no copying need take place.

      When moving to another device your code reads and writes, within a loop and traps exceptions (such as the device suddenly vanished, where the OS should raise an exception and your application traps it.) A wide variety of errors could occur while moving and in the event any of them happen the user should be notified in an appropriate manner and the original data not deleted.

      I've written a number of applications which moved files or data between databases and it's fundamental your application is on the watch for any problems. Not to have an exception raised or to trap any and all, well, that's simply an inexcusable lapse.

      This sort of thing is extremely critical if you happend to be defragmenting a disk drive. Long before Macs and PCs we had to defrag our mainframe drives and the applications which did the work were quite careful. Often the best practice, if you had the resource of a second drive, was to simply defrag to a new drive then re-assign the new dist as the original.

      --

      A feeling of having made the same mistake before: Deja Foobar
    4. Re:That's silly. by Taagehornet · · Score: 5, Insightful

      this is not what current generation of typical user would do, but I believe they should be educated on this anyway

      Reeducate the user, you say. Surely you must be joking, right?

      Let's ignore for a moment that Leopard may have a few bugs that will have to be ironed out. That's only to be expected with *_any_* newly released OS and the reason why no sane person would ever dare to update the OS on a mission critical machine within the first few months of the release.

      However, if you can't rely on your OS to perform a simple file move without risking data corruption, then the right solution is definitely not to verify every single operation by hand. Automating tedious tasks is exactly what computers do best, and that the OS ensures the integrity of the copy before throwing away the original is definitely something you should expect.

    5. Re:That's silly. by kisielk · · Score: 5, Informative

      There have been resource fork patches for some time, but somewhat unreliable. Version 3.0 is going to support resource forks (and other types of extended attributes) out of the box. The setup we have been using extracts resource forks to a separate file on the mac and then backs them up alongside the original files. The restore process just performs the reverse. It will be nice once we can switch to rsync 3.0 and get rid of that step.

  2. Tiger has this problem as well!!! by itsybitsy · · Score: 5, Informative

    I lost a huge amount of data being MOVED (not copied) from one volume into a virtual volume DMG file. Lost and gone forever, lots of important files. What happened? I simply bumped the laptop Mac Book Pro during the move... zap... gone forever. The DMG file was blank! Yes, complely zero bytes except for a bit of header non-file data. It sucks bad.

    1. Re:Tiger has this problem as well!!! by Chouonsoku · · Score: 5, Interesting

      Just wanted to also confirm that the bug was in Tiger. I was backing up music files to do a clean format for Leopard and lost everything when the hard drive got disconnected by mistake.

    2. Re:Tiger has this problem as well!!! by Liquidrage · · Score: 5, Insightful

      Can't agree with you. It is the exact type of that is usually caught by automated testing. The issue isn't that a hard drive was bumped. The issue is that the write operation failed. In this case due to a drive no longer being accessible. The failure is easily automated, and the result of that failure is easy to catch.

      And I wouldn't exactly call this regression testing, as such functions as file movement aren't usually impacted by later changes. It should be pretty basic on the design chart. Sounds to me more like "working as intended...use move at your own risk". Which I think it stupid, but I don't see how this really was *missed*, especially since some are claiming it's been this way since at least Tiger.

  3. Wait... by ackthpt · · Score: 5, Funny

    It's kind of strange that this didn't come up while people were beta testing OS X 10.5. Samba is used in many places. I hope they get it fixed soon.

    Exactly which decade did you fall into your recently awkened from coma in? Testing? Testing? Nobody tests anything anymore, they just go play with all the new toys and stare at the eye-candy. Actual mundane, humdrum testing? That's an SEP if ever I didn't see one.

    --

    A feeling of having made the same mistake before: Deja Foobar
  4. You just don't get it... by juanfgs · · Score: 5, Funny

    This is the new Leopard "iLostMyFrigginFiles" feature, next version they will add a badass black hole effect when it does that!

    1. Re:You just don't get it... by DigiShaman · · Score: 5, Funny

      Oh great! Soon, Windows users will experience "white holes" where Mac files magically appear in the My Documents folder.

      --
      Life is not for the lazy.
  5. Par for the course? by GoRK · · Score: 5, Informative

    No offense meant here, but normal move/copy operations are traditionally highly destructive events on MacOS anyway. For instance there is absolutely no simple way to merge two folders contents together on the mac. If you drag a folder called "Documents" into your home directory and click on "OK", the Mac OS will happily delete your entire documents folder. I was reminded of this enormous frustration while recovering from some multi-volume backups recently, having to resort to an obscure OS X commandline tool 'pax' and Leopard's newfound support of hardlinks to make some simple file copies play nice and not unnecessarily consume 3 times the disk space they should have.

    For all of the flack the Windows file copy interface gets, it is both safer and more flexible than trying to use the Finder: an interface that makes file management so stupefying it becomes impossible.

    1. Re:Par for the course? by Blakey+Rat · · Score: 5, Interesting

      That's left over from the original spatial Finder design in Mac Classic. Apple hasn't really decided whether they want to get rid of the spatial interface, so instead they've made this horrible frankenstein half-spatial, half-browser interface which pretty much everybody hates.

      Doing a "replace" for that operation makes sense in a spatial system because all spatial icons are treated the same way. You'd wouldn't expect dragging a Word file named "happy.doc" into a folder already containing a "happy.doc" to perform a merge operation; so why would you expect that with a folder in the same situation?

      That said, if you've never used Mac Classic, you'd think OS X has nothing but a browser interface, in which case all metaphors and ideals are out the damned window, and the OS might as well do a merge operation. Since you most likely came from Windows, or a Linux environment ripped-off from Linux, you'd expect dragging identically-named folders together to do a merge operation because that's what you're used to.

      Apple needs to make up its mind what Finder is. It gets worse and worse every version.

    2. Re:Par for the course? by JunoonX · · Score: 5, Insightful

      When two folders, both named "Documents", where one is dragged and dropped into the home directory containing another "Documents" folder, Windows prompts if you want to replace content from the dropped folder on to the one being dropped on. At this point, if any files with same name are encountered, they will be replaced with the one from the first directory; however, all other files in folder will stay intact.

    3. Re:Par for the course? by nine-times · · Score: 5, Insightful

      If you drag a folder called "Documents" into your home directory and click on "OK",

      To be fair, I don't think it asks you whether it's ok to move that directory. It will warn you that it's going to replace that folder, and the buttons will either say, "Replace" or "Stop". It's not that ambiguous.

      The only thing that makes it problematic is if you're accustomed to working in a file manager that will automatically merge directories, then you might think it's going to merge when it's actually going to replace. I would say that neither behavior is "wrong", but you certainly can get unhappy results if you're expecting one behavior and get another.

      Honestly, it took me a little while to get used to it, but now that I expect it, it's fine. Usually, if I'm doing anything complicated with copying/moving lots of stuff recursively, I'm going to want to use a command line anyhow. In the command-line, "cp" and "mv" work in normal unix fashion.

  6. Re:A great disturbance in the Apple by kerohazel · · Score: 5, Funny

    Yes, but if their data is stricken down, it will become more powerful than we can possibly imagine.

    --
    Skype is too convoluted... Now I'm reverse-engineering the Kyoto Protocol.
  7. Ah, the "outsourcing" coding model.. by eniac42 · · Score: 5, Funny

    Advert on Amazon Mechanical Turk:
    Write OS-X compatible application to Move a file between two filesystem devices..
    Time Allotted:: 6 hours. Reward: $10.00..

    --
    "A nation that forgets its past is doomed to repeat it." - Churchill
    1. Re:Ah, the "outsourcing" coding model.. by beav007 · · Score: 5, Informative

      Um... no. REALLY no. Please don't do that.

      The syntax for "||" is:
      If command 1 fails, do command 2 - otherwise exit (where you used "command1 || command2").

      In this case, your command will either copy all the files from $from to $to or delete all files at $from.

      What you probably meant is cp $from $to && rm -r $from, which only performs the second command if the first succeeded. This solution is far from perfect for reasons mentioned by other posters, but it's still significantly safer and more useful than yours...

    2. Re:Ah, the "outsourcing" coding model.. by megaditto · · Score: 5, Funny

      And that's probably why you don't work for Apple!

      --
      Obama likes poor people so much, he wants to make more of them.
  8. Re:Terrible bug by Knara · · Score: 5, Insightful

    You're asking if a bug wherein entire folder hierarchies can go *poof* in the event a network share drops should be considered critical? Are you serious?

  9. "haha" by MutantEnemy · · Score: 5, Interesting

    Why is every destructive computer bug that happens tagged with "haha"?

    Data Loss Bug In OS X 10.5 Leopard
    bug, macosx, apple, haha

    Symantec Updates Cause Chaos in China
    haha, security, bug, windows, feature

    Banner Ad on Myspace Serves Adware to 1 Million
    haha, myspace, pwnd, security, adware

    Ubuntu May Be Killing Your Laptop's Hard Drive
    linux, haha, storage, bug, spam

    Islamists exploit buffer overflow, hack U.S. nuclear command; world doomed
    eschaton, religion, waronterror, haha

    OK, I made one of those up. But it doesn't even matter what OS or company is responsible for the problem - whoever makes the tags seems to take great delight in all computer snafus. How does the tagging system work anyway? It's always been mysterious to me.

    --
    Grr! Arg!
  10. Re:I don't understand by t35t0r · · Score: 5, Informative

    NFS write failure on Linux 2.4, check your data is gone.

    Uhh no. In linux mv's always make sure the data moved then delete the original file (as far back as 2.4). You can test this by dd'ing a large file (use if=/dev/urandom), then run a md5sum on it, then do a mv within the same drive, over nfs, over samba/cifs, to floppy (not sure what happens here because linux caches writes to floppies until umount), to usb drive, whatever. While the mv is in operation just pull the plug on the system (target or source system). Your old file will still be there!

  11. That's missing the point... by megaduck · · Score: 5, Interesting

    Speaking as one of those IT people, NTFS is probably one of the coolest pieces of software ever to come out of Redmond. ACLs, alternate data streams, directory junctions, single-instance stores, shadow copy, the list of useful features is huge. Even more surprisingly, it works pretty much as advertised. Frickin' cool.

    There's another angle, though. On paper, Vista's NTFS-based backup technology walks all over Time Machine. However, the USABILITY of Vista's technology is crap. This morning, I enabled Time Machine by plugging in a USB drive and clicking "Use as Backup Disk" when prompted. To do restores, I launch the cleverly named "Time Machine" application. I've already used it twice today just because it's fun to watch the spacey animations.

    Compare that to Vista's clunky "Backup and Restore Center", which you have to use if you want to backup your files on an alternate volume. I guarantee you that using "Backup and Restore Center" is beyond most average users. Sure, it might be "better", but what good is it if it never gets used?

    --
    This .sig for rent.