public inbox for goredo-devel@lists.cypherpunks.ru
Atom feed
* File descriptor leak
@ 2022-05-08  4:44 Andrew Chambers
  2022-05-08  8:22 ` goredo
  2022-05-08 11:42 ` Sergey Matveev
  0 siblings, 2 replies; 7+ messages in thread
From: Andrew Chambers @ 2022-05-08  4:44 UTC (permalink / raw)
  To: goredo-devel

[-- Attachment #1: Type: text/plain, Size: 441 bytes --]

I have an especially large redo build (for building musl-libc) and I get 
the error:

main.go:506: src/stdio/putw.o: open /home/ac/src/musl/default.do: too 
many open files

I am using goredo 1.24.0 built with go1.16.9. I am fairly sure this is a 
file descriptor leak in goredo, as I don't have any problems with other 
redo implementations.

I have attached the default.do file that must be placed at the root of a 
musl v1.2.3 file tree.

[-- Attachment #2: default.do --]
[-- Type: text/plain, Size: 1748 bytes --]

set -eux
set -o pipefail
exec >&2

ARCH=${ARCH:-x86_64}
AR=${AR:-ar}
CC=${CC:-cc}
CFLAGS=${CFLAGS:--O2 -D _XOPEN_SOURCE=700}

bits_hdrs () {
	printf "%s\n" arch/$ARCH/bits/*.h
	printf "%s\n" arch/generic/bits/*.h
}

internal_hdrs () {
	echo "src/internal/version.h"
	printf "%s\n" src/internal/*.h
}

all_hdrs () {
	internal_hdrs
	echo "include/bits/alltypes.h"
	echo "include/bits/syscall.h"
	bits_hdrs
	printf "%s\n" include/*.h include/*/*.h
}

all_src () {
	printf "%s\n" src/*/$ARCH/*.[csS]
	printf "%s\n" src/*/*.c src/malloc/mallocng/*.c
}

all_obj () {
	all_src | sed -e 's/\.[csS]$/.o/g' 
}

case "$1" in

	all)
		mkdir -p include/bits
		redo-ifchange libc.a
	;;
	
	libc.a)
		obj="$(all_obj)"
		redo-ifchange $obj
		$AR rc "$3" $obj
	;;

	src/internal/version.h)
		echo "#define VERSION \"unknown\"" > "$3"
	;;

	include/bits/alltypes.h)
		redo-ifchange tools/mkalltypes.sed arch/$ARCH/bits/alltypes.h.in include/alltypes.h.in
		sed -f tools/mkalltypes.sed arch/$ARCH/bits/alltypes.h.in include/alltypes.h.in > "$3"
	;;

	include/bits/syscall.h)
		redo-ifchange arch/$ARCH/bits/syscall.h.in
		cp arch/$ARCH/bits/syscall.h.in "$3"
		sed -n -e s/__NR_/SYS_/p < arch/$ARCH/bits/syscall.h.in >> "$3"
	;;
	
	*.o)
		cfile="${1%.o}.c"
		sfile="${1%.o}.s"
		Sfile="${1%.o}.S"

		if test -e "$cfile"
		then
			src="$cfile"
		elif test -e "$sfile"
		then
			src="$sfile"
		elif test -e "$Sfile"
		then
			src="$Sfile"
		else
			echo "don't know how to build $1" 2>&1
			exit 1
		fi

		redo-ifchange $(all_hdrs) "$src"
		includes="
			-nostdinc
			-I./arch/$ARCH
			-I./arch/generic
			-I./src/internal
			-I./src/include
			-I./include
		"
		$CC $CFLAGS $includes -c -o "$3" "$src"
	;;

	*)
		echo "don't know how to build $1" 2>&1
		exit 1
	;;
esac

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-05-09  7:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-08  4:44 File descriptor leak Andrew Chambers
2022-05-08  8:22 ` goredo
2022-05-08  9:12   ` Andrew Chambers
2022-05-08 11:21     ` goredo
2022-05-08 11:42 ` Sergey Matveev
2022-05-09  0:31   ` Andrew Chambers
2022-05-09  7:10     ` Sergey Matveev