From 4dae461183c6ec9c54c59ee7e8a6f558fd2da09d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 23 Mar 2021 01:36:06 +0100 Subject: [PATCH 01/10] Move ASAN-specific packages installation No changes yet, just reorganize things to make upcoming changes simpler. --- build/tools/before_install.sh | 46 +++++++++++++++++------------------ 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/build/tools/before_install.sh b/build/tools/before_install.sh index 8ce44ea704..a60cc80695 100755 --- a/build/tools/before_install.sh +++ b/build/tools/before_install.sh @@ -9,6 +9,29 @@ SUDO=sudo case $(uname -s) in Linux) if [ -f /etc/apt/sources.list ]; then + if [ "$wxUSE_ASAN" = 1 ]; then + codename=$(lsb_release --codename --short) + # Enable the `-dbgsym` repositories. + echo "deb http://ddebs.ubuntu.com ${codename} main restricted universe multiverse + deb http://ddebs.ubuntu.com ${codename}-updates main restricted universe multiverse + deb http://ddebs.ubuntu.com ${codename}-proposed main restricted universe multiverse" | \ + $SUDO tee --append /etc/apt/sources.list.d/ddebs.list + + # Import the debug symbol archive signing key from the Ubuntu server. + # Note that this command works only on Ubuntu 18.04 LTS and newer. + $SUDO apt-get install -y ubuntu-dbgsym-keyring + + # The key in the package above is currently (2021-03-22) out of + # date, so get the latest key manually (this is completely + # insecure, of course, but we don't care). + wget -O - http://ddebs.ubuntu.com/dbgsym-release-key.asc | $SUDO apt-key add - + + $SUDO apt-get update + + # Install the symbols to allow LSAN suppression list to work. + $SUDO apt-get install -y libfontconfig1-dbgsym libglib2.0-0-dbgsym libgtk-3-0-dbgsym libatk-bridge2.0-0-dbgsym + fi + $SUDO apt-get update case "$wxCONFIGURE_FLAGS" in @@ -45,29 +68,6 @@ case $(uname -s) in done $SUDO apt-get install -y $libtoolkit_dev $pkg_install - - if [ "$wxUSE_ASAN" = 1 ]; then - codename=$(lsb_release --codename --short) - # Enable the `-dbgsym` repositories. - echo "deb http://ddebs.ubuntu.com ${codename} main restricted universe multiverse - deb http://ddebs.ubuntu.com ${codename}-updates main restricted universe multiverse - deb http://ddebs.ubuntu.com ${codename}-proposed main restricted universe multiverse" | \ - $SUDO tee --append /etc/apt/sources.list.d/ddebs.list - - # Import the debug symbol archive signing key from the Ubuntu server. - # Note that this command works only on Ubuntu 18.04 LTS and newer. - $SUDO apt-get install -y ubuntu-dbgsym-keyring - - # The key in the package above is currently (2021-03-22) out of - # date, so get the latest key manually (this is completely - # insecure, of course, but we don't care). - wget -O - http://ddebs.ubuntu.com/dbgsym-release-key.asc | $SUDO apt-key add - - - $SUDO apt-get update - - # Install the symbols to allow LSAN suppression list to work. - $SUDO apt-get install -y libfontconfig1-dbgsym libglib2.0-0-dbgsym libgtk-3-0-dbgsym libatk-bridge2.0-0-dbgsym - fi fi ;; From ce1d6162f7ea69f500117485db5c058bff816070 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 23 Mar 2021 01:37:31 +0100 Subject: [PATCH 02/10] Run apt-get install only once and not twice Add -dbgsym packages to extra_deps and pass them to the same apt-get command we use for installing all the other dependencies. This is slightly faster and also makes it simpler to pass extra options to apt-get, as we're going to do in the next commit. --- build/tools/before_install.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build/tools/before_install.sh b/build/tools/before_install.sh index a60cc80695..9b3e5ec193 100755 --- a/build/tools/before_install.sh +++ b/build/tools/before_install.sh @@ -26,10 +26,8 @@ case $(uname -s) in # insecure, of course, but we don't care). wget -O - http://ddebs.ubuntu.com/dbgsym-release-key.asc | $SUDO apt-key add - - $SUDO apt-get update - # Install the symbols to allow LSAN suppression list to work. - $SUDO apt-get install -y libfontconfig1-dbgsym libglib2.0-0-dbgsym libgtk-3-0-dbgsym libatk-bridge2.0-0-dbgsym + pkg_install='libfontconfig1-dbgsym libglib2.0-0-dbgsym libgtk-3-0-dbgsym libatk-bridge2.0-0-dbgsym' fi $SUDO apt-get update @@ -60,6 +58,8 @@ case $(uname -s) in libglu1-mesa-dev" esac + pkg_install="$pkg_install $libtoolkit_dev" + extra_deps="$extra_deps libcurl4-openssl-dev libsecret-1-dev libnotify-dev" for pkg in $extra_deps; do if $(apt-cache pkgnames | grep -q $pkg) ; then @@ -67,7 +67,7 @@ case $(uname -s) in fi done - $SUDO apt-get install -y $libtoolkit_dev $pkg_install + $SUDO apt-get install -y $pkg_install fi ;; From 899a5251fb848a43dce211db2724b54f6a755076 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 23 Mar 2021 01:55:50 +0100 Subject: [PATCH 03/10] Run apt-get more quietly Avoid unnecessary progress messages about reading the database. --- build/tools/before_install.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/build/tools/before_install.sh b/build/tools/before_install.sh index 9b3e5ec193..a0b49cccf5 100755 --- a/build/tools/before_install.sh +++ b/build/tools/before_install.sh @@ -9,6 +9,9 @@ SUDO=sudo case $(uname -s) in Linux) if [ -f /etc/apt/sources.list ]; then + # Disable some (but not all) output. + apt_quiet='-q -o=Dpkg::Use-Pty=0' + if [ "$wxUSE_ASAN" = 1 ]; then codename=$(lsb_release --codename --short) # Enable the `-dbgsym` repositories. @@ -19,7 +22,7 @@ case $(uname -s) in # Import the debug symbol archive signing key from the Ubuntu server. # Note that this command works only on Ubuntu 18.04 LTS and newer. - $SUDO apt-get install -y ubuntu-dbgsym-keyring + $SUDO apt-get $apt_quiet install -y ubuntu-dbgsym-keyring # The key in the package above is currently (2021-03-22) out of # date, so get the latest key manually (this is completely @@ -30,7 +33,7 @@ case $(uname -s) in pkg_install='libfontconfig1-dbgsym libglib2.0-0-dbgsym libgtk-3-0-dbgsym libatk-bridge2.0-0-dbgsym' fi - $SUDO apt-get update + $SUDO apt-get $apt_quiet update case "$wxCONFIGURE_FLAGS" in *--with-directfb*) libtoolkit_dev='libdirectfb-dev' ;; @@ -67,7 +70,7 @@ case $(uname -s) in fi done - $SUDO apt-get install -y $pkg_install + $SUDO apt-get $apt_quiet install -y $pkg_install fi ;; From 4900c5e5b80932c71c1814a216d7288ada6642eb Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 23 Mar 2021 01:58:30 +0100 Subject: [PATCH 04/10] Don't use release-proposed repository for debug symbols This seems to be unnecessary, as -proposed is not used for the actual packages. --- build/tools/before_install.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build/tools/before_install.sh b/build/tools/before_install.sh index a0b49cccf5..f8b4c59658 100755 --- a/build/tools/before_install.sh +++ b/build/tools/before_install.sh @@ -16,8 +16,7 @@ case $(uname -s) in codename=$(lsb_release --codename --short) # Enable the `-dbgsym` repositories. echo "deb http://ddebs.ubuntu.com ${codename} main restricted universe multiverse - deb http://ddebs.ubuntu.com ${codename}-updates main restricted universe multiverse - deb http://ddebs.ubuntu.com ${codename}-proposed main restricted universe multiverse" | \ + deb http://ddebs.ubuntu.com ${codename}-updates main restricted universe multiverse" | \ $SUDO tee --append /etc/apt/sources.list.d/ddebs.list # Import the debug symbol archive signing key from the Ubuntu server. From bc7a7b0c2d5208dfd58462e2802225c22f4a979e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 23 Mar 2021 01:59:05 +0100 Subject: [PATCH 05/10] Hide confusing output from "tee --append" This is used to just append to the file, not actually to see the output of our own echo commands. --- build/tools/before_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/tools/before_install.sh b/build/tools/before_install.sh index f8b4c59658..6a5634bcef 100755 --- a/build/tools/before_install.sh +++ b/build/tools/before_install.sh @@ -17,7 +17,7 @@ case $(uname -s) in # Enable the `-dbgsym` repositories. echo "deb http://ddebs.ubuntu.com ${codename} main restricted universe multiverse deb http://ddebs.ubuntu.com ${codename}-updates main restricted universe multiverse" | \ - $SUDO tee --append /etc/apt/sources.list.d/ddebs.list + $SUDO tee --append /etc/apt/sources.list.d/ddebs.list >/dev/null # Import the debug symbol archive signing key from the Ubuntu server. # Note that this command works only on Ubuntu 18.04 LTS and newer. From d61719eddebdfa60b7c31c855962f4ce12a125b6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 23 Mar 2021 02:17:51 +0100 Subject: [PATCH 06/10] Show packages not being installed in the build log --- build/tools/before_install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/tools/before_install.sh b/build/tools/before_install.sh index 6a5634bcef..52c9befce9 100755 --- a/build/tools/before_install.sh +++ b/build/tools/before_install.sh @@ -66,6 +66,8 @@ case $(uname -s) in for pkg in $extra_deps; do if $(apt-cache pkgnames | grep -q $pkg) ; then pkg_install="$pkg_install $pkg" + else + echo "Not installing non-existent package $pkg" fi done From 9cb28353e7e04ceec3255cebd277975e9bb9ed86 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 23 Mar 2021 12:23:39 +0100 Subject: [PATCH 07/10] Add a helper function to run apt-get This simplifies the script and allows to log the commands in the build log. --- build/tools/before_install.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/build/tools/before_install.sh b/build/tools/before_install.sh index 52c9befce9..4dcea0450c 100755 --- a/build/tools/before_install.sh +++ b/build/tools/before_install.sh @@ -9,8 +9,13 @@ SUDO=sudo case $(uname -s) in Linux) if [ -f /etc/apt/sources.list ]; then - # Disable some (but not all) output. - apt_quiet='-q -o=Dpkg::Use-Pty=0' + run_apt() { + echo "Running apt-get $@" + + # Disable some (but not all) output. + $SUDO apt-get -q -o=Dpkg::Use-Pty=0 "$@" + + } if [ "$wxUSE_ASAN" = 1 ]; then codename=$(lsb_release --codename --short) @@ -21,7 +26,7 @@ case $(uname -s) in # Import the debug symbol archive signing key from the Ubuntu server. # Note that this command works only on Ubuntu 18.04 LTS and newer. - $SUDO apt-get $apt_quiet install -y ubuntu-dbgsym-keyring + run_apt install -y ubuntu-dbgsym-keyring # The key in the package above is currently (2021-03-22) out of # date, so get the latest key manually (this is completely @@ -32,7 +37,7 @@ case $(uname -s) in pkg_install='libfontconfig1-dbgsym libglib2.0-0-dbgsym libgtk-3-0-dbgsym libatk-bridge2.0-0-dbgsym' fi - $SUDO apt-get $apt_quiet update + run_apt update case "$wxCONFIGURE_FLAGS" in *--with-directfb*) libtoolkit_dev='libdirectfb-dev' ;; @@ -71,7 +76,7 @@ case $(uname -s) in fi done - $SUDO apt-get $apt_quiet install -y $pkg_install + run_apt install -y $pkg_install fi ;; From 51d796b88b657e409e995066bc6aea5e8497f407 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 23 Mar 2021 12:41:31 +0100 Subject: [PATCH 08/10] Exit on first error in the before_install script Any errors here are really fatal. --- build/tools/before_install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/tools/before_install.sh b/build/tools/before_install.sh index 4dcea0450c..0ad23f4d18 100755 --- a/build/tools/before_install.sh +++ b/build/tools/before_install.sh @@ -4,6 +4,8 @@ # wxWidgets but can also be run by hand if necessary but currently it only # works for Ubuntu versions used by Travis builds. +set -e + SUDO=sudo case $(uname -s) in From c4716991873ee5fb0960170a5c93a20e59b95c13 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 23 Mar 2021 12:57:40 +0100 Subject: [PATCH 09/10] Show apt sources and preferences used in the CI builds This may be useful to understand where do the packages come from. --- build/tools/before_install.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build/tools/before_install.sh b/build/tools/before_install.sh index 0ad23f4d18..e207adcc7c 100755 --- a/build/tools/before_install.sh +++ b/build/tools/before_install.sh @@ -11,6 +11,13 @@ SUDO=sudo case $(uname -s) in Linux) if [ -f /etc/apt/sources.list ]; then + # Show information about the repositories and priorities used. + echo 'APT sources used:' + $SUDO grep --no-messages '^[^#]' /etc/apt/sources.list /etc/apt/sources.list.d/* || true + echo 'APT preferences:' + $SUDO grep --no-messages '^[^#]' /etc/apt/preferences /etc/apt/preferences.d/* || true + echo '--- End of APT files dump ---' + run_apt() { echo "Running apt-get $@" From a47bb471650f5b1cfbedbd1a1676159499210590 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 23 Mar 2021 13:36:48 +0100 Subject: [PATCH 10/10] Disable leak detection if debug symbols are unavailable There just doesn't seem to be any way to make this work right now, so handle dbgsym packages installation failure and disable leak detection in this case. Hopefully ddebs.ubuntu.com repository will be updated in the future, allowing this to work again. --- .github/workflows/ci.yml | 11 +++++++++-- build/tools/before_install.sh | 15 +++++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de2e2d4f96..64d3f60653 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -222,8 +222,15 @@ jobs: if: matrix.skip_testing != true && matrix.skip_gui != true && matrix.use_xvfb run: | if [ ${{ matrix.use_asan }} ]; then - export LSAN_OPTIONS=suppressions=$(pwd)/misc/suppressions/lsan - export ASAN_OPTIONS=fast_unwind_on_malloc=0 + # Leak suppression only works if we have debug symbols available, + # otherwise we disable it to avoid tons of reports about leaks in + # libfontconfig etc. + if [ -f wx_dbgsym_available ]; then + export LSAN_OPTIONS=suppressions=$(pwd)/misc/suppressions/lsan + else + ASAN_OPTIONS=detect_leaks=0 + fi + export ASAN_OPTIONS="$ASAN_OPTIONS fast_unwind_on_malloc=0" fi pushd tests xvfb-run -a -s '-screen 0 1600x1200x24' ./test_gui diff --git a/build/tools/before_install.sh b/build/tools/before_install.sh index e207adcc7c..b85a98fe2e 100755 --- a/build/tools/before_install.sh +++ b/build/tools/before_install.sh @@ -43,7 +43,7 @@ case $(uname -s) in wget -O - http://ddebs.ubuntu.com/dbgsym-release-key.asc | $SUDO apt-key add - # Install the symbols to allow LSAN suppression list to work. - pkg_install='libfontconfig1-dbgsym libglib2.0-0-dbgsym libgtk-3-0-dbgsym libatk-bridge2.0-0-dbgsym' + dbgsym_pkgs='libfontconfig1-dbgsym libglib2.0-0-dbgsym libgtk-3-0-dbgsym libatk-bridge2.0-0-dbgsym' fi run_apt update @@ -85,7 +85,18 @@ case $(uname -s) in fi done - run_apt install -y $pkg_install + if ! run_apt install -y $pkg_install $dbgsym_pkgs; then + if [ -z "$dbgsym_pkgs" ]; then + exit $? + fi + + # Retry without dbgsym packages that currently fail to install + # under Ubuntu Focal (20.04). + echo 'Installing with dbgsym packages failed, retrying without...' + run_apt install -y $pkg_install + else + touch wx_dbgsym_available + fi fi ;;