Closed wkozaczuk closed 1 year ago
Thanks @wkozaczuk sorry for not being more diligent during my review of #1232. I'll commit your patch above to fix the function signature, and see if I can figure out the remaining bug.
@StonewallJohnson, for future reference to run the OSv test suite, you can run "make check". You can also run a single test like the one that Waldek noticed here is failing:
scripts/build image=tests
scripts/run.py -e tests/tst-semaphore.so
On top of fixing this, we also need to add all new
sem_*
functions to theexported_symbols/osv_libpthread.so.0.symbols
file.
I don't know yet how to do that :-( Can you please prepare a patch to do that? Yesterday I also sent a patch to add strfromf128 et al. - is this something we'll also need to some exported symbol file?
I cut the test to only
sem_t *named_sem3 = sem_open("other", O_EXCL | O_CREAT | O_SYNC, 0777, 1);
assert(named_sem3 != SEM_FAILED);
assert(sem_unlink("other") == 0);
assert(sem_close(named_sem3) == 0);
And just that crashes. Trying to debug it...
I think I know where the bug is:
name_semaphores holds unique_ptr<posix_semaphore>
objects. This means that as soon as we unlink a named seamphore, and it's removed from the hash table, the unique_ptr is destroyed... It shouldn't. named_semaphores needs to hold pointers to unique_ptr, not the unique_ptr themselves.
I'll prepare a patch.
Recently added support of the named semaphores support is broken or the relevant part of the
tst-semaphore.cc
has a bug.First of all, when running the
tst-semaphore.cc
, one gets the following error:This is actually caused by the fact the signature of the
sem_open
is different in musl header than it is in thesem.cc
(as a matter of fact the last 2 arguments are only required withO_CREAT
).Applying this patch fixes this issue:
But then we get another crash:
On top of fixing this, we also need to add all new
sem_*
functions to theexported_symbols/osv_libpthread.so.0.symbols
file.