News for hackers. Stuff that matters.
Re:Show HN: Tap curl in your editor before it gets to sh by robryk on Sunday November 13, 2016 @10:36AM (#12943802)
Why do you create an env variable that contains the whole file in question when the editor returned success? Wouldn't something like:

  cat "$f"; rm "$f"
not involve loading the whole file in memory at once? Note that using this also makes sense with self-extracting archives/shell scripts, because it lets you inspect the shell script at the beginning.
Re:Show HN: Tap curl in your editor before it gets to sh by 0xmohit on Sunday November 13, 2016 @12:24PM (#12944395)
Moreover, dumping the file into a variable doesn't seem to be a good idea if the file were to contain null characters.
Re:Show HN: Tap curl in your editor before it gets to sh by littlepootis on Sunday November 13, 2016 @12:41PM (#12944492)
Re:Show HN: Tap curl in your editor before it gets to sh by semi-extrinsic on Sunday November 13, 2016 @09:58AM (#12943567)
A much better feature is available in zsh, called safe-paste, that does this without the user having to insert "tap" or anything else manually. It relies on something called bracketed paste, where the terminal emulator sends special escape sequences to indicate the beginning and end of a paste. These are intercepted by the zsh plugin, which opens $EDITOR with the pasted content.

https://github.com/robbyrussell/oh-my-zsh/blob/master/plugin...

Re:Show HN: Tap curl in your editor before it gets to sh by JadeNB on Sunday November 13, 2016 @10:52AM (#12943882)
Bracketed paste mode can still be broken by a malicious web-site: https://thejh.net/misc/website-terminal-copy-paste . Does this solution have the same vulnerability?
Re:Show HN: Tap curl in your editor before it gets to sh by semi-extrinsic on Sunday November 13, 2016 @12:28PM (#12944415)
Depends on the terminal emulator you're using, I believe. It (and not zsh) needs to filter out escape sequences.
Re:Show HN: Tap curl in your editor before it gets to sh by tree_of_item on Sunday November 13, 2016 @11:19AM (#12944019)
How is it better? Pasting is a totally different use case from `curl | sh`.
Re:Show HN: Tap curl in your editor before it gets to sh by semi-extrinsic on Sunday November 13, 2016 @12:21PM (#12944374)
Typical use case:

* type "curl <paste>" in zsh, vim opens with "curl <pasted-url>

* inspect URL, if OK in Normal mode do !!zsh<CR> (I assume emacs can also somehow eval current line in shell and replace line with output)

* inspect the code downloaded (still in vim) and then execute it (or save to file then execute).

Re:Show HN: Tap curl in your editor before it gets to sh by sdx23 on Sunday November 13, 2016 @10:29AM (#12943770)
I don't really see, why I'd install something from some github repository if I can get it from a moreutils package that I like to have installed anyway.
Re:Show HN: Tap curl in your editor before it gets to sh by OJFord on Sunday November 13, 2016 @12:12PM (#12944320)
Then don't. `vipe` from `moreutils` is acknowledged in this project's readme.

I don't have `moreutils` installed; it's plausible that someone might want just the single package, in which case `tap` would seems OK as an alternative.

Re:Show HN: Tap curl in your editor before it gets to sh by geofft on Sunday November 13, 2016 @10:53AM (#12943886)
I think you're specifically saying that the "vipe" command does this:

http://manpages.ubuntu.com/manpages/xenial/en/man1/vipe.1.ht...

moreutils is great. Unfortunately, moreutils parallel conflicts with GNU parallel :(

Re:Show HN: Tap curl in your editor before it gets to sh by tambourine_man on Sunday November 13, 2016 @08:08AM (#12943143)
Simple, but nice