Post AuPiedCbAWGmnxPFSq by [email protected] | |
More posts by [email protected] | |
Post #AuOWx91EDkWE5RBnjU by [email protected] | |
0 likes, 1 repeats | |
I think I have finally managed to articulate this very fundamental but slightly… | |
Post #AuOWx99ji7KAVpAazg by [email protected] | |
0 likes, 1 repeats | |
@b0rk Is it a matter of 'before'?Or is it a matter of relative preceden… | |
Post #AuOizi5a05vOssDMGG by [email protected] | |
0 likes, 0 repeats | |
@nikhil I'm not sure what you mean, the shell does not have parentheses tha… | |
Post #AuOiziD1YPsbFxhIrg by [email protected] | |
0 likes, 1 repeats | |
@b0rk I understand (shell does not have parens). I was using parens not literal… | |
Post #AuOizt5z4vmh1JUKv2 by [email protected] | |
0 likes, 0 repeats | |
@nikhil kind of interesting to imagine a world where `sudo` is a shell builtin… | |
Post #AuOtaotWews8FOuVF2 by [email protected] | |
0 likes, 1 repeats | |
@b0rk the key point is that you might clobber the only copy of your precious da… | |
Post #AuPda0gDx4FWOwExtI by [email protected] | |
0 likes, 1 repeats | |
@b0rk the "of course the shell does that not the program" replies fee… | |
Post #AuPiPKlBSD3VGPHy7M by [email protected] | |
0 likes, 0 repeats | |
@b0rk does this later mention the usual trick of: sudo *sh -c 'command >… | |
Post #AuPiPKtKxtZrfh6TpI by [email protected] | |
0 likes, 0 repeats | |
@gim yep! though in the form of `echo blah | sudo tee file.txt` | |
Post #AuPiTeLEanXV9XD1sW by [email protected] | |
0 likes, 0 repeats | |
it's always kind of interesting to think about alternative ways running pro… | |
Post #AuPiTeT27nmHXirG2C by [email protected] | |
0 likes, 0 repeats | |
@b0rk it'd break anonymous piping (and thus a lot of IPC) pretty badly thou… | |
Post #AuPiTebtaqrnzD0Kqe by [email protected] | |
0 likes, 0 repeats | |
@rcombs @b0rk Inheritance of stdout (and stdin) enabled not just anonymous pipe… | |
Post #AuPiUpQkqiKXpnLy7M by [email protected] | |
0 likes, 0 repeats | |
@b0rk @nikhil if there was a shell that had some notation to replace the idiom … | |
Post #AuPiUpXqQM0ABmfdAW by [email protected] | |
0 likes, 0 repeats | |
@ShadSterling @nikhil feels similar to how parens are used to start a subshell … | |
Post #AuPiWBhfWbltCZuf8y by [email protected] | |
0 likes, 0 repeats | |
@b0rk This is also why you should always always _always_ use a temporary file w… | |
Post #AuPiWLY6v04FjpWAdM by [email protected] | |
0 likes, 0 repeats | |
@Andres4NY @b0rk oh yes, I also hit that one more than once 😅 | |
Post #AuPiWiy7qRXkNArlsO by [email protected] | |
0 likes, 0 repeats | |
@b0rk I must be missing something here. "program is responsible for openin… | |
Post #AuPiWj4VSieCgxqrp2 by [email protected] | |
0 likes, 0 repeats | |
@b0rk well, no, not just sudo, but every tool that runs the actual command.not … | |
Post #AuPicP52hcEEQYoGWm by [email protected] | |
0 likes, 0 repeats | |
@b0rk yeah, I really only understood this after taking some system level C clas… | |
Post #AuPicPBQJtKgkLnMTQ by [email protected] | |
0 likes, 0 repeats | |
@sophieschmieg I remember when I learned about the "replacing the code of … | |
Post #AuPicPI9uqij5EwjyK by [email protected] | |
0 likes, 0 repeats | |
@b0rk @sophieschmieg interesting. I think the whole dup/fork/exec thing is so l… | |
Post #AuPicPOBYRXbNvlYMi by [email protected] | |
0 likes, 0 repeats | |
@jens @b0rk oh it's fascinating and extremely clever, but the fact that fil… | |
Post #AuPicPTrDM4tfWQ5Cq by [email protected] | |
0 likes, 0 repeats | |
@sophieschmieg @b0rk I *think* the issue that makes it confusing here is actual… | |
Post #AuPicPZsqwtlyDEtbE by [email protected] | |
0 likes, 0 repeats | |
@jens @sophieschmieg @b0rk it's not just you, and it's not just pipes. … | |
Post #AuPieBfLY2d1P0doO0 by [email protected] | |
0 likes, 0 repeats | |
@nikhil @b0rk Yeah, I too think the original formulation is two true facts but … | |
Post #AuPied59cCJaQrvIrQ by [email protected] | |
0 likes, 0 repeats | |
@[email protected] this is how you know the people doing that are always two or thre… | |
Post #AuPiedCbAWGmnxPFSq by [email protected] | |
0 likes, 0 repeats | |
@tauon i don’t know if it’s totally obvious that it would be a worse way t… | |
Post #AuPiedJKlTep8qYcxk by [email protected] | |
0 likes, 0 repeats | |
@b0rk @tauon It does seem like a mistake to me too, but it could also be delibe… | |
Post #AuPigwzoXxbcm0X4Wu by [email protected] | |
0 likes, 0 repeats | |
@b0rk I was a bit surprised to see generator source > output-t && mv… | |
Post #AuPij6HSztki9GoY0e by [email protected] | |
0 likes, 0 repeats | |
@b0rk I've been thinking for *decades* that I (or we) could learn something… | |
Post #AuPiksrlqK9V7ie5rs by [email protected] | |
0 likes, 0 repeats | |
@sophieschmieg @b0rk Shenanigans like these are the reason for software to stic… | |
Post #AuPil1w07xsrFRh6DA by [email protected] | |
0 likes, 0 repeats | |
@b0rk Totally sympathize with the desire to have clear and sound shell invocati… | |
Post #AuPil23RgHq3cXB2oa by [email protected] | |
0 likes, 0 repeats | |
@b0rk Sometimes I think it would be nice to have something between linking/FFI … | |
Post #AuPioc5w8njwGY3AWG by [email protected] | |
0 likes, 0 repeats | |
@b0rk Whoa! I had no ideaI am so hype for this zine | |
Post #AuPirUeUGl8q3FaH5M by [email protected] | |
0 likes, 0 repeats | |
@Andres4NY yeah that's so important! the next page in the zine has a list o… | |
Post #AuPitXVgc8YxUjRXV2 by [email protected] | |
0 likes, 0 repeats | |
@b0rk Especially since `sudo my-script` does _not_ work if my-script is on my P… | |
Post #AuPitXc4EPfPoWQdRg by [email protected] | |
0 likes, 0 repeats | |
@OmegaPolice huh I thought that was true too but I just tried `sudo my-script` … | |
Post #AuPitsGVRltjrjVDFo by [email protected] | |
0 likes, 0 repeats | |
@b0rk @tauonI think there's a middle ground:In principle there could be a t… | |
Post #AuPitzoRO0CZH0QucS by [email protected] | |
0 likes, 0 repeats | |
@b0rk It’s been done in various “lightweight process” variants of Unix bu… | |
Post #AuPiuHkqg61Wv4tIWG by [email protected] | |
0 likes, 0 repeats | |
@b0rk @tauon It'd have very different security/file access implications, in… | |
Post #AuPj4jcluiaqFg5ztY by [email protected] | |
0 likes, 0 repeats | |
@b0rk @ShadSterling @nikhil I've never found it unintuitive (though I regul… | |
Post #AuPj4kAnsBobxE1AwK by [email protected] | |
0 likes, 0 repeats | |
@b0rk @ShadSterling @nikhil Argh, the train of thought doesn't end. Would a… | |
Post #AuPj68mhr1EYZgPexU by [email protected] | |
0 likes, 0 repeats | |
@b0rk Oh, good way to put it. I've always seen it in terms of operator prec… | |
Post #AuPj68wHHQtF3MtIsS by [email protected] | |
0 likes, 0 repeats | |
@fxnn Same here.@b0rk | |
Post #AuPjA6xsYuL85ZX3Wi by [email protected] | |
0 likes, 0 repeats | |
@b0rk the filename is known only by the shell, not by the command (and sudo). s… | |
Post #AuPjEPQRrpFGVCwczI by [email protected] | |
0 likes, 0 repeats | |
@sophieschmieg @jens @b0rk I've never thought about that being unintuitive!… | |
Post #AuPjIdk0aIZE3k6wqm by [email protected] | |
0 likes, 0 repeats | |
@b0rk @OmegaPolice A quick check of sudo(8) suggests that it uses the invoking … | |
Post #AuPjJiIL8hFGTKgIWe by [email protected] | |
0 likes, 0 repeats | |
@b0rk @tauon It would be way worse. And inconvenient.>>> unless <&l… | |
Post #AuPjLLWglNjeR5AgPg by [email protected] | |
0 likes, 0 repeats | |
@sophieschmieg @b0rk Ken Thompson did it all wrong!😌 | |
Post #AuPjLXOGeW85ERK7xA by [email protected] | |
0 likes, 0 repeats | |
@b0rk this is also why sponge is a thing (and what a great thing it is) | |
Post #AuPjQ0HRBOFpzTG5GS by [email protected] | |
0 likes, 0 repeats | |
@JeffGrigg @b0rk Unix can pass arbitrary file handles (JCL 'data descriptor… | |
Post #AuPjQHtzfICGdyQcDo by [email protected] | |
0 likes, 0 repeats | |
@b0rk that would "fix" the sudo > file.txt use case, but break:1. … | |
Post #AuPjQkWFGfQpOiXYjQ by [email protected] | |
0 likes, 0 repeats | |
@b0rk You're right, the shell opens the file first and then runs sudo, but … | |
Post #AuPjRupuOVwRgYIHNQ by [email protected] | |
0 likes, 0 repeats | |
@b0rk @tauon Seems we'd need an additional layer of permissions if I could … | |
Post #AuPjTfIL9Er840QVge by [email protected] | |
0 likes, 0 repeats | |
@b0rk Makes sense. Thanks for clarifying! | |
Post #AuPjVRT7WYq5lIJflI by [email protected] | |
0 likes, 0 repeats | |
@jimsalter @jens @sophieschmieg @b0rk Exactly! This is why you really need to d… | |
Post #AuPjXHEsWrBSc8WuOG by [email protected] | |
0 likes, 0 repeats | |
@b0rk I like what you did there. I love talking about the shell, so I hope you … | |
Post #AuPjb2UBK4ry14Tv5k by [email protected] | |
0 likes, 0 repeats | |
@b0rk @astraluma my favorite approach for this isecho blah | sudo tee file.txt | |
Post #AuPjdMISdZ3Y2Q6aoa by [email protected] | |
0 likes, 0 repeats | |
@b0rk @sophieschmieg this was one of the ways to make servers more responsive b… | |
Post #AuPjfSi9l8r0Vl7wum by [email protected] | |
0 likes, 0 repeats | |
@sophieschmieg @b0rk I think it's only 'wtf' because you know _what… | |
Post #AuPjfzzg11TbjeZuIy by [email protected] | |
0 likes, 0 repeats | |
@b0rk (I realised after posting my initial reply that you meant the exact oppos… | |
Post #AuPnNRwMHpf8iyR8CG by [email protected] | |
0 likes, 1 repeats | |
@b0rk the thing I always think about escalation to root in particular is that s… | |
Post #AuQDuy8yApRAxwym3c by [email protected] | |
0 likes, 0 repeats | |
@fluffy @b0rk @astraluma I use:echo blah | sudo dd of=file.txtOr:echo blah >… | |
Post #AuQE2EKCPXnnB5h62K by [email protected] | |
0 likes, 0 repeats | |
@b0rk @sophieschmieg @jenssudo sh -c 'foo | bar'It not applying to the … | |
Post #AuQE75JZL19AgIiLLM by [email protected] | |
0 likes, 0 repeats | |
@nikhil @b0rk no, the redirection operators can be everywhere.>>file sudo… | |
Post #AuQE8yR3sxexvQ7TlY by [email protected] | |
0 likes, 0 repeats | |
@mirabilos Nobody is saying it's bad, but it is surprising in the beginning… | |
Post #AuQEMePH9I67rRo1iK by [email protected] | |
0 likes, 0 repeats | |
@b0rk @sophieschmieg yes, but it’s composability that is lacking in OSes that… | |
Post #AuQb25ZlEmlWzNsICm by [email protected] | |
0 likes, 0 repeats | |
@simontatham @b0rk @Diziet not to discard the rest but ping is not setuid for y… | |
Post #AuQb25hukTHtOfgnui by [email protected] | |
0 likes, 0 repeats | |
@zygoon @b0rk @Diziet correction noted, but it _still_ doesn't feel confide… | |
Post #AuQb25pMInF5llAkW8 by [email protected] | |
0 likes, 0 repeats | |
@simontatham @b0rk @Diziet is your ping AT_SECURE? | |
Post #AuQb25wRsQui7kUPZI by [email protected] | |
0 likes, 0 repeats | |
@zygoon @b0rk @Diziet I assume so, since `getcap` shows that /usr/bin/ping has … | |
Post #AuQb263XS4aKTjo4cS by [email protected] | |
0 likes, 0 repeats | |
@zygoon @b0rk @Diziet … ah, and it's possible to check directly by attach… | |
Post #AuQb4HhF8zYl9yQBkW by [email protected] | |
0 likes, 0 repeats | |
@simontatham @b0rk Made me think of https://mastodon.social/@pid_eins/112353324… | |
Post #AuQb58vbELXEFqXtz6 by [email protected] | |
0 likes, 0 repeats | |
@simontatham @b0rk @Diziet exactly like "hey setuid pgm, read /tmp/hostali… | |
Post #AuQb632ya6i4IwQaG0 by [email protected] | |
0 likes, 0 repeats | |
@simontatham OpenBSD went a different way almost 30 years ago and changed their… | |
Post #AuQb6azGOPwTZGx6Bs by [email protected] | |
0 likes, 0 repeats | |
@galaxis @b0rk in the case where the same program drops privilege, does it then… | |
Post #AuQb6dxxJjg8o5Mb4K by [email protected] | |
0 likes, 0 repeats | |
@simontatham @zygoon @b0rk Re your parenthetical comment about gdb'ing a sh… | |
Post #AuQb7mIxnc4kxVjMX2 by [email protected] | |
0 likes, 0 repeats | |
@b0rk after reading through the thread we're clearly talking more around su… | |
Post #AuQb7mPLPtBDHIiSTg by [email protected] | |
0 likes, 0 repeats | |
@mherbert yeah I've never managed to make it feel intuitive, I've just … | |
Post #AuQb8CGNHrSBT0if6e by [email protected] | |
0 likes, 0 repeats | |
@b0rk ... which is why when I found the '&>' form (literally yes… | |
Post #AuQb8CNSrV7np02K9o by [email protected] | |
0 likes, 0 repeats | |
@mherbert @b0rk : Today I learned of `&> `, thank you! | |
Post #AuQb8CUuPp50C5WGlE by [email protected] | |
0 likes, 0 repeats | |
@mherbert @b0rk @pjf stay away from it, evil bashism that does something differ… | |
Post #AuQb8Caw3PtsUmL59c by [email protected] | |
0 likes, 0 repeats | |
@mirabilos @b0rk @pjf ok, so in POSIX mode, & becomes a command separator .… | |
Post #AuQb8Cgxh0iknT9tY0 by [email protected] | |
0 likes, 0 repeats | |
@mherbert @b0rk @pjf always has beenfor x in *.txt; do xz -e "$x" &am… | |
Post #AuQb8CmdLvG353oQO8 by [email protected] | |
0 likes, 0 repeats | |
@mirabilos @b0rk @pjf interesting - I've used while sleep 10 & do foo ;… | |
Post #AuQb8F0B6XHRxeAGmG by [email protected] | |
0 likes, 0 repeats | |
@pjf @mherbert @b0rk I can tell ;) though it had not come to me to do it like t… | |
Post #AuQb8NzRgd2fpytJNw by [email protected] | |
0 likes, 0 repeats | |
@pjf @b0rk heh ... I should have guessed something like that would be there - I… | |
Post #AuQb8O5pIu989lsPKa by [email protected] | |
0 likes, 0 repeats | |
@mherbert @pjf @b0rk note that |& is the Korn shell syntax for coprocesses,… | |
Post #AuQb8oIprA07ReAADY by [email protected] | |
0 likes, 0 repeats | |
@mirabilos @pjf @b0rk noted, thanks ... I have only limited ksh experience | |
Post #AuQb9BTbhHHdJiNahU by [email protected] | |
0 likes, 0 repeats | |
@pjf @mherbert @b0rk I develop mksh so I have some interest and investment 😸… | |
Post #AuQb9KWQ4BsfN2lSpk by [email protected] | |
0 likes, 0 repeats | |
@b0rk @dexter I always understood this as the shell handling the redirection, n… | |
Post #AuQb9KfzUbXLqjF6ki by [email protected] | |
0 likes, 0 repeats | |
@b0rk @dexter looking at some of the other replies, I guess this does take for … | |
Post #AuQb9KmN6sdoAWEChM by [email protected] | |
0 likes, 0 repeats | |
@endrift hmm do you think it would be possible for the shell to open the file *… | |
Post #AuQb9PxtpRpiFieyrQ by [email protected] | |
0 likes, 0 repeats | |
@b0rk Not without some absolute black magic (e.g. splice(2)), or inefficiency f… | |
Post #AuQb9rr88D3UkphyCG by [email protected] | |
0 likes, 0 repeats | |
@b0rk @endrift only if there’s a way to capture the use of the file handle an… | |
Post #AuQbA302hPijJexk7E by [email protected] | |
0 likes, 0 repeats | |
@ShadSterling @b0rk @endrift Definitely possible, open an anonymous pipe for th… | |
Post #AuR2Zp7fc6L4ZL2uFU by [email protected] | |
0 likes, 0 repeats | |
@b0rk I mean, this is accurate, but I'm not sure I'd say it's "… | |
Post #AuR2ZpEPD3j6uECHkO by [email protected] | |
0 likes, 0 repeats | |
@jimsalter @b0rk The behavior of the redirect has nothing at all to do with the… | |
Post #AuR2ZpJitHypAigX2G by [email protected] | |
0 likes, 0 repeats | |
@deftpunk @b0rk the real answer to the eternal prescriptivist vs descriptivist … | |
Post #AuZHCyRrpMiXPPjcTQ by [email protected] | |
0 likes, 0 repeats | |
@b0rk Also, this is why grep foobar file.txt > file.txt does not produce wha… | |
Post #AuZHCyZJNgfjmVDZ4q by [email protected] | |
0 likes, 0 repeats | |
@bortzmeyer @b0rk or cat something something-else > something | |
Post #AuZHCyypqn5Z3f9wrQ by [email protected] | |
0 likes, 0 repeats | |
@b0rk And this is specially troublesome for programmers because they are used t… | |
Post #AujNLL6vzmqjJjungW by [email protected] | |
0 likes, 0 repeats | |
@b0rk I have no clue about shells, but I would read it as "redirect the ou… |