Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2cfce938 authored by Martin Stjernholm's avatar Martin Stjernholm
Browse files

Do not chmod the symlink target when a prebuilt binary is symlinked.

It may be in a source tree that isn't writable. Instead check that
the target is executable.

Test: m
Test: chmod a-x system/sepolicy/tools/insertkeys.py && \
  rm -rf out/host out/soong/host && \
  m insertkeys.py
  Check that it fails with the expected error message.
Fixes: 169375644
Change-Id: I402d029dba45783127586ad9749c90012afe891d
parent 1fdef5f7
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -149,12 +149,15 @@ endif
$(LOCAL_BUILT_MODULE): $(LOCAL_PREBUILT_MODULE_FILE)
ifeq ($(LOCAL_IS_HOST_MODULE) $(if $(filter EXECUTABLES SHARED_LIBRARIES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),true,),true true)
	$(copy-or-link-prebuilt-to-target)
  ifneq ($(filter EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
	[ -x $@ ] || $(call echo-error,$@,Target of symlink is not executable)
  endif
else
	$(transform-prebuilt-to-target)
endif
  ifneq ($(filter EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
	$(hide) chmod +x $@
  endif
endif

ifndef LOCAL_IS_HOST_MODULE
  ifdef LOCAL_SOONG_UNSTRIPPED_BINARY
+5 −2
Original line number Diff line number Diff line
@@ -59,12 +59,15 @@ endif
$(LOCAL_BUILT_MODULE): $(LOCAL_PREBUILT_MODULE_FILE)
ifeq ($(LOCAL_IS_HOST_MODULE) $(if $(filter EXECUTABLES SHARED_LIBRARIES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),true,),true true)
	$(copy-or-link-prebuilt-to-target)
  ifneq ($(filter EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
	[ -x $@ ] || $(call echo-error,$@,Target of symlink is not executable)
  endif
else
	$(transform-prebuilt-to-target)
endif
  ifneq ($(filter EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
	$(hide) chmod +x $@
  endif
endif

ifndef LOCAL_IS_HOST_MODULE
  ifdef LOCAL_SOONG_UNSTRIPPED_BINARY