The Register Home Page

back to article Backup script ingested an accidental asterisk and deleted everything

WHO, ME? Welcome to Monday morning, the time of week when The Register always asks “Who, Me?” because that’s the title of our reader-contributed column in which you confess to having made a mess, and found a way to egress without career distress. This week, meet a reader we’ll Regomize as “Miller” who told us that as a …

  1. Kurgan Silver badge

    Restored, which is good.

    The fact that that data could be restored shows that they were not totally clueless. A mistake was made, but a fix was available. Today, with all of the modern practices, devops and such, it seems that backups and restores are not always properly implemented and working. Or even just considered.

    1. Phil O'Sophical Silver badge

      Re: Restored, which is good.

      In 1981 we understood the need for such things, computers were less reliable and we didn't assume that somebody else would take care of any problems. I well remember Monday mornings as a part-time admin, booting the VAX under standalone backup and copying the "huge" 256MB system disk to the spare, with the source disk going into the fireproof safe afterwards. Could be nerve-wracking, it was always a comfort to press the write-protect on the source drive. I know one admin in the company who didn't do that, and then reversed the source and blank drive names in the backup command...

      1. Kurgan Silver badge

        Re: Restored, which is good.

        Hardware write protect, what a great thing of the past. I made the "swap source and destination" error once in my career, and it was on a "rsync --delete". On a production samba domain controller.

        And I am super extra careful... so I did it only once.

        1. Mast1

          Re: Restored, which is good.

          "And I am super extra careful... so I did it only once."

          Polite suggested correction : should really be "And I am super extra careful... so I did it only once, so far".

          Until one is pushing up the daisies, one can never be sure of there being no repeat. The oft quoted here Terry Pratchett meme of once in a million....

          1. Sir Sham Cad

            Re: Restored, which is good.

            Oh I'm fairly sure when I'm pushing up daises, hopefully many years hence, I'll be blamed for some cockup 30-40 years from now. Touch it once etc...

        2. JacobZ

          Re: Restored, which is good.

          I once made that mistake on a disk drive with an integrated cartridge drive which had a great feature that allowed you to clone the disk to the tape with a single button push, or vice versa. Which is great right up until the point you accidentally do "vice versa" with a blank tape...

        3. disgruntled yank

          Re: Restored, which is good.

          @Kurgan

          Yes to write protect.

          About forty years ago, my employer promoted a guy from the loading dock to the job of running update tapes for customers. The fellow who was his mentor insisted that he bring him the write wring from each tape he cut, which the mentor would toss into a drawer. One of us once asked, Gee, Ham, what do you do with all those write rings? Ham said, I give them to the orphans, pal.

  2. blu3b3rry Silver badge
    Windows

    Ah, to be 21 again....

    Admittedly not thanks to code he had written, but I recall one of our interns managing to move several TB worth of data off a SharePoint server he was responsible for into the recycle bin.

    He spent the next ten or so working days digging through the recycle bin restoring everything back to its original place. I think having to use the horrific Sharepoint web UI for that length of time was a fitting punishment in itself.

    1. Evil Auditor Silver badge

      Re: Ah, to be 21 again....

      I think having to use the horrific Sharepoint web UI

      It's what I call cruel and unusual punishment. And I'd inflict that, too.

  3. Kurgan Silver badge

    Classic (or clbuttic?) mistake

    I've seen this mistake multiple times. you make a string out of root path + discovered target path + "*" and then feed it to rm -rf. Now if discovery fails and the discovered target path is an empty variable, you get a nice rm -rf /root/path/* Or maybe just rm -rf /*

    Easily fixed by MULTIPLE REDUNDANT error checking, and a sanity check in the end like "if the string's total length is less than X, abort".

    I've seen a windows program install / uninstall script delete the whole drive (in win xp times) because of this.

    1. Stevie Silver badge

      Re: Classic (or clbuttic?) mistake

      On Unix I learned really fast to do this sort of thing:

      MYWD=`pwd`

      cd SOME_OTHER_DIRECTORY

      MYCD=`pwd`

      if [[ $MYCD != 'SOME_OTHER_DIRECTORY' ]]

      then

      do_useful_stuff

      cd $MYWD

      else

      STOP_END_FINISH_SCREAM_DO_NOTHING_FOR_CROMS_SAKE_AAAAAARRGH

      fi

      1. mangobrain

        Re: Classic (or clbuttic?) mistake

        > if [[ $MYCD != 'SOME_OTHER_DIRECTORY' ]]

        > then

        > do_useful_stuff

        You sure about that not-equals there, friendo?

        1. Stevie Silver badge

          Re: Classic (or clbuttic?) mistake

          Stupid edit.

          1. Anonymous Coward
            Anonymous Coward

            Re: Classic (or clbuttic?) mistake

            Not entirely sure what you are protecting against.

            If the purpose of the IF test is to ensure that you successfully changed directories then testing for success after doing a PUSHD $SOME_OTHER_DIRECTORY would be simpler.

            One advantage of the IF test is that if SOME_OTHER_DIRECTORY is soft linked to somewhere else then it will fail whereas PUSHD won't.

    2. DS999 Silver badge

      I have to blame the mainframe OS for a lot of this

      Why would it default to allowing a SCRIPT to execute a wildcard delete of every drive in the system without any sort of confirmation? Would you expect an OS to allow formatting the system drive the OS is currently running on without confirmation? Neither of those are likely to be things that you intended to have happen, and if you do you'd do it so rarely that having to provide manual confirmation is not a problem.

      Now yes he could have sanity checked and made sure the drive letter he was deleting was in fact a "letter" or running some sort of command against that drive letter that might have uncovered the issue. But while I might have been curious "what happens if you run out of drive letters", unless there was some sort of OS documentation you could read that would have told you my assumption would probably have been "you get an error message if you try to use a 27th drive letter" not that it assigns a "*". Did every drive past the 26th get the same "*"? If so, how would it have been possible to uniquely identify drive 27 vs drive 28? Was there some sort of index number or UUID he could have used instead?

      1. swm

        Re: I have to blame the mainframe OS for a lot of this

        like the linux command dd?

    3. swm

      Re: Classic (or clbuttic?) mistake

      At the college where I was teaching someone was deleting all the files in the homework submission directory. Nothing was working. I tried submitting something and left the program running. I then went down to the support person and asked him to print out all users logged into the course submission account. My name came up and I seemed to be running rm -rf * in the top-level submission directory.

      I stopped my program from running and after some trouble shooting discovered the problem:

      The submission directory was over quota and the submission program was unable to create any of the sub-directories needed for the submission. The submission cleanup script then did a rm -rf * on the top-level directory because the system had failed to create the temporary directories so the cd commands were noops.

      Once we found the root cause we just doubled the quotas for the submission directory making the problem go away for awhile.

      Next day I told the class what had happened. I mentioned that backups would be useful in this case and the class chuckled. I then explained that we had a fairly extensive backup system and could (and did) restore the files from a few hours before the problem. Students did have to resubmit any homework from the previous day but not a big deal.

  4. Flightmode
    Pint

    >in which you confess to having made a mess, and found a way to egress without career distress.

    Yes.

  5. Anonymous Coward
    Anonymous Coward

    Get out of jail free?

    I've seen some online stores carrying enamel pins with the text "In my defense: I was left unsupervised.". I'm strongly considering getting one.

    1. Bebu sa Ware Silver badge
      Coat

      Re: Get out of jail free?

      "I've seen some online stores carrying enamel pins with the text "In my defense: I was left unsupervised.". I'm strongly considering getting one."

      Better get two and send one to the orange ejit.

      1. Anonymous Coward
        Anonymous Coward

        All the supervision in the world will do no good if it is ignored.

  6. Manolo
    Coat

    Which alphabet

    "It took Miller a day to restore data, while 20 other people twiddled their thumbs and waited for him to finish the job."

    In that case I wonder which alphabet they were using.

    1. Martin an gof Silver badge

      Re: Which alphabet

      I wonder which alphabet they were using

      Dunno about this "mainframe", but DOS typically allocated A: and B: to (non-existant) floppy discs and C: to the main hard drive. Z: was often allocated to a network share. Additional drives therefore often started at D: and finished (at best) at Y: so, Miller plus 20 others makes 21, plus A, B, C and Z makes 25, leaving just one letter of the 26 "free" until a new user is added?

      M.

      1. Bebu sa Ware Silver badge
        Windows

        Re: Which alphabet

        The routine attached to all users’ drives and backed them up to a temporary drive,” Miller explained. “But you never knew in advance what drive letter the system would assign to the temporary drive."

        Which I read as mounting each user's drive *plus* creating and mounting another one to back them up to.

        The "20 others" thumb twiddlers might not meant literally - 20 odd, perhaps. Maybe a few more intelligent of the crew decided to bugger off for the rest of the day to do something more productive. In 1981, in some places it wasn't completely unknown for employees to be found propping up bars during work hours.

        The basic programming lesson everyone needs to learn, sooner rather than later, is to always check for error returns - if the return is not OK and you don't specifically handle that error… bail. Only a fraction of cases it might be better not to abort but deciding those comes under the heading of specifically handling if a little anaemically.

      2. Pete Sdev Silver badge
        Thumb Down

        Re: Which alphabet

        DOS typically allocated A: and B: to (non-existant) floppy discs and C: to the main hard drive

        Having used a DOS machine with 2 floppy drives (fancy, wasn't mine) of the 5.25" variety in the early 1990s (roughly a decade after the story in the article) I can assure you that A: and B: weren't always non-existent. Neither was the existence of a hard-drive (expensive!) a given in this period.

        1. Martin an gof Silver badge

          Re: Which alphabet

          Well yes, but "virtual"?

          My point was that even if you didn't have physical drives, DOS still by default allocated drive letters for them, thus "wasting" a couple.

          M.

          1. Philo T Farnsworth Silver badge

            Re: Which alphabet

            It vaguely sounds like IBM's mainframe OS CP/CMS aka VM/CMS, which was current in that era, where all users ran in a virtual machine with virtual disks, card readers, and card punches (yes, card readers and punches!), though the disk naming and handling conventions were considerably different.

            1. Bob Royal

              Re: Which alphabet

              Not many years ago, I changed the motherboard in my "Legacy" m/c.

              Thort I'd load it with old disks: 2*3.5" plus a Zip ( remember them?)

              Turns out all my floppy cables (actually the stiff sort) I had cropped to single point to point! Arrrgh!

              Found a computer shop (was a few years ago) with an old fashioned ribbon jobbie.

              Plugged it all together and found the "new" motherboard only drives ONE floppy! B***er.

              P.s. Philo -- Any relation to the old boy I used to ring with name of Farnsworth?

              -- or the chap who invented TV?

          2. Tron Silver badge

            Re: Which alphabet

            When HDDs were too expensive, having 2 FDDs was very handy.

            Not sure reserving drive letters is 'wasting' them so much as sensible design. Ditto MS's endless 'Do you really want to hurt me?' text queries/dialogue boxes when you are about to do something. Even Jedi make mistakes.

            That's 2 nice things about MS, so I've maxed out my quota for the rest of the decade.

        2. tiggity Silver badge

          Re: Which alphabet

          Yes. I remember an old PC with 2 floppies, one of" each" size (5.25 & 3.5) as it was the time when 3.5 was becoming dominant*, but 5.25 had not been totally replaced & a period of transition.

          .. making me feel old!

          * as more storage, smaller size (though thicker) & protective shell were big advantages of the 3.5

      3. GlenP Silver badge

        Re: Which alphabet

        DOS typically allocated A: and B: to (non-existent) floppy discs and C: to the main hard drive

        Not on all DOS machines - I think that was more a function of IBM compatibility.

        ACT allocated the disk drives in order of HDs then FDs so an HD machine with a single floppy would have A: as the HD then B: as the FD but a twin floppy machine would have A: and B: as FDs.

        Which was fine if that's all you were working with, but if you'd just come from a PC compatible and went to format a floppy when it was all too easy to type FORMAT A: <Return>, quickly followed by "Oh shit" and Ctrl-C! Thank goodness for Norton UNDELETE!

    2. Anonymous Coward Silver badge
      Holmes

      Re: Which alphabet

      Some people have an amazing capability of being able to get on with (at least part of) their job without using a computer. Weird, I know, but more common in those days.

      Let alone the possibility of someone going on holiday at that time.

    3. Anonymous Coward
      Anonymous Coward

      Re: Which alphabet

      bah, i forgot about system reserved drive letters...so it wasn't 25 people...

  7. PCScreenOnly Silver badge

    Clustefuck

    Had that at a company many years ago, A contractor was in and wrote a quick CMD routine to do some work on some cluster nodes. I had no idea and even less idea why the guy who looked after the clusters had spent the last few weekends in fixing them until I get asked to have a look at a script that is a bit suspect. On initial checking I see nothing obviously wrong. It is just tidying up the folders it was meant to do.

    I them take the script and run via in step mode and yup, all good until the last line. It asks me an unexpected question so I stop. I had another look and there was an extra space at the end of the line that made the command want to delete the whole drive - which is what it had done for the last few weekends.

    The command runs nicely without quotes around the folders, but did not make this extra space visible and the ramifications it held

    1. CrazyOldCatMan Silver badge

      Re: Clustefuck

      had another look and there was an extra space at the end of the line that made the command want to delete the whole drive - which is what it had done for the last few weekend

      Many years ago, (early-mid 90's?) when I was playing with linux for the first time (all those floppies - downloaded by a friend at work because they had Internet and I didn't.. Slackware 0.99pl15) I had, finally, set everything up including dial-on-demand to Demon (remember them? At the time they were the techiest of ISPs and had FAQs on how to do stuff like setting up a mail server/dial on demand etc for linux).

      So there I was, with a fully-working linux box, patched, one ping away from internet access (wwoo-wiing-pang-pang-swoosh[1]), at 3am. With a nice glass of single malt to celebrate.

      Thought "I'll just clean up the tmp directory"..

      Typed "rm -rf / tmp" and hit enter.

      Then frantically hit ctrl-c until I got the command prompt again.

      Fortunately, all the relevant bits (/etc mostly) were still intact and the slackware installer let me do an upgrade install without nuking stuff.

      Lesson still very much stuck in my head. Don't do potentially-destructive stuff at 3am, after a (ahem) decent-sized glass of whisky.

  8. Prst. V.Jeltz Silver badge

    Damn unlucky

    The call for temp disk failed and my routine passed back an asterisk instead of an error code,” Miller confessed.,

    WDamn unlucky to be fair , what an unfortunate sequence of events !

    Theres been an error - here have a wildcard and play with that - it might do the job!

    Its kinda similar to how a "Buffer overrun" will execute an inturders code for them , rather than brick the machine abd crash it - which to me seems far more likely

    1. stiine Silver badge
      Pint

      Re: Damn unlucky

      An inturder? What an absolutely fucking magnificient typo.

      1. Phil O'Sophical Silver badge
        Happy

        Re: Damn unlucky

        Clearly a cause of enshittification

      2. Prst. V.Jeltz Silver badge
        Pint

        Re: fucking magnificient typo

        why thank you sir!

  9. Fruit and Nutcase Silver badge
    Mushroom

    WHO, ME? 2030

    "Letting a 21-year-old[AI] write critical code without supervision is not smart"

    2030 - by that time either I have either kicked the bucket or retired to a remote location far from "civilization" to give a damn

  10. ComicalEngineer Silver badge

    Who me? 1988

    Sounds like a young graduate who I had the misfortune of working with in 1988/9 on a very basic IBM PC (I think it had a whole 20mb HDD).

    Junior had a bad case of Dunning Kruger where using a computer was concerned and on several occasions wiped key files off the HDD due to a combination of sheer incompetence and not doing the basic RTFM for DOS commands before hitting return.

    I think I bailed him (and the project) out on no less than 3 occasions because I'm the sort of obsessive who backs up everything (in this case on a box of floppies securely locked in my desk drawer). On the third time of him wiping a weeks work (no waste bin in those days to retrieve the files) I threatened him with physical violence having had to spend good drinking time on a Friday evening sorting out his mess. Junior didn't drink.

    The threat of violence got me a telling off albeit a gentle one after I explained what he'd done.

    1. Yet Another Anonymous coward Silver badge

      Re: Who me? 1988

      You can't even beat the minions these days without the political correct mob getting on your back.

      Bring back capital punishment in schools

      1. ttlanhil

        Re: Who me? 1988

        capital punishment? Seems excessive - no-one learns from that being applied to them...

        1. Yet Another Anonymous coward Silver badge

          Re: Who me? 1988

          I went to Catholic school, with nuns.

          The example of the kid that got nailed to a plus sign for getting sums wrong certainly encouraged the rest of us.

          1. ttlanhil

            Re: Who me? 1988

            Only a big plus when it's mounted

            When it's being moved around, it's a multiplication

            And yeah - capital punishment can put the fear into other people, but it's a bit all-or-nothing and you don't have much scope to escalate from there (next step is decimation?)

            1. Anonymous Coward
        2. theblackhand

          Re: Who me? 1988

          They may not learn, but sometimes setting an example for the other students has a greater outcome...

        3. This post has been deleted by its author

    2. An_Old_Dog Silver badge

      Re: Who me? 1988

      Upon the third time, hide the backup media, then say to Junior, "I can't recall where I put those. I probably could remember if I was drunk. Let's go to pub X and get me drunk. You're buying."

    3. CrazyOldCatMan Silver badge

      Re: Who me? 1988

      Junior didn't drink.

      [Sucks teeth]

      Never trust someone that can't hold their drink. Especially if the glass breaks as well.

  11. An_Old_Dog Silver badge
    Joke

    No, No -- FIRST, Pillage, THEN Burn

    He therefore wrote a cleanup routine that removed the drives and backed up their contents.

    Non-existant (removed) drives are very-quickly backed-up!

    1. stiine Silver badge

      Re: No, No -- FIRST, Pillage, THEN Burn

      FYI, "pillage" does come before "burn", but still isn't supposed to be the first thing done by barbarian invaders.

      1. Stevie Silver badge

        Re: No, No -- FIRST, Pillage, THEN Burn

        Maxim 1.

        IYKYK

        1. Martin Howe
          Joke

          Re: No, No -- FIRST, Pillage, THEN Burn

          Horizon 8 billion parsecs -->

          (for those with long memories)

  12. JacobZ

    Intelligence

    You know what would really impress me as an example of AI? Capability built into the OS that could spot something like this and go "I suppose it's possible you intend to erase everything, but it seems unusual. If that is really what you meant, [do some elaborate procedure much more complicated than simply clicking "Yes" in a dialog box".

    Of course, this would probably require a _real_ AI that understood something about systems and ops, not a stochastic parrot that had reduced the entirety of the internet to pink slime.

    1. IGotOut Silver badge

      Re: Intelligence

      Where as current AI would go "What a great script. You're so clever, I'll delete everything for you right away. In fact I know you are so intelligent, you probably want me to wipe the BIOS as well, so I'll make sure that is done as well. No need to press OK as I've done that for you, because a genius like you can't make a mistake."

    2. Yet Another Anonymous coward Silver badge

      Re: Intelligence

      IIRC modern Unix shells block "rm -rf /" by default

      Doesn't help with the: RAID labels drives from 0 but chassis labels are from 1 "error"

  13. gosand

    I found the intro to be odd stating that 'Who, me?' is the title of the reader-contributed column, when it's not showing up in the title of the article at all. My question is "Why not?"

    It sure would make it easy to spot on Mondays.

    1. Yet Another Anonymous coward Silver badge

      "Why not" would also be a perfect title

    2. Robert Carnegie Silver badge

      It's at the top of each news page now. (But not this one.)

      Datacenter - Security - Microsoft - AWS - Developer - Open Source - IT Careers - Columnists - Who, Me? - On Call

  14. TSM

    > This story took place in 1981, a time when it was possible for code written by a 21-year-old to go into production without much scrutiny.

    Ah. Unlike today, then? Or any other time in the last 45 years?

  15. CA_Diver
    Go

    School of Hard Knocks Graduate

    Congratulations, Miller you've unlocked Accidental Delete Achievement. Unnoticed Accidental Delete is a potential upgrade. You've joined the club.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon