Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 921613 - app-emulation/wine-{staging,vanilla}[mingw]: race condition in x86_64-w64-mingw32-strip
Summary: app-emulation/wine-{staging,vanilla}[mingw]: race condition in x86_64-w64-min...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Wine Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: parallel-make
  Show dependency tree
 
Reported: 2024-01-08 17:51 UTC by 12101111
Modified: 2024-01-08 18:56 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log.bz2,230.57 KB, application/x-bzip2)
2024-01-08 17:54 UTC, 12101111
Details

Note You need to log in before you can comment on or make changes to this bug.
Description 12101111 2024-01-08 17:51:14 UTC
ebuild of wine use `find -exec` to strip symbols of PE files.
This has race condition and may fail on machine with many CPU cores.

code in ebuild:
```
		if use strip; then
			ebegin "Stripping Windows (PE) binaries"
			find "${ED}"${WINE_PREFIX}/wine/*-windows -regex '.*\.\(a\|dll\|exe\)' \
				-exec $(usex abi_x86_64 x86_64 i686)-w64-mingw32-strip --strip-unneeded {} +
			eend ${?} || die
		fi
```

Output of failed command:

```
 * Stripping Windows (PE) binaries ...
x86_64-w64-mingw32-strip: cannot create tempdir for archive copying (error: File exists)                 [ !! ]
```



Reproducible: Sometimes

Steps to Reproduce:
1. USE=-strip ebuild path_to_wine-{vanilla,staging}-*.ebuild install
2. mkdir /tmp/test && cd /tmp/test
3. 
for i in $(seq 0 100);do
  cp /tmp/portage/app-emulation/wine-staging-8.21/image/usr/lib/wine-staging-8.21/wine/x86_64-windows/lib{msvcr,ucrtbase}* .
  find -type f -exec /usr/lib/mingw64-toolchain/bin/x86_64-w64-mingw32-strip --strip-unneeded {} +
done
Actual Results:  
/usr/lib/mingw64-toolchain/bin/x86_64-w64-mingw32-strip: cannot create tempdir for archive copying (error: File exists)


Expected Results:  
No output

emerge --info:

Portage 3.0.61 (python 3.11.7-final-0, targets/systemd, gcc-17.0.6, musl-1.2.4-r1, 6.7.0-rc8+ x86_64)
=================================================================
System uname: Linux-6.7.0-rc8+-x86_64-AMD_Ryzen_9_7945HX_with_Radeon_Graphics-with-libc
KiB Mem:    64979464 total,  39880488 free
KiB Swap:   67108860 total,  67108860 free
Timestamp of repository gentoo: Mon, 08 Jan 2024 10:03:15 +0000
Head commit of repository gentoo: e35eb4321d496af06140f4560c96782cf63cc9eb

Timestamp of repository gentoo-zh: Mon, 08 Jan 2024 10:03:06 +0000
Head commit of repository gentoo-zh: 7001fc277748aba09855b88276be176e4e294e0d

Timestamp of repository guru: Mon, 08 Jan 2024 10:03:07 +0000
Head commit of repository guru: 10bd6114c8905e059e9e36deb055c141fbd18793

Timestamp of repository mv: Fri, 05 Jan 2024 20:35:22 +0000
Head commit of repository mv: 4a0adf547bf6c459c3e4d4553a0421df07f04fa8

sh bash 5.2_p21-r1
ld LLD 17.0.6 (compatible with GNU linkers)
ccache version 4.9 [enabled]
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p21-r1::gentoo
dev-java/java-config:      2.3.3-r1::gentoo
dev-lang/perl:             5.38.2-r1::gentoo
dev-lang/python:           3.11.7::gentoo, 3.12.1_p1::gentoo
dev-lang/rust:             1.74.1::12101111-overlay
dev-util/ccache:           4.9::gentoo
dev-util/cmake:            3.28.1-r1::gentoo
dev-util/meson:            1.3.1::gentoo
sys-apps/baselayout:       2.14-r1::gentoo
sys-apps/sandbox:          2.38::gentoo
sys-apps/systemd:          254.8::12101111-overlay
sys-devel/autoconf:        2.13-r8::gentoo, 2.71-r7::gentoo, 2.72-r1::gentoo
sys-devel/automake:        1.16.5-r1::gentoo
sys-devel/binutils:        2.41-r4::12101111-overlay
sys-devel/binutils-config: 5.5::gentoo
sys-devel/clang:           16.0.6::gentoo, 17.0.6::gentoo
sys-devel/libtool:         2.4.7-r1::gentoo
sys-devel/lld:             16.0.6::gentoo, 17.0.6::gentoo
sys-devel/llvm:            16.0.6::12101111-overlay, 17.0.6::gentoo
sys-devel/make:            4.4.1-r1::gentoo
sys-kernel/linux-headers:  6.6::gentoo (virtual/os-headers)
sys-libs/musl:             1.2.4-r1::12101111-overlay
Repositories:

gentoo
    location: /usr/portage/gentoo
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gentoo
    priority: -1000
    volatile: True

gentoo-zh
    location: /usr/portage/gentoo-zh
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gentoo-zh.git
    masters: gentoo
    volatile: True

guru
    location: /usr/portage/guru
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/guru.git
    masters: gentoo
    volatile: True

mv
    location: /usr/portage/mv
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/mv.git
    masters: gentoo
    volatile: True

12101111-overlay
    location: /usr/portage/local
    masters: gentoo
    priority: 1000
    volatile: True

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="@FREE"
ADDR2LINE="llvm-addr2line"
AR="llvm-ar"
AS="clang -c"
CBUILD="x86_64-pc-linux-musl"
CC="clang"
CFLAGS="-march=znver4 -mtune=znver4 -O3 -pipe -flto=thin -fomit-frame-pointer -ffunction-sections -fdata-sections -fno-plt"
CHOST="x86_64-pc-linux-musl"
CONFIG_PROTECT="/etc /usr/lib/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d"
CPP="clang-cpp"
CXX="clang++"
CXXFLAGS="-march=znver4 -mtune=znver4 -O3 -pipe -flto=thin -fomit-frame-pointer -ffunction-sections -fdata-sections -fno-plt"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live candy ccache config-protect-if-modified distlocks downgrade-backup ebuild-locks fixlafiles ipc-sandbox merge-sync network-sandbox news parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=znver4 -mtune=znver4 -O3 -pipe -fomit-frame-pointer -ffunction-sections -fdata-sections"
GENTOO_MIRRORS="https://mirrors.ustc.edu.cn/gentoo/"
INSTALL_MASK=""
LANG="zh_CN.UTF-8"
LC_ALL="zh_CN.UTF-8"
LD="ld.lld"
LDFLAGS="-flto=thin -Wl,--gc-sections -Wl,--lto-O3,-O3,--icf=safe -Wl,-zrelro,-znow,-ztext -march=znver4 -mtune=znver4"
LEX="flex"
MAKEOPTS="-j32"
NM="llvm-nm"
OBJCOPY="llvm-objcopy"
OBJDUMP="llvm-objdump"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/tmp"
RANLIB="llvm-ranlib"
READELF="llvm-readelf"
RUSTFLAGS="-Ctarget-cpu=znver4 -Copt-level=3 -Ccodegen-units=1 -Ctarget-feature=-crt-static -Clinker-plugin-lto -Clinker=clang -Clink-arg=-fuse-ld=lld -Clink-arg=-flto=thin -Clink-arg=-Wl,--lto-O3,-O3,--icf=safe"
SHELL="/bin/zsh"
STRINGS="llvm-strings"
STRIP="llvm-strip"
USE="X acl alsa amd64 bluetooth bzip2 clang compiler-rt crypt cups dbus default-compiler-rt default-libcxx eselect-ldso gif iconv ipv6 jpeg libcxx libcxxabi libtirpc libunwind llvm-libunwind lto lzma ncurses networkmanager nls nptl opengl pam pcre pgo pic png policykit pulseaudio readline seccomp ssl svg systemd test-rust udev unicode vaapi vulkan wayland xattr zlib zsh-completion zstd" ABI_X86="64" ADA_TARGET="gnat_2021" ALSA_CARDS="hda-intel usb-audio" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 avx512f avx512dq avx512cd avx512bw avx512vl avx512vbmi f16c fma3 mmx mmxext pclmul popcnt rdrand sha sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="musl" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 ntrip navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" INPUT_DEVICES="evdev libinput" KERNEL="linux" L10N="zh-CN" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LLVM_TARGETS="X86 ARM AArch64 RISCV WebAssembly AMDGPU AVR BPF Hexagon Lanai MSP430 Mips NVPTX PowerPC Sparc SystemZ XCore" LUA_SINGLE_TARGET="lua5-4" LUA_TARGETS="lua5-4 luajit" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-1" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" QEMU_SOFTMMU_TARGETS="arm aarch64 i386 x86_64 riscv32 riscv64" QEMU_USER_TARGETS="arm aarch64 riscv32 riscv64" RUBY_TARGETS="ruby32" VIDEO_CARDS="amdgpu radeonsi radeon intel i965 iris nouveau" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account"
Unset:  ARFLAGS, ASFLAGS, CCLD, CONFIG_SHELL, CPPFLAGS, CTARGET, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, SIZE, YACC, YFLAGS
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-01-08 17:52:15 UTC
(I'll block 'parallel-make' as it's close enough for the tracker purposes.)
Comment 2 12101111 2024-01-08 17:54:47 UTC
Created attachment 881675 [details]
build.log
Comment 3 Ionen Wolkens gentoo-dev 2024-01-08 18:19:11 UTC
That sounds odd, unless I'm missing something find -exec doesn't call multiple strip at same time and just build an argument list to do afaik sequencial strip calls (several per call, not that strip should be racing with itself). Where would it be racing?

Tried that seq loop a few times but I can't reproduce on my glibc system so far (maybe too slow, was on tmpfs fwiw too), and it typically builds fine when I try musl not that I test it much there.
Comment 4 Ionen Wolkens gentoo-dev 2024-01-08 18:56:35 UTC
(In reply to Ionen Wolkens from comment #3)
> Tried that seq loop a few times but I can't reproduce on my glibc system so
> far (maybe too slow, was on tmpfs fwiw too), and it typically builds fine
> when I try musl not that I test it much there.
Sounded like a long shot but fwiw I can't reproduce in a musl chroot either. The seq loop was roughly 2x slower in the musl chroot than glibc though.

Either way, not sure what to do with this, technically I don't see anything wrong with the ebuild.

*Could* switch to doing only one file per strip(1) call if that helps (maybe a bug in strip(1) if so), albeit that sound like just a bunch of unnecessary forking for an operation that's already relatively slow.