On Tue, Jan 09, 2024 at 08:16:00AM +0000, Carsten Haitzler wrote:
> > So eina_suite.c gets the wrong pid from fork().  In a simple standalone
> > program, fork() behaves as expected.
> 
> now a returned pid of 0 ... THAT IS WRONG! well unless its inside the child.
> the parent should get -1 for a failure or > 0 for the child pid. the child 
> gets
> 0 ... but see below

Yea, I was printing in the parent and child, but my message didn't
indicate that.  Nothing bad going on there.

> > I'm going to compare the arch & debian check packages for any suspicious
> > differences.  And maybe walk through more carefully with gdb.  But I'm out 
> > of
> > time tonight.
> 
> Yeah - I see the problem in debian SID (this is on aarch64 btw) ... but it
> totally smells of a check bug as above. just a cursory glance tells me that
> something is wrong over there - if check is sitting and waiting on test suite
> procs that have already exited/gone...

I played a bit more with strace - it's a bashism in efl_check.h.  If I
switch the code at [1] to use /bin/bash, then it works for me.  I bet
Arch has /bin/sh linked to bash; on Debian, /bin/sh is dash.

Here's the difference:
- `bash -c /bin/true` directly execs /bin/true without a fork
- `dash -c /bin/true` always fork & execs

Looking at efl_check.h, eina_suite does:
- fork & exec /bin/sh -c /path/to/timeout

That means the sequence is:
- on bash: fork, exec, exec
- on dash: fork, exec, fork, exec

So there's no exotic bug with libc/linux/etc - fork works fine, there's
just an extra one.  I'd guess that strace -f and adding a pipe changes
the fork order, and that's why they tend to trigger this.

(Side note: bash's lack of fork is surprising, but I'm surely ignorant of
some details.)

Ross

[1] - 
https://git.enlightenment.org/enlightenment/efl/src/commit/248d62bf5e13ca8800a73b6cf3e8759443468282/src/tests/efl_check.h#L378


_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to