Subject: Re: bug#21918: 'visudo' non-deterministic (sudo 1.8.15)

From: [email-masked] (Ludovic Courtès)
Date: Mon, 16 Nov 2015 00:47:16 +0100

Building things with -j1 (commit 511495f) doesn’t help.  This time,
‘visudo’ ends up with a similar difference:

--8<---------------cut here---------------start------------->8---
7241 	Contents·​of·​section·​.​rodata:​ 	7241 	Contents·​of·​section·​.​rodata:​
7242 	·​1c580·​01000200·​2e2f6564·​69746f72·​2e630020·​·​.​.​.​.​.​/​editor.​c.​·​ 	7242 	·​1c580·​01000200·​65646974·​6f722e63·​00200900·​·​.​.​.​.​editor.​c.​·​.​.​
--8<---------------cut here---------------end--------------->8---

The two build logs show one interesting difference:

@@ -1198,6 +1201,7 @@ case "" in \
 esac
 libtool: link: gcc -shared  -fPIC -DPIC  .libs/sudo_auth.o .libs/pam.o .libs/boottime.o .libs/check.o .libs/editor.o .libs/env.o .libs/find_path.o .libs/goodpath.o .libs/group_plugin.o .libs/interfaces.o .libs/iolog.o .libs/iolog_path.o .libs/locale.o .libs/logging.o .libs/logwrap.o .libs/parse.o .libs/policy.o .libs/prompt.o .libs/set_perms.o .libs/sudo_nss.o .libs/sudoers.o .libs/timestamp.o  -Wl,--whole-archive ./.libs/libparsesudoers.a -Wl,--no-whole-archive  -Wl,-rpath -Wl,/gnu/store/ijjmxqjbq6pxlimajzifi2r77dq41h01-linux-pam-1.2.1/lib -Wl,-rpath -Wl,/tmp/nix-build-sudo-1.8.15.drv-0/sudo-1.8.15/lib/util/.libs -Wl,-rpath -Wl,/gnu/store/ijjmxqjbq6pxlimajzifi2r77dq41h01-linux-pam-1.2.1/lib -Wl,-rpath -Wl,/gnu/store/5hvzy6kmr60m1psgz5m8ggw6w3y1xljf-sudo-1.8.15/libexec/sudo /gnu/store/ijjmxqjbq6pxlimajzifi2r77dq41h01-linux-pam-1.2.1/lib/libpam.so ../../lib/util/.libs/libsudo_util.so -ldl  -Wl,-z -Wl,relro -fstack-protector-strong   -Wl,-soname -Wl,sudoers.so -o .libs/sudoers.so
 libtool: link: ( cd ".libs" && rm -f "sudoers.la" && ln -s "../sudoers.la" "sudoers.la" )
+gcc -std=gnu99 -c -I../../include -I../.. -I. -I. -I../.. -DLIBDIR=\"/gnu/store/5hvzy6kmr60m1psgz5m8ggw6w3y1xljf-sudo-1.8.15/lib\" -DLOCALEDIR=\"/gnu/store/5hvzy6kmr60m1psgz5m8ggw6w3y1xljf-sudo-1.8.15/share/locale\" -D_PATH_SUDOERS=\"/etc/sudoers\" -DSUDOERS_UID=0 -DSUDOERS_GID=0 -DSUDOERS_MODE=0440 -D_PATH_MV='"/gnu/store/mnwjrkbfzkb5ifhqf8hssf3cxfvg11l6-coreutils-8.24/bin/mv"' -D_FORTIFY_SOURCE=2 -g -O2 -fvisibility=hidden -fPIE -fstack-protector-strong editor.c
 gcc -std=gnu99 -c -I../../include -I../.. -I. -I. -I../.. -DLIBDIR=\"/gnu/store/5hvzy6kmr60m1psgz5m8ggw6w3y1xljf-sudo-1.8.15/lib\" -DLOCALEDIR=\"/gnu/store/5hvzy6kmr60m1psgz5m8ggw6w3y1xljf-sudo-1.8.15/share/locale\" -D_PATH_SUDOERS=\"/etc/sudoers\" -DSUDOERS_UID=0 -DSUDOERS_GID=0 -DSUDOERS_MODE=0440 -D_PATH_MV='"/gnu/store/mnwjrkbfzkb5ifhqf8hssf3cxfvg11l6-coreutils-8.24/bin/mv"' -D_FORTIFY_SOURCE=2 -g -O2 -fvisibility=hidden -fPIE -fstack-protector-strong find_path.c
 gcc -std=gnu99 -c -I../../include -I../.. -I. -I. -I../.. -DLIBDIR=\"/gnu/store/5hvzy6kmr60m1psgz5m8ggw6w3y1xljf-sudo-1.8.15/lib\" -DLOCALEDIR=\"/gnu/store/5hvzy6kmr60m1psgz5m8ggw6w3y1xljf-sudo-1.8.15/share/locale\" -D_PATH_SUDOERS=\"/etc/sudoers\" -DSUDOERS_UID=0 -DSUDOERS_GID=0 -DSUDOERS_MODE=0440 -D_PATH_MV='"/gnu/store/mnwjrkbfzkb5ifhqf8hssf3cxfvg11l6-coreutils-8.24/bin/mv"' -D_FORTIFY_SOURCE=2 -g -O2 -fvisibility=hidden -fPIE -fstack-protector-strong ./sudo_printf.c
 gcc -std=gnu99 -c -I../../include -I../.. -I. -I. -I../.. -DLIBDIR=\"/gnu/store/5hvzy6kmr60m1psgz5m8ggw6w3y1xljf-sudo-1.8.15/lib\" -DLOCALEDIR=\"/gnu/store/5hvzy6kmr60m1psgz5m8ggw6w3y1xljf-sudo-1.8.15/share/locale\" -D_PATH_SUDOERS=\"/etc/sudoers\" -DSUDOERS_UID=0 -DSUDOERS_GID=0 -DSUDOERS_MODE=0440 -D_PATH_MV='"/gnu/store/mnwjrkbfzkb5ifhqf8hssf3cxfvg11l6-coreutils-8.24/bin/mv"' -D_FORTIFY_SOURCE=2 -g -O2 -fvisibility=hidden -fPIE -fstack-protector-strong ./visudo.c

The file ‘editor.c’ is compiled several times.  It looks as if whether
that extra compilation step (in plugins/sudoers/) was made was based on
a non-deterministic choice.

Ludo’.