ossobv / sonic-buildimage

Scripts which perform an installable binary image build for SONiC
Other
0 stars 0 forks source link

build: (minor) Stray /dpkg/tmp.XXXXXX files #24

Open wdoekes opened 2 weeks ago

wdoekes commented 2 weeks ago

Description

$ ls dpkg/ -ltr
total 243
drwx------ 2 sonic-builder sonic-builder 2 Nov  7 14:29 tmp.kqNUFxrvcs
drwx------ 2 sonic-builder sonic-builder 2 Nov  7 14:29 tmp.QNfFERqflx
...
drwx------ 2 sonic-builder sonic-builder 2 Nov  7 16:08 tmp.tHZUdHxxHT
drwx------ 2 sonic-builder sonic-builder 2 Nov 11 13:39 tmp.cLNxEDsMnN
drwx------ 2 sonic-builder sonic-builder 2 Nov 11 13:39 tmp.L3kGhYMF85
...
rwx------ 2 sonic-builder sonic-builder 2 Nov 11 13:39 tmp.ftQZUhXYuu
drwx------ 2 sonic-builder sonic-builder 2 Nov 11 13:39 tmp.VpNsTerDw0
drwx------ 2 sonic-builder sonic-builder 2 Nov 11 14:10 tmp.WWiFcW2T5T
drwx------ 2 sonic-builder sonic-builder 2 Nov 11 14:10 tmp.VKETKjBkZn
drwx------ 3 sonic-builder sonic-builder 3 Nov 11 14:10 tmp.NH6wuUV7pl

^- batches of stray tmp files.

We did these changes:

--- a/rules/functions
+++ b/rules/functions
@@ -171,9 +171,9 @@ define SETUP_OVERLAYFS_FOR_DPKG_ADMINDIR
 upperdir=$(shell mktemp -d -p $(DPKG_ADMINDIR_PATH))
 workdir=$(shell mktemp -d -p $(DPKG_ADMINDIR_PATH))
 mergedir=$(shell mktemp -d -p $(DPKG_ADMINDIR_PATH))
-sudo mount -t overlay overlay -olowerdir=/var/lib/dpkg,upperdir=$$upperdir,workdir=$$workdir $$mergedir
+sudo mount -t overlay -o ro overlay -olowerdir=/var/lib/dpkg,upperdir=$$upperdir,workdir=$$workdir $$mergedir
 export SONIC_DPKG_ADMINDIR=$$mergedir
-trap "sudo umount $$mergedir && rm -rf $$mergedir $$upperdir $$workdir" EXIT
+trap "sudo umount $$mergedir; rm --one-file-system -vrf $$mergedir $$upperdir $$workdir" EXIT
 endef

And it looks like many tmpdirs do get cleaned up. But it appears that some don't. In the case above with 13:39, all of them were during the first minute of the build. There were more files when running, but after ^C, they were all cleared and only 13:39 was left.

Which build are we running (if any)

upstream c8e588808075ed02a92eb81cd1507df9cc2753ce + ossomain

Upstream issues/PRs

github.com/sonic-net/sonic-buildimage/issues/20772