Skip to contentSkip to conversation

sort input files

PATCH Applied [email protected] 2 participants 2 messages Jun 1, 2017 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sort input files

From: "Bernhard M. Wiedemann" <[email protected]>

when building packages (e.g. for openSUSE Linux)
(random) filesystem order of input files
influences ordering of functions in the output,
thus without the patch, builds (in disposable VMs) would usually differ.

See https://reproducible-builds.org/ for why this matters.

---
 libselinux/utils/Makefile            | 2 +-
 libsemanage/src/Makefile             | 2 +-
 libsemanage/tests/Makefile           | 2 +-
 libsepol/tests/Makefile              | 2 +-
 libsepol/utils/Makefile              | 2 +-
 mcstrans/utils/Makefile              | 2 +-
 policycoreutils/hll/pp/Makefile      | 2 +-
 policycoreutils/load_policy/Makefile | 2 +-
 policycoreutils/run_init/Makefile    | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)
libselinux/utils/Makefile +1 -1
index 14f94bde..5f5368a8 100644
@@ -53,7 +53,7 @@ PCRE_LDLIBS ?= -lpcre
 ifeq ($(ANDROID_HOST),y)
 TARGETS=sefcontext_compile
 else
-TARGETS=$(patsubst %.c,%,$(wildcard *.c))
+TARGETS=$(patsubst %.c,%,$(sort $(wildcard *.c)))
 endif
 
 sefcontext_compile: LDLIBS += $(PCRE_LDLIBS) ../src/libselinux.a -lsepol
libsemanage/src/Makefile +1 -1
index dba50c8f..f01385c5 100644
@@ -51,7 +51,7 @@ SWIGFILES=$(SWIGSO) semanage.py
 SWIGRUBYSO=$(RUBYPREFIX)_semanage.so
 LIBSO=$(TARGET).$(LIBVERSION)
 
-GENERATED=$(SWIGCOUT) $(SWIGRUBYCOUT) semanageswig_python_exception.i $(wildcard conf-*.[ch])
+GENERATED=$(SWIGCOUT) $(SWIGRUBYCOUT) semanageswig_python_exception.i $(sort $(wildcard conf-*.[ch]))
 SRCS= $(filter-out $(GENERATED),$(sort $(wildcard *.c)))
 
 OBJS= $(patsubst %.c,%.o,$(SRCS)) conf-scan.o conf-parse.o
libsemanage/tests/Makefile +1 -1
index 9b272247..9ccb5b23 100644
@@ -2,7 +2,7 @@ PREFIX ?= $(DESTDIR)/usr
 LIBDIR ?= $(PREFIX)/lib
 
 # Add your test source files here:
-SOURCES = $(wildcard *.c)
+SOURCES = $(sort $(wildcard *.c))
 
 # Add the required external object files here:
 LIBS = ../src/libsemanage.a -lselinux -lsepol
libsepol/tests/Makefile +1 -1
index 6ae8ad2a..1bd96db9 100644
@@ -15,7 +15,7 @@ CHECKPOLICY := ../../checkpolicy/
 CPPFLAGS += -I../include/ -I$(CHECKPOLICY)
 
 # test program object files
-objs := $(patsubst %.c,%.o,$(wildcard *.c))
+objs := $(patsubst %.c,%.o,$(sort $(wildcard *.c)))
 parserobjs := $(CHECKPOLICY)queue.o $(CHECKPOLICY)y.tab.o \
 	$(CHECKPOLICY)parse_util.o $(CHECKPOLICY)lex.yy.o \
 	$(CHECKPOLICY)policy_define.o $(CHECKPOLICY)module_compiler.o
libsepol/utils/Makefile +1 -1
index 3b2fb771..467aff27 100644
@@ -7,7 +7,7 @@ override CFLAGS += -I../include
 override LDFLAGS += -L../src
 LDLIBS += -lsepol
 
-TARGETS=$(patsubst %.c,%,$(wildcard *.c))
+TARGETS=$(patsubst %.c,%,$(sort $(wildcard *.c)))
 
 all: $(TARGETS)
 
mcstrans/utils/Makefile +1 -1
index e6f329bc..7e596413 100644
@@ -8,7 +8,7 @@ CFLAGS ?= -Wall
 override CFLAGS += -I../src -D_GNU_SOURCE
 LDLIBS += -lselinux -lpcre
 
-TARGETS=$(patsubst %.c,%,$(wildcard *.c))
+TARGETS=$(patsubst %.c,%,$(sort $(wildcard *.c)))
 
 all: $(TARGETS)
 
policycoreutils/hll/pp/Makefile +1 -1
index 1ca6c9d9..813c9c6c 100644
@@ -10,7 +10,7 @@ HLLDIR ?= $(LIBEXECDIR)/selinux/hll
 CFLAGS ?= -Werror -Wall -W
 LDLIBS = -lsepol
 
-PP_SRCS = $(wildcard *.c)
+PP_SRCS = $(sort $(wildcard *.c))
 PP_OBJS = $(patsubst %.c,%.o,$(PP_SRCS))
 
 all: pp
policycoreutils/load_policy/Makefile +1 -1
index 6ab0f9d3..256d95af 100644
@@ -9,7 +9,7 @@ CFLAGS ?= -Werror -Wall -W
 override CFLAGS += $(LDFLAGS) -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
 LDLIBS += -lsepol -lselinux
 
-TARGETS=$(patsubst %.c,%,$(wildcard *.c))
+TARGETS=$(patsubst %.c,%,$(sort $(wildcard *.c)))
 
 all: $(TARGETS)
 
policycoreutils/run_init/Makefile +1 -1
index 6f5ee131..7b259525 100644
@@ -23,7 +23,7 @@ ifeq ($(AUDITH), y)
 	LDLIBS += -laudit
 endif
 
-TARGETS=$(patsubst %.c,%,$(wildcard *.c))
+TARGETS=$(patsubst %.c,%,$(sort $(wildcard *.c)))
 
 all: $(TARGETS)
 
Signature · 1 line
2.12.3
#1 lore raw
Quoted 9 lines · On Tue, 2017-05-30 at 16:21 +0200, [email protected] wrote:

From: "Bernhard M. Wiedemann" <[email protected]>

when building packages (e.g. for openSUSE Linux) (random) filesystem order of input files
influences ordering of functions in the output,
thus without the patch, builds (in disposable VMs) would usually differ.

See https://reproducible-builds.org/ for why this matters.

Thanks, applied.

Quoted 137 lines

---
 libselinux/utils/Makefile            | 2 +- libsemanage/src/Makefile             | 2 +- libsemanage/tests/Makefile           | 2 +-

 libsepol/tests/Makefile              | 2 +-
 libsepol/utils/Makefile              | 2 +-
 mcstrans/utils/Makefile              | 2 +-
 policycoreutils/hll/pp/Makefile      | 2 +-
 policycoreutils/load_policy/Makefile | 2 +-
 policycoreutils/run_init/Makefile    | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)
libselinux/utils/Makefile +0 -0
index 14f94bde..5f5368a8 100644
@@ -53,7 +53,7 @@ PCRE_LDLIBS ?= -lpcre
  ifeq ($(ANDROID_HOST),y)

 TARGETS=sefcontext_compile
 else

libselinux/utils/Makefile +1 -1
-TARGETS=$(patsubst %.c,%,$(wildcard *.c))
+TARGETS=$(patsubst %.c,%,$(sort $(wildcard *.c)))

 endif

 sefcontext_compile: LDLIBS += $(PCRE_LDLIBS) ../src/libselinux.a

libselinux/utils/Makefile +0 -1
-lsepol
libsemanage/src/Makefile +0 -0
index dba50c8f..f01385c5 100644
@@ -51,7 +51,7 @@ SWIGFILES=$(SWIGSO) semanage.py

 SWIGRUBYSO=$(RUBYPREFIX)_semanage.so LIBSO=$(TARGET).$(LIBVERSION)

-GENERATED=$(SWIGCOUT) $(SWIGRUBYCOUT) semanageswig_python_exception.i $(wildcard conf-*.[ch]) +GENERATED=$(SWIGCOUT) $(SWIGRUBYCOUT) semanageswig_python_exception.i $(sort $(wildcard conf-*.[ch])) SRCS= $(filter-out $(GENERATED),$(sort $(wildcard *.c)))
 OBJS= $(patsubst %.c,%.o,$(SRCS)) conf-scan.o conf-parse.o

libsemanage/tests/Makefile +0 -0
index 9b272247..9ccb5b23 100644
@@ -2,7 +2,7 @@ PREFIX ?= $(DESTDIR)/usr

 LIBDIR ?= $(PREFIX)/lib

 # Add your test source files here:

libsemanage/tests/Makefile +1 -1
-SOURCES = $(wildcard *.c)
+SOURCES = $(sort $(wildcard *.c))


 # Add the required external object files here:
 LIBS = ../src/libsemanage.a -lselinux -lsepol

libsepol/tests/Makefile +0 -0
index 6ae8ad2a..1bd96db9 100644
@@ -15,7 +15,7 @@ CHECKPOLICY := ../../checkpolicy/
  CPPFLAGS += -I../include/ -I$(CHECKPOLICY)

 # test program object files
libsepol/tests/Makefile +1 -1
-objs := $(patsubst %.c,%.o,$(wildcard *.c))
+objs := $(patsubst %.c,%.o,$(sort $(wildcard *.c)))

 parserobjs := $(CHECKPOLICY)queue.o $(CHECKPOLICY)y.tab.o \
  $(CHECKPOLICY)parse_util.o $(CHECKPOLICY)lex.yy.o \
  $(CHECKPOLICY)policy_define.o $(CHECKPOLICY)module_compiler.o

libsepol/utils/Makefile +0 -0
index 3b2fb771..467aff27 100644
@@ -7,7 +7,7 @@ override CFLAGS += -I../include

 override LDFLAGS += -L../src
 LDLIBS += -lsepol

libsepol/utils/Makefile +1 -1
-TARGETS=$(patsubst %.c,%,$(wildcard *.c))
+TARGETS=$(patsubst %.c,%,$(sort $(wildcard *.c)))


 all: $(TARGETS)

mcstrans/utils/Makefile +0 -0
index e6f329bc..7e596413 100644
@@ -8,7 +8,7 @@ CFLAGS ?= -Wall

 override CFLAGS += -I../src -D_GNU_SOURCE LDLIBS += -lselinux -lpcre

mcstrans/utils/Makefile +1 -1
-TARGETS=$(patsubst %.c,%,$(wildcard *.c))
+TARGETS=$(patsubst %.c,%,$(sort $(wildcard *.c)))


 all: $(TARGETS)

policycoreutils/hll/pp/Makefile +0 -0
index 1ca6c9d9..813c9c6c 100644
@@ -10,7 +10,7 @@ HLLDIR ?= $(LIBEXECDIR)/selinux/hll

 CFLAGS ?= -Werror -Wall -W
 LDLIBS = -lsepol

policycoreutils/hll/pp/Makefile +1 -1
-PP_SRCS = $(wildcard *.c)
+PP_SRCS = $(sort $(wildcard *.c))

 PP_OBJS = $(patsubst %.c,%.o,$(PP_SRCS))
 all: pp

policycoreutils/load_policy/Makefile +0 -0
index 6ab0f9d3..256d95af 100644
@@ -9,7 +9,7 @@ CFLAGS ?= -Werror -Wall -W

 override CFLAGS += $(LDFLAGS) -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\"" LDLIBS += -lsepol -lselinux

policycoreutils/load_policy/Makefile +1 -1
-TARGETS=$(patsubst %.c,%,$(wildcard *.c))
+TARGETS=$(patsubst %.c,%,$(sort $(wildcard *.c)))


 all: $(TARGETS)

policycoreutils/run_init/Makefile +0 -0
index 6f5ee131..7b259525 100644
@@ -23,7 +23,7 @@ ifeq ($(AUDITH), y)

  LDLIBS += -laudit
 endif

policycoreutils/run_init/Makefile +1 -1
-TARGETS=$(patsubst %.c,%,$(wildcard *.c))
+TARGETS=$(patsubst %.c,%,$(sort $(wildcard *.c)))


 all: $(TARGETS)