This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

64 bit Cywgin 2.5.2 on Wine: python fails with sem_init: Invalid argument

Hi folks,

When compiling 64 bit Cygwin on Wine, I found a python{2,3} failure
when building documentation [1]:

xmlto --skip-validation --with-dblatex pdf -o cygwin-ug-net/ -m
sem_init: Invalid argument
Traceback (most recent call last):
  File "/usr/bin/dblatex", line 10, in <module>
    from dbtexmf.dblatex import dblatex
  File "/usr/lib/python2.7/site-packages/dbtexmf/dblatex/",
line 8, in <module>
    from dbtexmf.core.dbtex import DbTex, DbTexCommand
  File "/usr/lib/python2.7/site-packages/dbtexmf/core/", line
11, in <module>
    import urllib
  File "/usr/lib/python2.7/", line 26, in <module>
    import socket
  File "/usr/lib/python2.7/", line 67, in <module>
    from _ssl import SSLError as sslerror
ImportError: cannot import name SSLError
make[3]: [Makefile:104: cygwin-ug-net/cygwin-ug-net.pdf] Error 1 (ignored)

According to my previous experience this happens with previous version
of Cygwin 64 bit on Wine, but works fine on Windows, and works fine on
32 bit Cygwin on Wine. I can't test latest git HEAD Cygwin version due
to another known failure.

I tried to track down the problem, and I found during the call of
sem_init(sem, pshared=0, value=1), in some case pshared and value were
unexpectedly changed to large integers after

I tried to reproduce with a simplified test case, and got the below
code which behaviors wrong but not exactly in the same way:

#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <semaphore.h>
#include <pthread.h>

main(int argc, char *argv[])
    sem_t *p_sem = malloc(sizeof(sem_t));

    memset(p_sem, 0xcc, sizeof(sem_t)); /* trigger exception handling
code in Cygwin sem_init()-->verifyable_object_isvalid() */
    sem_init(p_sem, 0, 1);

    return 0;

Compiled using Cygwin gcc -pthread, The above code works fine on
Cygwin on Windows and 32 bit Cygwin on Wine, but causes a stack
overflow on 64 bit Cygwin on Wine. Unfortunately it does not fail
exatly in the same way to Cygiwn python, but at least it brings some
interesting question.

I think it is a Wine bug which does not handle exception correctly,
and I'm trying to track down deeper. At the time could anyone provide
some hint which piece of Cygwin code could I learn to write a pure
Win32 test case emulating the above example?

I also attached +seh log comparing 64 bit Cygwin and 32 bit Cygwin on
Wine, which show the stackoverflow on 64 bit but handles fine on 32
bit, hopefully that helps. I created a Wine bug on [2].

Thank you!


Qian Hong


Description: Text document

Description: Text document

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]