Skip to contentSkip to conversation

Drop LGTM.com configuration

PATCH In review Christian Göttsche 2 participants 9 messages Nov 9, 2023 – Nov 16, 2023 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/7 Drop LGTM.com configuration

LGTM.com has been discontinued in 2022 and replaced by GitHub code scanning[1].

[1]: https://github.blog/2022-08-15-the-next-step-for-lgtm-com-github-code-scanning/

---
 lgtm.yml | 5 -----
 1 file changed, 5 deletions(-)
 delete mode 100644 lgtm.yml
lgtm.yml deleted +0 -5
deleted file mode 100644
index f80bf146..00000000
@@ -1,5 +0,0 @@
-extraction:
-  cpp:
-    index:
-      build_command:
-        - make DESTDIR="$LGTM_WORKSPACE/destdir" install
Signature · 1 line
2.42.0
#1 lore raw

PATCH 2/7 Drop Travis CI configuration

Travis CI stopped providing free CI services for open-source projects in 2020[1] and the last build happened more than two years ago[2].

[1]: https://www.travis-ci.com/blog/2020-11-02-travis-ci-new-billing/
[2]: https://app.travis-ci.com/github/SELinuxProject/selinux

---
 .travis.yml | 14 --------------
 README.md   |  1 -
 2 files changed, 15 deletions(-)
 delete mode 100644 .travis.yml
.travis.yml deleted +0 -14
deleted file mode 100644
index 1c2c7f33..00000000
@@ -1,14 +0,0 @@
-# Define the building environment
-language: c
-
-# Use Travis-CI Ubuntu 18.04 Bionic Beaver, "full image" variant
-sudo: required
-dist: bionic
-
-script:
-  - FEDORA_MAJOR=33 FEDORA_MINOR=1.2 scripts/ci/travis-kvm-setup.sh
-
-# Do not spam by email so long as the build succeeds
-notifications:
-  email:
-    on_success: never
README.md +0 -1
index c272ce89..8c475126 100644
@@ -116,7 +116,6 @@ This can be done using [./scripts/env_use_destdir](./scripts/env_use_destdir):
     DESTDIR=~/obj ./scripts/env_use_destdir make test
 
 Some tests require the reference policy to be installed (for example in `python/sepolgen`).
-In order to run these ones, instructions similar to the ones in section `install` of [./.travis.yml](./.travis.yml) can be executed.
 
 To install as the default system libraries and binaries
 (overwriting any previously installed ones - dangerous!),
Signature · 1 line
2.42.0
#2 lore raw

PATCH 3/7 scripts: ignore unavailable interpreters

In reply to Christian Göttsche

Skip running and setting environment variables for unavailable interpreters in the env_use_destdir wrapper script to avoid output like:

    $ ./scripts/env_use_destdir $DESTDIR/usr/sbin/getenforce
    ./scripts/env_use_destdir: 59: ruby: not found
    ./scripts/env_use_destdir: 59: ruby: not found
    Enforcing
---
 scripts/env_use_destdir | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
scripts/env_use_destdir +12 -8
index 89d989a2..e8069be8 100755
@@ -43,17 +43,21 @@ if [ -n "${SBINDIR:-}" ] ; then
     PATH="$DESTDIR$SBINDIR:$PATH"
 fi
 
-NEW_PYTHONPATH="$DESTDIR$(${PYTHON:-python3} -c "import sysconfig; print(sysconfig.get_path('platlib', vars={'platbase': '/usr', 'base': '/usr'}))"):$DESTDIR$(${PYTHON:-python3} -c "import sysconfig; print(sysconfig.get_path('purelib', vars={'platbase': '/usr', 'base': '/usr'}))")"
-if [ -n "${PYTHONPATH:-}" ] ; then
-    # Prefix the PYTHONPATH with the new directories
-    export PYTHONPATH="$NEW_PYTHONPATH:$PYTHONPATH"
-else
-    # Define PYTHONPATH
-    export PYTHONPATH="$NEW_PYTHONPATH"
+if command -v "${PYTHON:-python3}" > /dev/null ; then
+    NEW_PYTHONPATH="$DESTDIR$(${PYTHON:-python3} -c "import sysconfig; print(sysconfig.get_path('platlib', vars={'platbase': '/usr', 'base': '/usr'}))"):$DESTDIR$(${PYTHON:-python3} -c "import sysconfig; print(sysconfig.get_path('purelib', vars={'platbase': '/usr', 'base': '/usr'}))")"
+    if [ -n "${PYTHONPATH:-}" ] ; then
+        # Prefix the PYTHONPATH with the new directories
+        export PYTHONPATH="$NEW_PYTHONPATH:$PYTHONPATH"
+    else
+        # Define PYTHONPATH
+        export PYTHONPATH="$NEW_PYTHONPATH"
+    fi
 fi
 
 # shellcheck disable=SC2155
-export RUBYLIB="$DESTDIR/$(${RUBY:-ruby} -e 'puts RbConfig::CONFIG["vendorlibdir"]'):$DESTDIR/$(${RUBY:-ruby} -e 'puts RbConfig::CONFIG["vendorarchdir"]')"
+if command -v "${RUBY:-ruby}" > /dev/null ; then
+    export RUBYLIB="$DESTDIR/$(${RUBY:-ruby} -e 'puts RbConfig::CONFIG["vendorlibdir"]'):$DESTDIR/$(${RUBY:-ruby} -e 'puts RbConfig::CONFIG["vendorarchdir"]')"
+fi
 
 # Run the command given on the command line
 if [ $# -gt 0 ] ; then
Signature · 1 line
2.42.0
#3 lore raw

PATCH 4/7 ci: bump Fedora to version 39

In reply to Christian Göttsche

Currently the GitHub Action vm_testsuite fails:

The requested URL returned error: 404

---
 scripts/ci/Vagrantfile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/ci/Vagrantfile +2 -2
index b6023367..f3c90b71 100644
@@ -2,7 +2,7 @@
 # vi: set ft=ruby :
 # Vagrant configuration file which creates a virtual machine that can run the
 # test suite using fedora-test-runner.sh, in an environment similar to the one
-# used for automated continuous integration tests (Travis-CI)
+# used for automated continuous integration tests (GitHub Actions)
 #
 # To create a new virtual machine:
 #
@@ -34,7 +34,7 @@ SCRIPT
 # backwards compatibility). Please don't change it unless you know what
 # you're doing.
 Vagrant.configure("2") do |config|
-  config.vm.box = "fedora/36-cloud-base"
+  config.vm.box = "fedora/39-cloud-base"
   config.vm.synced_folder "../..", "/root/selinux"
 
   config.vm.provider "virtualbox" do |v|
Signature · 1 line
2.42.0
#4 lore raw

PATCH 5/7 libselinux: update Python binding

In reply to Christian Göttsche

Update for commit 494eb683f3d1 ("libselinux: add getpidprevcon").

---
 libselinux/src/selinuxswig_python_exception.i | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
libselinux/src/selinuxswig_python_exception.i +16 -0
index a02f4923..e5e55a79 100644
@@ -79,6 +79,22 @@
   }
 }
 
+%exception getpidprevcon {
+  $action
+  if (result < 0) {
+     PyErr_SetFromErrno(PyExc_OSError);
+     SWIG_fail;
+  }
+}
+
+%exception getpidprevcon_raw {
+  $action
+  if (result < 0) {
+     PyErr_SetFromErrno(PyExc_OSError);
+     SWIG_fail;
+  }
+}
+
 %exception getexeccon {
   $action
   if (result < 0) {
Signature · 1 line
2.42.0
#5 lore raw

PATCH 6/7 Update Python installation on Debian

In reply to Christian Göttsche

Between Debian 11 and 12 the way to install Python packages into the system location under /usr, and not /usr/local, changed[1]. The previous setup argument --install-layout=deb is now unsupported and the environment variable DEB_PYTHON_INSTALL_LAYOUT needs to be set instead.

See also [2].

[1]: https://lists.debian.org/debian-devel/2023/07/msg00307.html
[2]: https://salsa.debian.org/selinux-team/libselinux/-/commit/cbfb31a0925e01591a9cce1eb3a0e517f42b144c

---
 README.md              | 6 +++++-
 scripts/run-scan-build | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)
README.md +5 -1
index 8c475126..765b5626 100644
@@ -108,7 +108,11 @@ To build and install everything under a private directory, run:
 
     make DESTDIR=~/obj install install-rubywrap install-pywrap
 
-On Debian `PYTHON_SETUP_ARGS='--install-option "--install-layout=deb"'` needs to be set when installing the python wrappers in order to create the correct python directory structure.
+On Debian the environment variable `DEB_PYTHON_INSTALL_LAYOUT` needs to be set
+to `deb` when installing the Python wrappers in order to create the correct
+Python directory structure.
+On Debian systems older than bookworm set
+`PYTHON_SETUP_ARGS='--install-option "--install-layout=deb"'` instead.
 
 To run tests with the built libraries and programs, several paths (relative to `$DESTDIR`) need to be added to variables `$LD_LIBRARY_PATH`, `$PATH` and `$PYTHONPATH`.
 This can be done using [./scripts/env_use_destdir](./scripts/env_use_destdir):
scripts/run-scan-build +1 -1
index 931ffd2a..7b731f3e 100755
@@ -25,7 +25,7 @@ export PYTHONPATH="$DESTDIR$(${PYTHON:-python3} -c "import sysconfig; print(sysc
 export RUBYLIB="$DESTDIR/$(${RUBY:-ruby} -e 'puts RbConfig::CONFIG["vendorlibdir"]'):$DESTDIR/$(${RUBY:-ruby} -e 'puts RbConfig::CONFIG["vendorarchdir"]')"
 
 if [ -f /etc/debian_version ] && [ -z "${IS_CIRCLE_CI:-}" ] ; then
-    export PYTHON_SETUP_ARGS='--install-layout=deb'
+    export DEB_PYTHON_INSTALL_LAYOUT='deb'
 fi
 
 # Build and analyze
Signature · 1 line
2.42.0
#6 lore raw

PATCH 7/7 scripts: update run-scan-build

In reply to Christian Göttsche

* Do not build test target

Building the test target breaks the whole build since the tests for libsepol require checkpolicy to be build already:

make[2]: *** No rule to make target '../../checkpolicy/y.tab.o', needed by 'libsepol-tests'. Stop. make[2]: *** Waiting for unfinished jobs....

Since issues in the test suites are not critical do not build them.

* Update build status reporting

Since the script sets the option -e scan-build will immediately exit on failure and the informative message "++ Build failed" is not printed.

* Bump to fortify level 3

* Fix typo

---
 scripts/run-scan-build | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
scripts/run-scan-build +5 -8
index 7b731f3e..e4f13a2f 100755
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Run clang's static analyzer (scan-build) and record its output in output-scan-build/
 
-# Allow overriding binariy names, like clang-12
+# Allow overriding binary names, like clang-12
 export CC=${CC:-clang}
 SCAN_BUILD=${SCAN_BUILD:-scan-build}
 
@@ -32,15 +32,12 @@ fi
 make -C .. clean distclean -j"$(nproc)"
 $SCAN_BUILD -analyze-headers -o "$OUTPUTDIR" make -C .. \
     DESTDIR="$DESTDIR" \
-    CFLAGS="-O2 -Wall -Wextra -D_FORTIFY_SOURCE=2 -D__CHECKER__ -I$DESTDIR/usr/include" \
+    CFLAGS="-O2 -Wall -Wextra -D_FORTIFY_SOURCE=3 -D__CHECKER__ -I$DESTDIR/usr/include" \
     -j"$(nproc)" \
-    install install-pywrap install-rubywrap all test
+    install install-pywrap install-rubywrap all \
+    || { echo "++ Build failed!"; exit 1; }
 
-if [ $? -eq 0 ]; then
-    echo "++ Build succeeded"
-else
-    echo "++ Build failed"
-fi
+echo "++ Build succeeded"
 
 # Reduce the verbosity in order to keep the message from scan-build saying
 # "scan-build: Run 'scan-view /.../output-scan-build/2018-...' to examine bug reports.
Signature · 1 line
2.42.0
Acked-by on v1 1/7
#7 lore raw
In reply to Christian Göttsche
Quoted 7 lines · Christian Göttsche

LGTM.com has been discontinued in 2022 and replaced by GitHub code scanning[1].

[1]: https://github.blog/2022-08-15-the-next-step-for-lgtm-com-github-code-scanning/

For these seven patches:

Quoted 19 lines
---
 lgtm.yml | 5 -----
 1 file changed, 5 deletions(-)
 delete mode 100644 lgtm.yml
lgtm.yml deleted +0 -6
deleted file mode 100644
index f80bf146..00000000
@@ -1,5 +0,0 @@
-extraction:
-  cpp:
-    index:
-      build_command:
-        - make DESTDIR="$LGTM_WORKSPACE/destdir" install
--

2.42.0

#8 lore raw
Quoted 7 lines · James Carter
Quoted 4 lines · Christian Göttsche

LGTM.com has been discontinued in 2022 and replaced by GitHub code scanning[1].

Quoted 7 lines
Quoted 3 lines

[1]: https://github.blog/2022-08-15-the-next-step-for-lgtm-com-github-code-scanning/

For these seven patches:

These seven patches have been merged.
Thanks,
Jim

Quoted 19 lines
Quoted 19 lines
---
 lgtm.yml | 5 -----
 1 file changed, 5 deletions(-)
 delete mode 100644 lgtm.yml
lgtm.yml deleted +0 -6
deleted file mode 100644
index f80bf146..00000000
@@ -1,5 +0,0 @@
-extraction:
-  cpp:
-    index:
-      build_command:
-        - make DESTDIR="$LGTM_WORKSPACE/destdir" install
--

2.42.0