platform_system_sepolicy/build
Felix 0d6864aebd build/file_utils: Newline for mapping files
Previous behaviour:
Test: Set `PRODUCT_PUBLIC_SEPOLICY_DIRS`, causing
      `product_sepolicy.cil` and `product_mapping_file` to
      be generated. Do not use any `type` declarations that
      would require a mapping in product sepolicy, e.g. only
      define macros.
      Run `make selinux_policy`, observe error:
```
FAILED: out/target/product/mydevice/obj/ETC/plat_pub_versioned.cil_intermediates/plat_pub_versioned.cil
/bin/bash -c "(out/host/linux-x86/bin/version_policy -b out/target/product/mydevice/obj/FAKE/sepolicy_neverallows_intermediates/pub_policy.cil -t out/target/product/mydevice/obj/FAKE/sepolicy_neverallows_intermediates/pub_policy.cil -n 10000.0 -o out/target/product/mydevice/obj/ETC/plat_pub_versioned.cil_intermediates/plat_pub_versioned.cil ) && (out/host/linux-x86/bin/secilc -m -M true -G -N -c 30 		out/target/product/mydevice/obj/ETC/plat_sepolicy.cil_intermediates/plat_sepolicy.cil  out/target/product/mydevice/obj/ETC/product_sepolicy.cil_intermediates/product_sepolicy.cil out/target/product/mydevice/obj/ETC/plat_mapping_file_intermediates/10000.0.cil  out/target/product/mydevice/obj/ETC/product_mapping_file_intermediates/10000.0.cil out/target/product/mydevice/obj/ETC/plat_pub_versioned.cil_intermediates/plat_pub_versioned.cil -o /dev/null -f /dev/null )"
Failure reading file: out/target/product/mydevice/obj/ETC/product_mapping_file_intermediates/10000.0.cil
```
This is caused by `secilc.c` trying to read the empty file:
```
rc = fread(buffer, file_size, 1, file);
```

Fix: Append a newline to make sure any file processed by
`filter_out` is still readable by secilc.

After:
Test: `make selinux_policy` with same preconditions.

Signed-off-by: Felix <google@ix5.org>
Change-Id: I6dcfcccdfa83121bbdc09632f7a2b609ef932fc9
2020-03-31 17:56:49 +02:00
..
soong Implement sysprop type checker 2020-03-25 11:13:29 +09:00
Android.bp Using a python script to build sepolicy 2018-02-05 18:22:12 +08:00
build_sepolicy.py Replace "grep -f" with python util. 2018-12-17 16:57:57 -08:00
file_utils.py build/file_utils: Newline for mapping files 2020-03-31 17:56:49 +02:00