Slashdot Mirror


Mimic, the Evil Script That Will Drive Programmers To Insanity (github.com)

JustAnotherOldGuy writes: Mimic implements a devilishly sick idea floated on Twitter by Peter Ritchie: "Replace a semicolon (;) with a Greek question mark (;) in your friend's C# code and watch them pull their hair out over the syntax error." There are quite a few characters in the Unicode character set that look, to some extent or another, like others – homoglyphs. Mimic substitutes common ASCII characters for obscure homoglyphs. Caution: using this script may get you fired and/or beaten to a pulp.

33 of 246 comments (clear)

  1. Simple by Anonymous Coward · · Score: 5, Insightful

    git revert [commit]

    "Your commit broke the build. Fix it."

    Bonus points if your continuous integration build server catches it automatically.

    Then have a talk with the author of this non-sense commit about wasting corporate resources.

    1. Re:Simple by Rei · · Score: 4, Interesting

      Time-delayed or rarely-occurring "evil" can often be better. There's a number of examples here, although some would be harder to sneak past code review than others. Unless your code review system is lax, or (best) if you have write access to the repository. But some of the aforementioned ideas (or variants thereof) would be just brilliantly evil, to the point that the code works fine when you leave, but say three months later it starts rarely breaking at random times and locations, and the "code plague" just gets more and more common with time.

      One case where Mimic could sneak past the compiler (and code review) but still cause problems would be inside strings. For example, there's a number of characters that render like spaces but are actually multibyte unicode characters. Same with dashes, underscores, and many other characters. Using them would cause the length of the string to not be what the user thinks it is. And string operations could accidentally break up the unicode characters. Such errors could slip code review by and cause random inexplicable runtime errors for quite some time. And the nice thing about those kinds of errors are that you can chock them up to accidents. "Oh, I'm so sorry! I was just copying some code off the net, the character must have gotten mucked up..."

      --
      "Oh, goodness. Look at my wrist, I have to go." "But what about your clothes?" "I don't love these."
    2. Re:Simple by Opportunist · · Score: 5, Insightful

      Besides, anyone here who can honestly say he never did the "magic" thing, i.e. delete a line and retype it only to have it suddenly work for no good reason whatsoever?

      I dare say that most programmers would simply delete the offending line and retype it once everything that does actually make sense has been tried.

      Black magic. Do it. I get the candles, Fred brings the voodoo doll, you can start chanting.

      --
      We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
    3. Re:Simple by tomhath · · Score: 3, Insightful

      Then have a talk with the author of this non-sense commit about wasting corporate resources.

      Stern talk, as in "Clean out your desk." I would have zero tolerance for childish pranks like this.

    4. Re:Simple by Anonymous Coward · · Score: 4, Informative

      This happens a lot with Russian programmers due to Latin C and Cyrillic Es homoglyphs that happen to be on the same key, and it's very easy to forget which keyboard layout is currently selected and type the wrong letter.

    5. Re:Simple by KGIII · · Score: 2

      As all of our code was internal, I might have giggled a little if it was done on the dev end (not in production) and on the 1st of April. We were pretty lax during that one day of the year. It hampered productivity but, in return, we got people with honed skills and insights. So, there's that. I don't think they ever used this but they did use others. Before I turned my code over and stopped working on it myself I had an "I'm drunk" menu nested in and unfinished. Fortunately, I hired professionals. They had to re-write a huge bunch of it because, "Comments go in the code, not on a coffee soaked index card, asshole."

      I am not a good programmer. It works. It's not my major. Man, I suck. I should write a CMS in Perl as my opus and gift it to the world. I'm gonna put that on my bucket list.

      --
      "So long and thanks for all the fish."
    6. Re:Simple by Megane · · Score: 3, Interesting

      A few years ago I had a problem when I would use OS X TextEdit to edit code. Somehow, I never figured out how, it would occasionally insert a control-P character into the text. Of course it was invisible. Other than looking at the file in a hex editor, the only way that I could find it was to use the arrow keys and note when the cursor didn't move. Or the error message from trying to compile/assemble the code.

      I haven't seen this in a long time, and I currently still use 10.6.8, so maybe it was a problem in 10.5 that got fixed in 10.6.

      And I have had other times where I had to retype a visually good line of code more than once. Not to mention the times when the font and my less than perfect eyesight make commas and periods hard to tell apart.

      --
      #naabhaprzrag, #sverubfr-000, #agi-fcbafberq, negvpyr[pynff*=' negvpyr-ary-'] { qvfcynl: abar !vzcbegnag; }
    7. Re: Simple by fisted · · Score: 2

      What? No.

      Do you write your code in MS-Word or something? Do the non-ASCII spaces slip in when you cuntpaste code from web pages that are too stupid to even use <code> tags or some other means to preserve the actual characters?

      Hint: stop it. Both of it. You're not doing it right.

      spaces that were different ascii codes.

      Good grief.

    8. Re:Simple by knorthern+knight · · Score: 2

      > --
      > It's not the 1990s, Slashdot; fix your unicode support. It's ridiculous that I can't type a thorn here.

      Bwaa-haa-haa. Maybe they know better than you.

      --

      I'm not repeating myself
      I'm an X window user; I'm an ex-Windows user
    9. Re:Simple by ruir · · Score: 3, Funny

      strings sorry.

  2. Maybe before source code control by Mr.+Sketch · · Score: 4, Insightful

    Wouldn't they see your change to the file in the history/blame for the line?

    Or do they suggest you hack your co-workers machine to run this script on their system?

  3. A special hell by Anonymous Coward · · Score: 2, Funny

    is reserved for these kind of people...

  4. One thing that always drove me crazy... by BitterOak · · Score: 4, Interesting

    One thing that always drove me crazy was the Unix "make" command because of the syntax of the Makefiles. The problem was, unlike just about every other language, Makefiles distinguish between TAB and SPACE characters, and they can look indistinguishable in printouts. I always avoided make for that reason and just wrote shell scripts to compile my code. I've also stayed away from Python because of its use of indentation to indicate the scope of control structures. Too easy to screw up by mixing tabs and spaces. In many fonts used in early terminals and printers, zeros were drawn with a slash through them so they wouldn't be confused with uppercase O's. Now with Unicode replacing ASCII as the encoding for source code in most languages, let the nightmares begin!

    --
    If I can be modded down for being a troll, can I be modded up for being an orc, or a balrog?
    1. Re:One thing that always drove me crazy... by Undead+Waffle · · Score: 2

      Exactly. One of the first things I do when setting up my text editor is turn on displaying leading whitespace. And many IDEs even have an option to convert one to the other.

    2. Re:One thing that always drove me crazy... by zippthorne · · Score: 2

      vim :set list
      nano Alt-P

      (note: I sometimes use vim, I only googled nano)

      --
      Can you be Even More Awesome?!
  5. Bad compiler, then by Lorens · · Score: 3, Informative

    My students regularly copy-paste from an otherwise excellent source in which plain vertical double quotes have been auto-replaced with pretty slanted quotes. GCC complains about the illegal character on line XXX, I usually have to explain, and that's it. No hair-pulling involved, only git pulling.

  6. I code in ASCII by gweihir · · Score: 2

    Unicode in code is for people that do not understand what they are doing.

    --
    Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
  7. Nice try ... by PPH · · Score: 3, Funny

    .... but I'm sticking with Perl.

    --
    Have gnu, will travel.
    1. Re:Nice try ... by JoeyRox · · Score: 4, Insightful

      That's a good strategy because anyone working with Perl has probably already pulled all their hair out.

  8. Never undstood this crap by gurps_npc · · Score: 2, Interesting

    I understand perfectly that other languages have different symbols. But when those symbols are effectively identical to an existing symbol, JUST USE THAT SYMBOL. What idiot decided they had to make a different Unicode character for the greek questionmark, rather than simply using the semicolon? What, the dot above the comma in the greek questionmark is more squarish? Big deal

    --
    excitingthingstodo.blogspot.com
    1. Re:Never undstood this crap by Anonymous Coward · · Score: 3, Insightful

      The symbols are visually identical but have different meanings. For a human reading the text, with the human understanding of context and the weird, fuzzy logic that our brains do, that's not a problem. For a computer processing the text, however, it is important to be able to distinguish a semicolon (sentence not finished, or end of coding line, or terminator in a list containing commata) from a Greek question mark (interrogative sentence finished), especially in a text mixing Greek and Latin or English (especially ancient Greek, which rarely occurs alone in a book without either some sort of translation or at least a Latin introduction, a la the Oxford and Teubner series of texts). You could, of course, tag the shit out of the text with XML and mark the semicolons as la="grc" or la="el," but processing is easier when the character itself indicates its own semantics or differentiates itself from lookalikes.

    2. Re:Never undstood this crap by Dutch+Gun · · Score: 3, Interesting

      See: Han Unification, and all the problems it's caused. Because of this, the Japanese need to jump through hoops if they wish to write a Chinese name in an otherwise Japanese section of text. Since few other western languages have this problem, many Japanese were rather upset at this decision of the Unicode consortium.

      TL;DR: Semantics matter.

      --
      Irony: Agile development has too much intertia to be abandoned now.
    3. Re:Never undstood this crap by Alsee · · Score: 4, Funny

      Han Unification:
      Han shot at the same time.

      -

      --
      - - You can't take something off the Internet! That's like trying to take pee out of a swimming pool.
    4. Re:Never undstood this crap by Dutch+Gun · · Score: 2

      That's what they currently do. Japanese and Koreans just use a special font which renders the characters the way their language draws the glyphs. But that's ultimately a rather poor solution - essentially no better than what we used to have to do with code pages, where the text needed language metadata to render properly.

      Let's take your example of the letter "A". What would happen if both the Latin A and Greek Alpha mapped to the same code point? Would you consider those equivalent? They have similar historical roots, right (I think)? The upper cases look identical, but the lower case glyph isn't exactly the same. Now, anytime you want to combine English (or any Latin-based alphabet) with Greek within the same text document, you simply can't, because there's no indication of which language you're typing in, since the code points are shared. At least, you can't do it in a simple text file without some other metadata to switch fonts in mid-stream.

      How often does this happen? How often might a Japanese article reference someone's name in China, or vice versa? Historical documents are also a problem, because scholars might wish to differentiate based on the appearance of the character, which is much more significant in Asian logographic writing systems.

      Does that help to explain the issue a bit? It's sort of confusing, I know.

      --
      Irony: Agile development has too much intertia to be abandoned now.
  9. Re:funny. by 93+Escort+Wagon · · Score: 4, Insightful

    It's probably funny to people who don't have to earn a living. I expect I'd have considered it hilarious back in high school... but now, if a colleague did this, I'd probably demand he be fired.

    --
    #DeleteChrome
  10. Re:funny. by khellendros1984 · · Score: 2

    It's funny to me as a theoretical thing. As a practical one, it's pointless and not a workable prank. Proving that a code change compiles is part of the review process. If someone checks in broken code anyhow, it'll cause the build gate to fail, and won't be pushed to the main repository. Release engineering and QA will get upset with them, and they'll have to fix it anyhow. No one else will be inconvenienced; releng will just have to track down who caused the problem, and QA might have to wait an extra day for whichever other changes were stuck behind the build gate.

    --
    It is pitch black. You are likely to be eaten by a grue.
  11. Re:And then... by rthille · · Score: 2

    You (well, people like you) are the reason I lock my workstation every time I leave my desk.

    --
    Awesome furniture, accessories and cabinetry in Santa Rosa, CA: http://humanity-home.com/
  12. Re:funny. by 93+Escort+Wagon · · Score: 2

    I work for a university department. We don't have large development teams nor the same formal review process - a lot of times one person will handle a particular project from start to finish. One of my coworkers could, if they chose to, go onto a server and mess with a perl or python script.
    Fortunately while I have coworkers that like to joke around, no one would consider this acceptable.

    --
    #DeleteChrome
  13. Re:And then... by gstoddart · · Score: 2

    And, really, anybody who doesn't do this at their place of work is probably both violating corporate security policies, and is likely an idiot.

    If you're in an office full of people and not locking your computer and your personal items, you are simply asking for trouble.

    Not saying trust nobody but ... well, actually, yes. I am saying that a healthy level of distrust is a good idea in general.

    Sooner or later someone will reinforce that notion for you.

    --
    Lost at C:>. Found at C.
  14. Re:funny. by MisterSquid · · Score: 2

    Having worked in several university settings, I know how small and undisciplined dev teams in academia can be.

    Having moved to commercial web development, I also know how easy it is to set up a VCS for a small team.

    Once any repo is managed in a VCS (like git and GitHub), it's fairly straightforward to check a project's history and discover when and where the project stopped working as expected.

    If you're not using a VCS, you should seriously consider doing so given the small overhead of setting it up and the considerable security of deploying code so maintained.

    --
    blog
  15. Re:funny. by anonymous_echidna · · Score: 2

    I'll second this. I'll even use VCS for a team of one.

    --
    In most times, most places, by most people, liars are considered contemptible. - Ursula Le Guin
  16. Re:This is why we can't have a nice civilization by snadrus · · Score: 2

    It's important that children destroy: It teaches them that they're an influence on the world around them & they have impact.
    Then at some later point they should be taught (or just realize) the value of creating over destruction.

    This kind of thing is for people who never make it fully through that 2nd psychological development step.

    --
    Science & open-source build trust from peer review. Learn systems you can trust.
  17. Re:funny. by ShakaUVM · · Score: 2

    >It's probably funny to people who don't have to earn a living. I expect I'd have considered it hilarious back in high school... but now, if a colleague did this, I'd probably demand he be fired.

    Great. You just fired young Steve Wozniak. I heard him talk a couple weeks ago, and the man was an inveterate prankster. He also encouraged all the young kids in the audience to try to think up clever pranks to pull on people as a way of honing their mental skills.