top | item 10058967

Blinking Commits

340 points| gurraman | 10 years ago |blog.annharter.com

97 comments

order

svckr|10 years ago

    git commit -F <(curl https://raw.githubusercontent.com/thiderman/doge/master/doge/static/doge.txt) # [0]

Oh god do I feel bad about this. What have I done?

[0] https://github.com/thiderman/doge

manojlds|10 years ago

    git commit --allow-empty -F <(curl https://raw.githubusercontent.com/thiderman/doge/master/doge/static/doge.txt)

0x0|10 years ago

Funny timing, with the recent "Terminal escape sequence XSS" post on oss-security in mind: http://www.openwall.com/lists/oss-security/2015/08/11/8

thephyber|10 years ago

> So the basic TL;DR: please don't use really ancient terminal programs that are vulnerable to this stuff. Disappointing that he would make this statement and then not bother to recommend specific ones to avoid and/or use.

creshal|10 years ago

Regrettably (?), you can't use this to implement marquee.

But you can make your text black with a black background. Or re-order lines, which I suspect to be "fun" for git logs.

jamie_ca|10 years ago

I think the most devious would be to simply move the cursor up one line. This would result in the 'git log' line being overwritten, and hiding the commit from casual scrutiny.

WalterGR|10 years ago

ANSI control characters include cursor positioning, so in theory you could implement marquee messages. The problem would be introducing delay. I don't recall if you can do that using ANSI. You can emulate it by doing repeated cursor repositioning, but that would be rendered so quickly that the commit message would have to be enormous to include any appreciable delay.

rurounijones|10 years ago

I actually quite like the idea of control codes in commit messages for internal teams where you can implement rules.

It could be useful for highlighting risky commits in red or other visual markers.

Would play merry hell with almost every other way of viewing commits though :D

rudolf0|10 years ago

>I actually quite like the idea of control codes in commit messages for internal teams where you can implement rules.

>It could be useful for highlighting risky commits in red or other visual markers.

Yeah... that is really not a good idea. You are not supposed to take this blog post seriously.

Why not just agree on some terminology like CRITICAL/MINOR/SECURITY, which a visual interface can then highlight?

    SECURITY: Fix XSS in spline reticulation
If it detects "SECURITY" it adds a red background, etc. Anyone viewing the raw text version of the commit messages will still get the message without having to see a bunch of gibberish.

tempodox|10 years ago

Has nothing to do with git, or committing, it just applies VT100 control codes that work anywhere in a compatible terminal.

trampi|10 years ago

"XSS has nothing to do with {my website framework}, it just applies javascript that work anywhere in a compatible browser."

Actually it has something to do with git. Git should strip or escape the user input before displaying. XSS and SQL Injections are the same kind of issue -> do not trust the user input and escape the input before interaction with it happens.

thom_nic|10 years ago

So to be clear, the article isn't suggesting that e.g. github will interpret the ANSI escape sequences, but they will be when you `git log` from a command line, right?

thom_nic|10 years ago

Anyone know if an issue has been opened (or any relevant discussion on the dev list) on stripping escape sequences? It does seem like it could be harmful.

catern|10 years ago

To insert a literal character (like the Escape entered in this post) in Emacs, use C-q.

GuiA|10 years ago

Of course, you can also use other escape codes to make your commits colored (e.g. [92m for green), underlined ([4m), etc.

caf|10 years ago

Or change the terminal title. ^[]0;title^G

Cthulhu_|10 years ago

So, 1990's Geocities commits are now a thing again? ^[[5m#UNDER CONSTRUCTION^[[0m

nichochar|10 years ago

The writing style is clever and funny. You should keep writing!

dlss|10 years ago

I think this post just changed my position on censorship :p

cousin_it|10 years ago

Will it still work if I omit the closing bracket? Or put it in a different commit message, further down the page?

eldude|10 years ago

This is a really entertaining writing style: technical enlightenment through demonstration via humorous examples. For the lazy (and additional humorous demonstration), I wish he'd provided an example gif showing it in action (i.e., Github, terminal, Sourcetree, etc...).

JoshM33k|10 years ago

(The terminal would be the only place it would display correctly it seems, but it would be nice to see the chaos it may or may not cause in Github and other tools.)

Finding someone who can write very technically while also being funny and charismatic is pretty rare (We computer types aren't always the biggest hits at parties). I also really appreciate his "last time on" opening paragraphs... it gives some context to the blog post and where's coming from in his headspace. Neat.

sbierwagen|10 years ago

The author uses female pronouns.

brillenfux|10 years ago

In the world of ANSI escape codes and terminal emulators things are never that easy.

Works for OS X apparently.

im3w1l|10 years ago

Haha, what a coincidence. Just the other day we discussed string special cases[0][1], to which I contributed ansi escapes. Unicode "fonts" 𝓵𝓲𝓴𝓮 𝖙𝖍𝖎𝖘 seem to work in commit messages as well.

I think this is quite harmful, especially the character movement ansi escapes could be used for nefarious purposes.

[0] https://news.ycombinator.com/item?id=10035008

[1] https://github.com/minimaxir/big-list-of-naughty-strings/blo...

dantillberg|10 years ago

I recently had to write some code[0] that handles strings of UTF-8 with ANSI color escapes sprinkled throughout.

A fun exercise is to write a function that overwrites string A with string B, starting at index N. It's hard enough with unicode, but ANSI escapes make it more fun.

[0]: https://github.com/tillberg/ansi-log (Go logging library with support for ANSI colors and interleaving multiple writers)

icebraining|10 years ago

I think this is quite harmful, especially the character movement ansi escapes could be used for nefarious purposes.

Like what?

Perceptes|10 years ago

This works for me in OS X's built-in Terminal app, but not iTerm. Both report xterm-256color as $TERM, so I'm not sure what about iTerm is configured differently to prevent it from working there.

thechriswalker|10 years ago

iTerm2 has an option in your Profile: Text tab > Text Rendering: "Blinking Text Allowed"

Off by default; enable and blink like its 1989.

awendt|10 years ago

same here

rmc|10 years ago

I wonder if GitHub do/will support this and parse it to HTML

MattBearman|10 years ago

If they did they'd have to wrap it a <blink> tag. Anything else would just be sacrilege

gtremper|10 years ago

Its not supported currently at least. I get

    [5mFoo[0m

SnaKeZ|10 years ago

Killer feature :D

unknown|10 years ago

[deleted]

unknown|10 years ago

[deleted]

erikb|10 years ago

Doesn't work in my gnome-terminal. Looks like the commands get escaped by git somehow. Did anybody test it?

rquirk|10 years ago

Doesn't work on Xfce either. On a virtual terminal thingy (ctrl-alt-f1) it shows a grey background with white text. I suspect blink is only implemented on the Mac's terminal, not in Linux-land.

DonHopkins|10 years ago

Who remembers when most of the blogs syndicating discussions about RSS all started blinking at once, when somebody posted an item whose title was "What happens when you put a <blink> tag into the title?"

forgotmypassw|10 years ago

First emojis, now blinking text, this has to stop.

belgianguy|10 years ago

Can you turn it off? I'd imagine a big project (e.g. Linux Kernel) could start to look like a Christmas tree...

ins0|10 years ago

ok now i need a spam filter for git log - everything is flashing like "look at my nice changes here!" :)

Cthulhu_|10 years ago

THIS COMMIT IS REALLY IMPORTANT!!11

imauld|10 years ago

You were more concerned with whether or not you could you never stopped to think whether or not you should

andrewflnr|10 years ago

Nah, they just want to watch the world burn.

cranium|10 years ago

After the emoji, the blinking... Will git commits become like the 2000s web? :p

TeMPOraL|10 years ago

Wait 'till someone figures out he/she can store a webpage inside commit message.

zamalek|10 years ago

We just need a marquee now.

DonHopkins|10 years ago

I say leapfrog directly to WebGL commit messages.

mey|10 years ago

All this talk about ASCII control codes and no one mentions 0x07 aka ␇?

tibbon|10 years ago

Surely, there is a way to do this in Sublime?

XaspR8d|10 years ago

If you can insert the ESC character, u001B, it's easy. (Though note that it appears as the two characters ^[ in the blog post, so your code should start ESC[5m with only one bracket.)

Unfortunately Sublime wasn't happy with me trying to type it through the Mac Unicode Hex input, but I was able to copy-paste it in, and I was also able to enter it directly in other programs, like GitHub desktop.