« first day (3825 days earlier)      last day (1128 days later) » 

9:27 AM
Morning
 
nwp
Hi!
I took a stab at writing a story.
I made it to 7000 words and feel somewhat proud of myself.
Even if the Document Statistics say it's 8th grade English -.-
 
Neato, is it the programmer stereotypical sci-fi fantasy? Or what would you say the genre is?
 
twilight/MLP crossover fanfic I hope
 
nwp
Well, it's inspired by another story. An Isekai where you get into a VR rig and end up in the typical medieval fantasy land with elfs, dwarfs and magic.
So I guess you hit the genre, but I'd argue the sci-fi aspects are barely there, just as a little bit of background lore.
 
kind of funny how isekai was made the genre term because it seemed to flood the light novel market. But it's not like Alice in Wonderland or The Wizard of Oz aren't good candidates for that too
 
nwp
9:43 AM
I think the difference is that isekai is specifically for a game world which in that universe it is. Alice and Dorothy didn't end up in a game.
 
I don't think so, many have a reincarnation story in divorced from any type of game
 
nwp
9:54 AM
I remember a picture proposing requirements for what an isekai is and the consequences. One option was "You must me moved somewhere against your will while dying -> An ambulance ride is an isekai". There also was one about Star Trek. I can't find it anymore.
 
I think it's one of those things where an exhaustive and precise criterion is almost impossible. Or as the supreme court would say "I know it when I see it"
 
nwp
10:22 AM
@Mikhail I'm pretty sure compilers have padding warnings for this reason that you can enable.
 
the highest warning level in msvc is basically the "fill my error log with all padding warnings" option
 
 
4 hours later…
2:52 PM
@PeterT Big mood
I don't even fix all the conversion warnings at /W2
/W4 is just madness
 
 
1 hour later…
4:22 PM
from what I can tell, padding warnings are too spurious: for example, stackoverflow.com/a/52030848/314290
 
 
5 hours later…
9:11 PM
from boost process
`int exit_code() const;
Get the exit_code. The return value is without any meaning if the child wasn't waited for or if it was terminated.`

probably the correct return type should be std::optional?
 
but int is smaller
also I guess that Boost.Process predates std::optional
Boost.Optional has been a thing for a long time though
 
Oh, I was a little bit confused about a talk on ABI breakages. So basically sometimes C++ will pass small POD like structure via registers and sometimes it won't. See youtu.be/7RoTDjLLXJQ?t=1207 . But I don't understand enough about function calling conventions. How are structures passing in different calling conventions? Doesn't the function signature and the calling convention (cdecl, etc) specify this part of the ABI?
 
Yes, both play a role in the ABI
The calling convention depends on the size of the arguments and whether they're trivially copyable IIRC
Which is why you end up with subpar speed for passing an std::unique_ptr
 
but if I specify a function signature + calling convention, the compiler can't decide to put std::pair<unsigned char, unsigned char> into a register? Because the calling convention can only have one way of passing that?
 
IIRC for GCC and Clang it can't because the Itanium ABI mandates that types with non-trivial copy & move constructors/operator= are passed on the stack
 
9:30 PM
@Mikhail Don't get me started on Boost Process. I would have rejected this library design so hard if I had known the stupendous complexities it took for... ¯\_(ツ)_/¯ wanking only.
I mean, hallelulja you shaved a few instructions off from ... checks notes ... PROCESS CREATION.
Oh, and all your call sites generate new bloat, because statically typed and inlining!
Now everyone is having to jump through horrible hoops like this to get some flexibility:
1
A: Function with variable parameter size: How to conditionally set some arguments?

seheI've been there. Indeed, launcher functions (not exactly factories, but composable procedural wrappers) were what I used. Intro We had a CommandRunner with a legacy implementation that I rewrote to use Boost. I'm skipping the public interface: class CommandRunner { public: struct IRunner...

 
Not to mention that boost.process uses std::string as a container for results
 
It doesn't, though. It can.
You know. Fits with the "everything generic"!
The problem is, everything became complex. I BET that's why they went with the strings. To make "some things easy by default".
However, you guess what bp::std_in < my_string means. (I'll let you guess)
 
feeds input from my_string
 
You wish.
It opens a file named by my_string (AFAIR).
It's... pretty horrible. In fact, just horrible, and not pretty.
 
lol
operators abuse seemed fun in the 90s
 
9:41 PM
nö! wow, we need to burn that
 
I mean, the library has its uses. And after a few versions they stopped reintroducing the same regressions. I believe they even finally put in some version of my patch that allowed to filter file-descriptors from being inherited by child processes.
This - of course - was a cross-cutting concern and required touching all implementation details (in fairness, some of that is inherent to the domain and the added value of the library. However, having seen the overcomplicated implementation, I doubt I'll trust it for production use ~again~)
I'll happily use it to spin up a process left or right and readily appreciate it's Asio integration. But for production use I'll probably just do the simpler thing.
(more work to implement, but easier to reason about, I mean)
 
Yeah, process creation looks horrible to do cross-platform
Which is why I'd rather use a lib than try to do it myself ^^'
 
I mean boost process is fine, Qt's process creation had wacky stuff where sometimes processes weren't made, etc
 
TBF, the library was adopted from being "abandon ware" at 0.5.0 for... 5+ years. I think the maintainer did improve a lot, which is, sad fact.
@Morwenn Yeah, if I need it cross-platform I'll probably still use Boost for a long time, but I'll test it to DEATH.
@Mikhail 😱
I'm somewhat relieved to find that is the case.
 
That information is painful to process
 
9:46 PM
I did recfactor a commercial product away from POSIX to Boost Process araound Boost 1.63 or so. But it never left TEST because it didn't provably want to become more stable than what we had (which very rarely lead to hanging processes)
@Morwenn Not to mention the punitive yoke
 
I've been stuck on this bug for like an hour. So If I run a program in boost process it doesn't throw an error but doesn't give an output. If I run what I think are the same arguments on the command line (print them before passing) everything seems fine. Should I just commit sepaku, or is there some way to figure out what boost process is invoking?
 
I love the idea of a midnight chat, but I have to take my leave
 
make like a tree and leaf
 
@Mikhail Nah. it's probably real simple. Care to show me the code? Did you use args/exe style or system style?
 
:o
Good night dirty punners
 
9:51 PM
Take your mirror on the way out :)
 
How dare you!
I can't bear this anymore
 
@Mikhail that's the sad thing, like with Spirit, Fusion, BGL, once you know it you can diagnose these pitfalls in a jiffy
Or at least "smell" the source ingredients.
 
@sehe something like this pastebin.com/tr1B5Ezp
so if I copy and paste the terminal output it works
 
What does "it works" look like?
 
external program produces output with no errors (also error code 0)
but when I run it from boost process (for certain arguments) external program does not produce any output. But when I copy and paste string boost process supposedly invokes, I get valid output.
 
10:02 PM
I think I see the problem. You're providing a "fake_path". The program probably requires a "real path" to work.
 
shush
 
I could be wrong though.
 
@Mikhail How do you ascertain "does not produce any output"? That code is not shown
 
Yeah I mean it invokes an external program, which doesn't seem to like a specific combination of arguments when passed through boost process. Although that tool doesn't produce any formal errors possibly because it was written by dirty functional programers.
 
Just a random (and possibly stupid) guess, but maybe you need to export PATH before running your program?
 
10:06 PM
well it runs certain paths, I'm wondering if boost process does some wacky encoding stuff with its args parameter
 
@StackedCrooked nope (it's an absolute path anyways)
@Mikhail nope. You do though, because of the .string() accessor. That's a choice you could vary. However, I still think it's something simpler.
 
Well when its printed, using the shown loop the command works...
 
I believe you might have said so before. That doesn't disprove much on an encoding level.
Again, I don't think that is it.
@Mikhail Which paths would be varying then? The exe or just the args
 
well boost process checks if the path to the exe is valid
 
That doesn't tell me anything I wanted to know.
 
10:12 PM
I mean probably the args somehow get screwed up, else there is some difference in calling between the terminal copy/paste run and invoking from boost process
 
1 min ago, by sehe
@Mikhail Which paths would be varying then? The exe or just the args
 
just the args
 
Ah. Thanks
I'm thinking whether it might be UB to use arguments after it was assigned to an auto var. :)
 
":-/
 
I know you didn't want to hear that. Try inlining the args or something like coliru.stacked-crooked.com/a/ce61c0709cba2879
@Mikhail Did I tell you loathable the interface is?
I mean, it mostly works when you stay on the narrow path of the standard use cases. Don't get smart with it. Because pretty soon you'll realize the all the clever was used up by the library devs.
 
10:18 PM
trying
 
:drumroll:
(asan/ubsan/valgrind don't report issues. Which, as @Morwenn will confirm, doesn't tell you everything, but it's a start.)
Did you spot the neat improvement with fmt btw?
    fmt::print("{} {}\n", fake_path.string(), fmt::join(arguments, " "));
 
okay tried it, but same result
I'll try invoking a system(command) and see if anything works
 
Good, then we're not cray yet
@Mikhail It will work, but it's a security hole the size of your mom
 
probably will need to do system(line); sleep(sometime)
 
Also, it will stop working as soon as your args contain anything your shell thinks is interestin (quotes, $, whitespace (specifcically IFS) etc)
@Mikhail you could popen (but I don't recommend it for the same reasons)
Yeah I just looked at the impl https://paste.ubuntu.com/p/X9kGBbjwpX/ and that's safe from dangling references, so it was a red herring.
Okay, right now I'm still wondering this:
24 mins ago, by sehe
@Mikhail How do you ascertain "does not produce any output"? That code is not shown
Your answer just rehashed the complaint, instead of telling me how you know that it doesn't work
 
10:27 PM
bw my favorite format trick is fmt::print("{}",fmt::format(fg(fmt::color::magenta), "fancy"))
 
Ooh nice.
I heard they added that, but I never saw it IRL
That smells like useless of of cat in isolation though. I suppose this would be the same for this simple example: fmt::print(fg(fmt::color::magenta), "fancy");
 
^ that pr got rejected (fyi)
 
Oh. :(
 
so system(line) also doesn't work but when I enter the system line in the terminal it works (in the sense the command line program behaves as expected)
maybe it expects some weird user interaction flag?
 
Oh. I forgot to mention that: try adding boost::process::std_in.close()
Any chance you can show some details about that?
 
10:34 PM
oh details about what?
basically the program needs to produce output in a directory I pass via the second argument
but in this case I don't see no output
 
AH. So you don't see external side-effects.
You only said "output". Which you're actively redirecting, so naturally, we would have to assume that was the output.
It's very easy to run into deadlocks with some kinds of interactive stream IO.
 
I see the process gets a PID which means it was invoked
 
Which is why I wanted to know. Still, perhaps related, because if you fail to consume the output, and the child doesn't progress when the buffer is full,...
@Mikhail prezoisely.
You can always use the pid to inspect actuall command line arguments:
xargs -0 -n1 < /proc/$BASHPID/cmdline
xargs
-0
-n1
 
oh thats an intersting idea
 
Or, alternatively, run /usr/bin/strace with your command and identify precisely what goes wrong.
 
10:39 PM
okay I'm going to try to figure out what its actually invoking, but I suspect if system(line) didn't work then boost also won't work
 
Filter for some category (like e.g. with strace -e file ls >/dev/null) and perhaps side-by-side diff to spot what is the first difference
@Mikhail I'd use the variant that you intend to keep using (Boost Process, because it's not a giant security hole, or surprise waiting to happen)
You are right that they probably both have the same issue.
I forget to ask, does the program run in the same environment as your shell?
Like $USER, $HOME, etc.
 
Yeah I just invoke it from command line
 
Okay clear. I know that Boost Process doesn't do any magic with envs (unless you instruct it to, so no)
 
11:23 PM
@Mikhail Just to be absolutely blithely obvious: THERE AREN"T ANY WHITESPACES IN THE ARGUMENTS ARE THERE (God I hope not)
 
11:46 PM
Yeah there aren't, and working in the terminal vs when launching the process (even using system) hints at maybe some permission issue. Anyways, thanks for your help. I'll keep hacking on it.
 

« first day (3825 days earlier)      last day (1128 days later) »