ld randomly assigns wrong user and group IDs to executable

Andrew Schulman schulman.andrew@epa.gov
Fri Apr 22 18:08:00 GMT 2016


This is a strange one.

cygwin 2.5.1-1
binutils 2.25-4

Lately my attempt to build fish keeps failing, and I've traced it to the
following problem:

During configure, a particular c++ program compiles fine, but the generated
executable has the wrong user and group IDs and permissions, so the
configure test fails and my build fails.

Here are the source files and generated executable:

$ ls -l conftest*
-rw-r--r--  1 ASchulma     Domain Users   1911 Apr 22 13:11 conftest.cpp
-rw-r--r--  1 ASchulma     Domain Users    466 Apr 22 13:11 conftest.err
-rwxr-x---  1 Unknown+User Unknown+Group 62152 Apr 22 13:11 conftest.exe

$ ls -ln conftest.exe
-rwxr-x--- 1 4294967295 4294967295 62152 Apr 22 13:11 conftest.exe

Note the strange, apparently random user and group ID numbers for
conftest.exe.

* This happens about half the time. The other half of the time, the user
and group IDs are mine and so the build succeeds.  I haven't been able to
figure out when it will fail.

* The user and group IDs are always the same, 4294967295, when the problem
happens.

* It only happens with this one program - other tests in configure work
fine.

* When I compile the program on my own, outside of configure, it builds
fine, two compiler warnings aside.

An excerpt of config.log is below.

What could be causing this?  Is it a problem with ld, or with Cygwin?

Thanks,
Andrew

----------
config.log
----------

configure:5219: checking if struct winsize and TIOCGWINSZ exist
configure:5246: g++ -o conftest.exe -ggdb -O2 -pipe
-fdebug-prefix-map=/home/ASchulma/dev/cygwin/fish/fish-2.3b1-1.x86_64/build=/usr/src/debug/fish-2.3b1-1
-fdebug-prefix-map=/home/ASchulma/dev/cygwin/fish/fish-2.3b1-1.x86_64/src/fish-2.3b1=/usr/src/debug/fish-2.3b1-1
-D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -fno-exceptions -Wall
-Wno-sign-compare   conftest.cpp -lintl -lncurses  >&5
conftest.cpp: In function 'int main()':
conftest.cpp:80:19: warning: statement has no effect [-Wunused-value]
         TIOCGWINSZ;
                   ^
conftest.cpp:79:24: warning: unused variable 'termsize' [-Wunused-variable]
         struct winsize termsize = {0};
                        ^
/usr/lib/gcc/x86_64-pc-cygwin/5.3.0/../../../../x86_64-pc-cygwin/bin/ld:
cannot open output file conftest.exe: Permission denied
collect2: error: ld returned 1 exit status
configure:5246: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "fish"
| #define PACKAGE_TARNAME "fish"
| #define PACKAGE_VERSION "2.3b1"
| #define PACKAGE_STRING "fish 2.3b1"
| #define PACKAGE_BUGREPORT "fish-users@lists.sourceforge.net"
| #define PACKAGE_URL ""
| #define USE_GETTEXT 1
| #define HAVE__PROC_SELF_STAT 1
| #define HAVE_TRANSLATE_H 1
| #define NCURSES_NOMACROS 1
| #define NOMACROS 1
| #define HAVE_NAN 1
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_GETOPT_H 1
| #define HAVE_TERMIOS_H 1
| #define HAVE_SYS_RESOURCE_H 1
| #define HAVE_TERM_H 1
| #define HAVE_NCURSES_TERM_H 1
| #define HAVE_NCURSES_H 1
| #define HAVE_NCURSES_CURSES_H 1
| #define HAVE_CURSES_H 1
| #define HAVE_SYS_SELECT_H 1
| #define HAVE_SYS_IOCTL_H 1
| #define HAVE_SPAWN_H 1
| #define HAVE_LIBINTL_H 1
| #define SIZEOF_WCHAR_T 2
| #define WCHAR_T_BITS 16
| #define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1
| #define HAVE_DIRENT_H 1
| #define HAVE_STRUCT_DIRENT_D_TYPE 1
| #define HAVE_WCSDUP 1
| #define HAVE_WCSLEN 1
| #define HAVE_WCSCASECMP 1
| #define HAVE_WCSNCASECMP 1
| #define HAVE_FWPRINTF 1
| #define HAVE_FUTIMES 1
| #define HAVE_WCWIDTH 1
| #define HAVE_WCSWIDTH 1
| #define HAVE_WCSTOK 1
| #define HAVE_FPUTWC 1
| #define HAVE_FGETWC 1
| #define HAVE_WCSTOL 1
| #define HAVE_WCSLCAT 1
| #define HAVE_WCSLCPY 1
| #define HAVE_KILLPG 1
| #define HAVE_MKOSTEMP 1
| #define HAVE_SYSCONF 1
| #define HAVE_GETIFADDRS 1
| #define HAVE_FUTIMENS 1
| #define HAVE_CLOCK_GETTIME 1
| #define HAVE_GETTEXT 1
| #define HAVE_DCGETTEXT 1
| #define HAVE_REALPATH_NULL 1
| /* end confdefs.h.  */
|
|
|         #ifdef HAVE_TERMIOS_H
|         #include <termios.h>
|         #endif
|
|         #ifdef HAVE_SYS_IOCTL_H
|         #include <sys/ioctl.h>
|         #endif
|
| int
| main ()
| {
|
|         struct winsize termsize = {0};
|         TIOCGWINSZ;
|
|
|   ;
|   return 0;
| }
|
configure:5256: result: no


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list