« first day (3162 days earlier)      last day (1791 days later) » 
00:00 - 18:0018:00 - 00:00

12:30 AM
I'm been messing around with Lua, trying to get it to execute external (is that the right term?) commands.
It seems that Lua mostly just called some C function (presumably a system call?). It does do some other stuff, but it doesn't seem significant.
But there seem to be several functions that do the same thing. Or very similar things.
This answer covers some of the options.
33
A: what is the difference between popen() and system() in C

Kerrek SBpopen() gives you control over the process's input or output file streams. system() doesn't. If you don't need to access the process's I/O, you can use system() for simplicity. system() is in C89 and C99; popen() is Posix only (though the Windows API also has one). Both functions invoke some fo...

I was using popen but I'm now considering using the exec family, which is apparently part of POSIX. Which presumably would reduce portability, but that isn't ;a concern for me.
> since exec() replaces the current process
Is that the same thing as a fork?
The problem I'm currently facing is that popen, when run in Lua, does not terminate when there is an error, so apparently I need to get hold of the std error and pass it to Lua. It would be nice if this worked out of the box, though.
So Lua has os.execute, equivalent to C's system. Then, there is io.popen, which corresponds to popen. And there is posix.exec and posix.execp, which correspond to the exec family. Though right now I'm not sure how.
 
12:48 AM
I just got punished so hard for not thinking about what I was doing, I mucked up the config file for the apache2 http server I had running while learning how to password protect it etc, and so I decide to purge apache2 completely for some reason before looking for a default .conf online, then after I saw that a heap of folders for apache still remained using locate, I tried to remove them all in one hit mucking around with regular expressions and literally wiped everything in the home directory
on the machine I was running the apache2 server from
lol just kept entering ls over and over without getting output for a while until I realised how bad the fail was
 
 
2 hours later…
Tim
2:46 AM
@StephenKitt must the three components of MVC be run in the same process, and thus deployed on the same tier?
 
 
4 hours later…
7:07 AM
hmmm k so I didn't get a response to the programming language focus weighting question C has increased its value empirically based on today's reading, which yes has only been a total of say 15 minutes, and I cant stress this enough it really isn't a nice process for me, having to systematically learn stuff so this is an important one for me I mean if I just pick a language at random it will end up being the maple of the unix world knowing my luck so well I really think considering how easy
it would be to answer for some
it would be a crime against adams to not respond
 
@FaheemMitha popen() is also a POSIX function. Are you implying that using POSIX functions would reduce portability?
Oh, you're looking at some other language's library's functions, not the C library.
 
7:34 AM
@Tim MVC is an architecture pattern, not really a way of splitting up components in an implementation. I find it useful as a metric when designing a system, to avoid architectural mistakes.
For example, “is this view specific?” when thinking of individual pieces of data, to decide whether they should be in the view or the model (think of timezone adjustments, or the general task of formatting values), or “is this purely UX, or does it implement part of a business rule?” to decide whether a piece of logic should be in the model or in the controller.
So you end up with pieces of MVC everywhere really...
My point was that it’s counter-productive to try to isolate M/V/C in tiered architecture diagrams.
 
7:47 AM
it's C. That is definitely the most important programming language to unix systems right?>
 
@Adam ha ha yes, it is...
 
ok good im evolving
:-P
 
However to address your weighting question (which is really hard to answer), I don’t recommend learning languages for the sake of learning languages. You should pick an ecosystem you want to study, and learn whatever language is appropriate for that.
Another reason to choose a programming language to study is when it forces you to learn a new programming paradigm, e.g. a pattern-matching functional language such as Haskell. However you’ll only really benefit from that if you work on a project using it.
Once you’ve learned programming paradigms, picking up languages isn’t too difficult. What’s hard is learning all the libraries and what the communities consider to be best practices.
@JeffSchaller nice, I’ll start a new style of computing, sheep computing, with a BaaS offering.
 
8:12 AM
ok so if I were to ask you to propose an ecosystem that centres on all things mathematical, primarily analytic number theory, I guess a specification there would be the most relevant to the handling of integer variables. I still feel like i am painting a very broad picture here lol
 
@Adam if you want to stick to “general-purpose” languages, Python with SciPy. R is worth learning too IMO.
 
that moment when I'm looking for an answer to a question and I happen to know the answer as I already provide it to someone else :D
0
A: Open multiple instances of a given application

KiwyOn Gnome Shell, you can simply open a second instance of the application by opening it with: Ctrl+↵ Some application might not support this as they can only work with one instance

 
@StephenKitt yeah but like I originally said, I had already isolated python, C, C++ and perl for the short list, I have already had in previous times developed an average experience in C from the days I was mucking around with Arduino and the processing.org ide, so I assumed I was being bias, and started to feel as if python could hold equal weighting, placing the other two in 3rd and 4th place
but R I literally do not even know what stands for lol
having said that I don't know what C stands for either but like I said cognitive bias having already mucked around with it a few years ago to a pretty ocd extent
 
R is a programming language and free software environment for statistical computing and graphics supported by the R Foundation for Statistical Computing. The R language is widely used among statisticians and data miners for developing statistical software and data analysis. Polls, data mining surveys, and studies of scholarly literature databases show substantial increases in popularity in recent years.. as of May 2019, R ranks 21st in the TIOBE index, a measure of popularity of programming languages.A GNU package, source code for the R software environment is written primarily in C, Fortran and...
 
@Kusalananda Well, possibly. Not everything supports POSIX, does it?
@Kusalananda It's a Lua library. But it's just calling C functions.
 
If you're doing analytic number theory then surely Matlab and Mathematica are the obvious if not only choices
 
@MichaelHomer There are a bunch of free math programs that might work. But I don't even know what kind of calculations that would involve.
@StephenKitt Also, language idioms. Which is related to best practices, perhaps.
 
8:56 AM
@FaheemMitha yes, definitely, and in my mind they are related to best practices. It’s worth spelling out ;-)
 
@FaheemMitha Hmm... "This function is standard, but since not all systems implements the standard I will use another function"? That sounds weird to me.
 
@Kusalananda I thought POSIX was a UNIX standard.
Isn't system more generally available, for example?
 
@FaheemMitha It's the other way around. A system implementing POSIX is a Unix system.
@FaheemMitha But if it's not on a POSIX system, how would you know that the semantics of system() is the same as what you expect?
 
@FaheemMitha system is part of the C standard, popen isn’t.
@Kusalananda Windows implements POSIX ;-)
 
@Kusalananda Isn't system standardized?
 
9:10 AM
It is not really clear to me how moving from popen, a POSIX function, to exec, a POSIX function, is meant to impact portability one way or the other anyway
 
@MichaelHomer Forget I said anything. :-)
 
@StephenKitt It does. And some would argue that it (a subsystem thereof) therefore is a Unix.
 
system is specified to call the system's command processor... but it doesn't specify what that command processor is
 
@Kusalananda indeed!
 
And since there is apparently currently no shortage of commentators, would you folks care to comment on whether one should use popen or exec?
 
9:11 AM
@StephenKitt But both are POSIX.
 
@MichaelHomer yes, the function isn’t necessarily usable in a more portable manner than exec & co.
@Kusalananda yes, since POSIX includes the C standard. But the C standard is implemented in more environments than POSIX.
 
@FaheemMitha Do you want a pipe? That seems like the most operative aspect of the whole thing
 
So, I was trying to figure out (on too little sleep), how to get Lua to exit when an error happens inside a popen (or exec) call.
@MichaelHomer Um. Don't know.
See above.
 
@StephenKitt In @FaheemMitha's case, since he's using Lua, it's not really a matter of what POSIX or C does, but what Lua implements.
 
I'm calling sqlite. If sqlite throws an error, I want Lua to exit with an error.
Something like:
 
9:13 AM
U&L mods should get a pipe in the swag, not a hat. I never wear hats.
 
@Kusalananda I agree in theory; in practice Lua doesn’t specify much more than the implementations it uses :-(
 
some_system_call("sqlite3 foo.db 'select * from footable;'")
Or Lua specific:
 
popen: "This function is system dependent and is not available on all platforms. "
 
some_system_call([[sqlite3 foo.db 'select * from footable;']])
 
It really sounds like you want Lua bindings to sqlite
 
9:15 AM
@FaheemMitha Why don't you use something like lua.sqlite.org/index.cgi/doc/tip/doc/lsqlite3.wiki
 
@Kusalananda Actually, I am. But .export isn't made available as part of SQLite's API, for some reason.
So I can't use LuaSQL with it.
 
But, os.execute appears to return the status code, so I guess that's your option
 
@MichaelHomer Not sure how that would work. Excuse my ignorance.
Probably I should try to get more sleep.
@Kusalananda Sorry, I should have written .import. Not .export.
 
@FaheemMitha Well, if it's zero, it presumably succeeded
And if it hasn't returned yet, it's still running
That seems to cover all of it?
 
@MichaelHomer I think I wasn't using os.execute for some reason. But I cannot now remember what it was.
 
9:20 AM
Still non-portable, of course
 
@MichaelHomer What? system?
 
All of them
 
ok well maple has at least average translation packages for the purpose of all of them so there really isn't an excuse there
 
@MichaelHomer Obviously, I don't just want an error, I need the error text too.
 
9:26 AM
14 mins ago, by Michael Homer
@FaheemMitha Do you want a pipe? That seems like the most operative aspect of the whole thing
And so we have an answer!
 
I am going through all the Linux man pages again, has anyone got a script for looping through a http directory and creating a "favorites" listing that is a folder schematic based on the links encountered in each page of a library of manuals. if you do, and you don't let me see it, jesus knows and is crying in heaven or whatever
 
system("sqlite 2>error"); io.open("error") ...
 
@MichaelHomer I think you mean os.execute.
@MichaelHomer That saves to a file, right?
 
sure ignore my plea, reserve YOUR ETERNAL DAMNATION
 
@FaheemMitha Yes
Adam, maybe you'd find one of the other rooms, where your questions are on-topic, would give you better answers to them
 
9:31 AM
@MichaelHomer That doesn't send to standard error, though.
I guess I could pass it to standard error.
 
@FaheemMitha I have no idea what you want, but what you need is a better plan than this
Calling out to the sqlite binary just can't be the only way to achieve it
 
@MichaelHomer If I want to use .import, my options are rather limited.
As I already mentioned .import isn't made available via the SQLite API.
 
@MichaelHomer I accept that polite means of suggesting I should try using a search engine first rather than the guilty pleasure of annoying people in real time
 
Though I admit I haven't asked for options publicly.
I think I did ask on #sqlite, though. I complained about having to call sqlite3 directly, and was informed that .import isn't made available in the API.
 
Load the CSV from Lua and add the rows with the API?
 
9:35 AM
Probably the best place to ask would be the SQLite mailing list, though. Richard Hipp reads and answers there, for example.
 
@Adam I really meant one of the other rooms
 
@MichaelHomer I don't understand what you are suggesting.
@MichaelHomer Most rooms aren't that active. And some of them are not very friendly. It's a jungle out there.
 
@FaheemMitha Ok, well. If you're going to post on the mailing list, I suggest you explain what you're actually trying to do
 
@MichaelHomer That sounds like a good plan.
 
@MichaelHomer the one time in my life I don't take something in the literal sense I fail. i guess i should feel sad
look lets just leave it at i am guilty of basically assuming this room to be free subject specific advice to fine level of precision and didn't even do an internet search fine i confess my sins jesus god of systematic learning processes
 
9:57 AM
@MichaelHomer how about scilab if you have no money
 
10:17 AM
or Octave
 
 
1 hour later…
Tim
11:26 AM
Thanks.
(1) Between MVC and tiers:
"MVC is an architecture pattern, not really a way of splitting up components in an implementation", and "it’s counter-productive to try to isolate M/V/C in tiered architecture diagrams."
Is it correct that MVC is a software pattern, and n-tier is deployment pattern, and they are "orthogonal" to each other? By "orthogonal", does it mean that MVC components of a program can be in the same tier or in different tiers, or that the MVC components of a program must be in the same tier?
 
11:46 AM
@Tim (1) MVC is an architecture pattern. It can be applied to more than software. n-tier is indeed a deployment pattern, but it affects software design as well since the various tiers have to be able to communicate. Forget “MVC components”, that’s an idea that’s not very useful and ends up being confusing.
(2) If you’re following the MVC pattern, you use it throughout your design. When you’re writing a web service, the “users” which view views and interact with controllers are the clients of the web service.
 
Tim
Thanks.

You are right that "Forget MVC components, that’s an idea that’s not very useful and ends up being confusing", but can MVC components of a program be in different tiers, or must the MVC components of a program be in the same tier?

Can MVC be used in the presentation logic, as well as in the application (business) logic and data logic?
 
@Tim It's been a while since I've studied that.
 
@Tim it’s not useful to think of “MVC components of a program”. Full stop. And yes, MVC can be used in the presentation logic.
 
but MVC is a design pattern
but it's a way to think your application as different component and way they interract it could be logical view or real seperation it's up to you
 
Tim
Thanks. "it’s not useful to think of “MVC components of a program”, do you mean it is not possible to separate a MVC program into components so that different components can run on different tiers?
"MVC can be used in the presentation logic", and can MVC be used in the application (business) logic and data logic?
@Kiwy hello, kiwy, what are you studying lately?
 
11:57 AM
I realise everything needs some kind of idiom so that you developers are able to keep tabs on wtf is what, but at what point was users in a group, in a shadow not a terrifying level of phrasing
 
@Tim I mean it’s not useful to think of “MVC components of a program”. Any time you try to phrase a question in terms of “MVC components of a program”, unless it’s for design purposes, you should rethink your question. In particular, MVC isn’t a way of separating programs into components for deployment purposes.
MVC is an architecture pattern, you either use it or you don’t; it doesn’t make sense to limit it to portions of a design.
 
i mean just add some kind of method and short hand it to meth there, and i would have probably urinated in my pants reading particular man pages in shear fear of the mental image it creates
 
@Adam “users in a shadow”?
 
which is obviously an idiom because no one including me has every been so drunk they potentially lose control of bodily function
meh not important so ill add image for context
 
12:02 PM
 
I, for one, am relieved at the image that showed up
 
thanks for the duck and go there i had a quantum of dignity left before that
 
Tim
@StephenKitt Sorry for being fixated. I agree that "MVC isn’t a way of separating programs into components for deployment purposes". What I was wondering is whether the M, V and C of a program are separatable so that they can run on different tiers. I guess no, but I am not sure.
 
@Adam you’re the one who said “no one including me has every (sic) been so drunk they potentially lose control of bodily function”
@JeffSchaller you’re not alone!
 
unintentional pun on "relieved", sorry for that
 
12:04 PM
@Adam no one talks about “users in a shadow” etc. /etc/shadow is a shadow of /etc/passwd, /etc/gshadow is a shadow of /etc/group.
@JeffSchaller man you’re on fire these days
@Tim you’re not understanding what I’m saying. Stop trying to split programs up according to MVC.
 
I... ok thanks Stephen for also adding the realisation that I was totally alone in space time in that moment of phrasing fail observation
I... ok thanks Stephen for also adding the realisation that I was totally alone in space time in that moment of phrasing fail observation
south park time travel ep is on fox lol these guys just never lose their
a game
 
12:27 PM
I didn't see Richard get a last name there lol what was the legal budget for that season
 
@tim working a lot on Scala
such an elegant way of coding
cryptic to the beginner yet elegant
 
 
1 hour later…
Tim
1:34 PM
@Kiwy do you use Scala with Spark, or Akka, or something else?
if you are not using MVC, what are you using instead?
 
1:55 PM
@Tim I learn MVC and tend to stick to it in most of my dev if significantly big. For small devs I tend to do some quick and efficient code.
I use scala with spark indeed.
 
2:18 PM
!
I picture Jeff getting hyped up in his office, ripping his shirt off and yelling: "THIS IS WHAT WE TRAINED FOR!"
 
that comment (☞゚∀゚)☞ @Jesse_b
 
Damn someone beat him to it
 
Some more contenders to the best golden ed badge
 
2:51 PM
D:
 
3:10 PM
@Jesse_b Wow. An actual ed question.
I'll be expecting unicorns at the bottom of my garden any minute now.
 
@FaheemMitha Yeah I got excited for Jeff when I saw it but I guess it was bad timing
 
@Jesse_b Why was it bad timing?
 
@FaheemMitha Jeff was away from his computer so he couldn't answer
 
@Jesse_b Oh, I see.
 
@Jesse_b Happy to see an ed question! I'll take "seeing my son at his school event" over a few ed points. There'll be more opportunities to ed in the future, but not for the kids...
 
3:25 PM
@JeffSchaller Please tell me you haven't named your son Edward, at least.
I can see you now: "This is my son, Ed, and his little brother Sed."
5
They can all hang out with Stephen's daughter, Ruth!
(pronounced root in French, which would make her Root Kitt. )
2
 
Thanks @terdon nice pun
 
hah
@JeffSchaller Can't blame you
 
@Kiwy I actually have a friend (Catalan) who named his daughter Ruth for pretty much that reason. They pronounce it the same as root in Catalan too.
 
@terdon Oh ! that's actually kind of the most amazing name story I heard of...
 
I wonder if @JeffSchaller's last name is pronounced "scalar"...that's how I say it in my head anyway
 
3:38 PM
A fun one but I hope her daughter never learn the origin story of her name
 
I'm sure he has some grandmother named Ruth that he can use as an excuse. But we asked him if he named her after / and he admitted it :)
 
@terdon we call them "Pico" when they're being naughty
 
lol
 
4:01 PM
@terdon my mum had a cousin named Ruth, and I think one of my great-great-grandmothers was named Ruth
 
Ah-ha! Excuse primed and ready to go!
and sorry, I know I keep making this joke but it cracks me up every time
 
but the French ‘u’ isn’t quite the same as the ‘oo’ in “root”
I haven’t thought up any silly jokes around “terdon”, I need to get cracking
I have however discovered that one can ignore users in chat
 
@StephenKitt No, but the French pronunciation of root is the same as their pronunciation of Ruth isn't it?
 
@terdon the people I know who say “root” in French pronounce it like a short « route »
 
Ah no, it's slightly different, you're right. Even I would say it differently and I'm far from a native speaker.
sniff
 
4:10 PM
native? is it inappropriately appropriate to assume the native Indian American flag is just a rectangular sheet of transparent plastic? But I guess its only fair this comment is removed much like they tried with the history, and ban me for another hour. Don't matter I'm listing to Obama's speech in Robocop, got all the inspiration I need to know I'm on the electronic safety bracelet list
 
"native Indian American"?
White people landing in America:
"Hey you guys are Indians right?"
"No we aren't"
"Huh? But this is India right?
"No it's a totally different place"
"ahhh....you're Indians!"
 
@Adam um. Oookay.
No idea what you're on about there.
 
4:31 PM
Ok, I don't want to jinx us here, but I'm going to step away from my computer again. Keep an eye out for ed questions :)
@Jesse_b last name is pronounced "array" because there's more than one of me ;)
 
Could someone explain to me what is going on in this answer? It's about Lua code, but mostly doesn't appear to be Lua-specific.
2
A: How do you construct a read-write pipe with lua?

KyleI stumbled on this post while trying to do the same thing and never found a good solution, see the code below for how I solved my issues. This implementation allows users to access stdin, stdout, stderr and get the return status code. A simple wrapper is called for simple pipe calls. require("...

Specifically, why the attempt to fork, and then fall back on exec?
 
@JeffSchaller you could write a suggestion on Meta.SE that moderators get first dibs on questions in their favourite tags
 
maintainers?
 
And what is the significance of the pid being 0?
 
Sorry, @FaheemMitha, that's way over my head.
 
4:33 PM
with a delay queue, i.e. questions go in the queue and mods have to say they’re not interested before the hoi polloi see them
@terdon sorry, mods
 
As you can see, there isn't much context here.
 
@FaheemMitha Ah, that I know. If the PID is 0, you're in the fork.
 
@terdon Oh. Is that a Unix-specific thing?
 
@FaheemMitha it’s not the PID really, it’s the return value of fork
it’s fork-specific
 
@FaheemMitha Um. Maybe? I really don't know. All I know is that when I fork in Perl, I check the return value (not the PID, that's just the variable's name) and if it's 0, I know I'm in the fork.
 
4:35 PM
@terdon and non-0 is the knife
 
@StephenKitt Ah, ok. Then calling it the PID is not helpful. So it returns 0 to the child process if the fork is successful?
 
@FaheemMitha man fork
 
@JeffSchaller =)
 
Is this a Unix thing, then?
Or POSIX, if you prefer?
 
@StephenKitt budum-tiss! :P
 
4:37 PM
As I understand it, fork inherits stuff from the parent. exec does not. Is that the major difference?
 
@FaheemMitha I know you don’t like reading docs much, but seriously, man fork answers all your questions here
@FaheemMitha they’re completely different
 
@FaheemMitha well, it is actually a pid in some contexts.
 
@StephenKitt Again, I do so read docs.
 
The parent process gets a pid, the child gets 0.
> Does a fork(2) system call to create a new process running the same program at the same point. It returns the child pid to the parent process, 0 to the child process, or undef if the fork is unsuccessful.
 
But yes, it's not my favorite activity.
Especially when I can't understand what I'm reading.
Which, unfortunately, is not uncommon.
> * The child's parent process ID is the same as the parent's process ID.
I don't understand what this means. It seems like a tautology to me.
What the difference between the thing on the left and the thing on the right?
 
4:40 PM
@FaheemMitha it’s significant because a process can retrieve its parent’s process id, but it can’t retrieve a specific child’s process id
 
@FaheemMitha PPID
 
so fork returns the child PID to the parent, because otherwise the parent couldn’t figure it out; it returns 0 to the child, to signify that it’s the child, and it’s not a problem for the child not to be told its parent’s PID at this point because it can call getppid.
 
the kernel (please correct me Stephen) keeps track of processes' PID and parent PID (PPID). So the forked process will have its parent PID set to the parent process' PID.
Here, try running this:
perl -le '$pid=fork();
if($pid == 0 ){
   print "Child, PID: $$";
   exit;
}
else{
    print "Parent, PID:$$ and child PID is $pid"
}'
Parent, PID:13409 and child PID is 13410
Child, PID: 13410
 
@StephenKitt To be clear, you are saying that process P can retrieve Parent(P)'s process id, but cannot retrieve SomeChild(P)'s process id?
 
@FaheemMitha yes, which is why fork has to return the child PID to the parent
 
4:44 PM
@StephenKitt Ok, but I still don't see how that relates to:
> * The child's parent process ID is the same as the parent's process ID.
I mean, isn't that obviously true?
I see at the bottom:
> RETURN VALUE
On success, the PID of the child process is returned in the parent, and 0 is returned in the child.
Which is what you were talking about.
 
@FaheemMitha right, and look for “CONFORMING TO” for your other question
@FaheemMitha yes, it’s obviously true, but stating it explicitly gives some explanation for the API
 
@StephenKitt If it's POSIX, does that mean it does not apply to other OS's? I guess there is no reason they can't implement it.
 
Note the context of the statement too: it’s listing the differences between the child and the parent.
 
@StephenKitt Well, Ok. I just don't see how it could be anything else.
 
@FaheemMitha no, it only means that a POSIX-compliant system must implement it.
 
4:48 PM
@StephenKitt Fair enough.
 
@FaheemMitha well of course, but since the docs are listing the differences, and that’s a difference, it’s mentioned in the list.
The parent’s parent’s process ID and the child’s parent’s process ID are different, so they’re listed in the list of differences between the parent and child.
 
@StephenKitt Ah, ok. I see your point. Sorry, I missed that.
Right, it's listing how the two processes differ from being exact duplicates. Reading fail.
 
@StephenKitt Why obviously true? When forking you could conceivably set the new process's PPID to whatever you want, right?
 
Is there any discussion anywhere of the use case of fork vs exec? Is is just that you use fork if you want a relationship between parent and child?
 
@terdon technically yes, but then you wouldn’t have a parent-child relationship and all sorts of things around signals etc. would break
@FaheemMitha again, fork and exec do completely different things
fork creates a new process, exec replaces the current process image with a new image
 
4:51 PM
@StephenKitt Yes, ok. But why would you chose one over the other? They're not completely different. They both create new processes.
 
@StephenKitt Sure, but I can imagine a situation where you would want your forked process to be a child of PID==1, for instance, completely separate and independent from its actual parent.
 
@FaheemMitha no, they don’t. fork creates a new process, exec replaces the current process.
@terdon yup, and systemd does that quite a bit
 
@StephenKitt Does the current process die, then, in the case of exec?
 
@FaheemMitha no, it is replaced
 
4:53 PM
think of it as similar to somebody replacing your mind with another one
your body continues as is
 
Ha! As opposed to cloning you?
 
@terdon exactly, fork is cloning
 
So basically it's like a possession. The process gets taken over, so to speak. Though it technically continues to exist. And with the same process number? Hmm.
 
@FaheemMitha yup, the same process number
there’s a bunch of stuff that changes to prevent the replacement executable from seeing any data from the original
 
Sounds abusable.
 
4:55 PM
@FaheemMitha yes, hence recent work in the kernel around pidfd
> The fundamental problem being addressed by the pidfd concept is process-ID reuse. Most Linux systems have the maximum PID set to 32768; if lots of processes (and threads) are created, it doesn't take a long time to use all of the available PIDs, at which point the kernel will cycle back to the beginning and start reusing the ones that have since become free.
> That reuse can happen quickly, and processes that work with PIDs might not notice immediately that a PID they hold referred to a process that has exited. In such conditions, a stale PID could be used to send a signal to the wrong process. As Jann Horn pointed out, real vulnerabilities have resulted from this problem.
 
If I'm calling posix.exec inside a Lua script, I suppose Lua is the parent in this case. But the exec's process doesn't appear to kill the Lua process. At least, not immediately. See, for example:
local posix = require "posix"
local ret, err = posix.exec ("lsx")
print(string.format("Return value is %s", ret))
print(string.format("Error string is: %s", err))

function foo(a)
   return a
end

print(assert(string.format("Value of foo is %s", foo(2))))
For anyone who cares, one can run this, as usual, with lua5.2 whatever.lua.
As you can check foo still gets called here.
 
@FaheemMitha posix.exec might not behave strictly like exec
 
@StephenKitt Oh.
 
5:10 PM
@FaheemMitha did you really mean lsx?
Looking at posix.exec, it does behave like exec, but your foo is called because posix.exec fails
 
@StephenKitt Yes, something random to produce an error.
@StephenKitt Oh, right. Sorry, clearly I'm brain damaged. Sigh.
 
@FaheemMitha probably too tired, given some of your earlier statements to that effect ;-)
 
@StephenKitt Possibly.
 
If you write "/bin/ls" it works as expected.
 
@StephenKitt I see it doesn't accept ls. I take it because the shell isn't there to offer a search path.
But doesn't like /bin/ls -la for some reason. No doubt I'm again missing something obvious.
 
5:14 PM
@FaheemMitha yes; use execp
 
@StephenKitt Right.
 
Read the docs, arguments are specified separately
 
@StephenKitt Ah, yes.
 
exec ("/bin/bash", {[0] = "-sh", "--norc"})
so exec ("/bin/ls", { "-al" })
 
@StephenKitt Ok. Multiple arguments specified as separate array elements.
Got it. I did read that earlier, but was focusing on something else.
Trying to fight the temptation to read too narrowly.
I was just reading a discussion that mentioned it as a major hindrance to problem solving.
Unlike fork is seems exec isn't particularly associated with Unix.
 
5:21 PM
@FaheemMitha the exec family of functions are defined in POSIX
 
@StephenKitt I realise that.
A commentator on #lua:
> this is in general how spawning new processes works on unix-like OSes, by the way. if you want lua to hang around as a parent of the new process, then you use fork() first and then call exec() from the child
I didn't know that was how it worked.
 
@terdon: Thanks for the edit. IMO it's probably best just to not engage in that comment thread lol
 
But I guess you'd have to do it like that.
Though I'm not sure why he said "unix-like OSes". Does Windows do something different?
I mean, you'd have to do it like that, if those were your only options for creating new processes.
Though it's not immediately obvious to me why there isn't a monolithic mechanism for just creating a new separate process, and leaving the old one running.
 
@FaheemMitha yes, it does, see
43
Q: Why is the default process creation mechanism fork?

Ellen SpertusThe UNIX system call for process creation, fork(), creates a child process by copying the parent process. My understanding is that this is almost always followed by a call to exec() to replace the child process' memory space (including text segment). Copying the parent's memory space in fork() ...

 
Windows is always doing something different
 
5:25 PM
There was an interesting paper on the topic recently, microsoft.com/en-us/research/publication/a-fork-in-the-road
@FaheemMitha posix_spawn
 
@StephenKitt I see. Interesting. So basically, breaking it up into two pieces makes the two pieces simpler. Makes sense.
 
@Jesse_b Sigh, I know. That user tends to get combative for no apparent reason.
Sorry :/
 
Possibly better from a security standpoint too. Complexity breeds insecurity.
 
@terdon wow you’ve had a couple of interesting encounters today
@FaheemMitha as always there are arguments both ways; the Microsoft paper goes over some of them
 
@StephenKitt Ok
Do you do security work?
 
5:33 PM
@FaheemMitha sometimes
 
I mean, as part of your job.
 
@FaheemMitha yup, as part of my job and as a hobby
 
@StephenKitt You're not active on Information Security, though.
Seems like a useful site.
Though I've never spent much time there.
 
@FaheemMitha no ;-)
If you understand French, vimeo.com/267964514 shows me in action on the security side of things
 
Unfortunately, security continues to get more important as things get less secure.
@StephenKitt I can understand basic written French. Thank you for the link.
Oh, it's a video.
 
5:35 PM
@FaheemMitha yeah, sorry
 
@StephenKitt yeah...
 
@terdon I'm sorry you're a very attractive woman I just got carried away explaining the inner workings of the institution to Jim
 
¯\_(ツ)_/¯ I have no idea what's going on right now
 
wait don't put Complexity breeds insecurity that's basically as bad as a group of users on meth tucked in a shadow
sorry users belonging to a shadow group in some folder etc\
I suck. i'm in the wrong ear again
root used to be Caucasian slang for intercourse in my city when I was a kid
I mean I have no idea what It is now
 
@Adam Are you on mushrooms?
 
5:46 PM
ill take I guess, here goes, "peeewww di piie"
no I mean that would be sweet but Ive never actually tried them to be perfectly honest
they actually grow wild down south a few hours drive, but its really heavily policed so yeah not even worth it
 
@Adam please stop this. This isn't the place for random statements like this. it's disruptive to the room.
 
this is just diluted ethanol bro
ok im sorry
i just assumed everyone was able to ignore information they don't understand or care about
 
No, they can't. And posting random stuff is very disruptive since it breaks any current conversation. It also makes it impossible to start a new one. If you want to actually chat with people, that's great, but if you're just going off on a surreal monologue, please take it somewhere else.
 
hallucinogens are a major risk though to be serious for a moment. never let your kids fall for the "its natural" trend
ok fair enough but well surreal monologues are very heavily censored verbally by people that surround me as u probably can imagine
 
@Adam I can. And I am afraid they are going to be equally censored here, and for the same reasons ;).
 
5:53 PM
well i should be really good at the situation of being told to shut up it has pretty much been a common trend ever since i learnt to communicate lol
picked up from the first day at school most memorable
got in the car and casual called my grandmother a whole heap of really bad words i wont say
and when they got angry i couldn't get it apparently stating "that's what all the kids at school call me"
lol so i guess at that point i was so inept that i didn't even realise i was making people furious
 
@StephenKitt: So tell me more about this ability to ignore users in chat?
 
00:00 - 18:0018:00 - 00:00

« first day (3162 days earlier)      last day (1791 days later) »