Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 906046 - net-vpn/tor-0.4.7.13-r1 allow package.env override of -DNDEBUG
Summary: net-vpn/tor-0.4.7.13-r1 allow package.env override of -DNDEBUG
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal enhancement
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-09 23:13 UTC by Joe Harvell
Modified: 2023-05-10 01:37 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
patch (file_906046.txt,770 bytes, patch)
2023-05-09 23:15 UTC, Joe Harvell
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joe Harvell 2023-05-09 23:13:50 UTC
If -DNDEBUG is in CFLAGS from make.conf, tor refuses to build due to a check with the following logic in src/lib/log/util_debug.h:

#ifdef NDEBUG
#error Sorry, building with -DNDEBUG not supported
#endif

This check does not allow a package.env override where -DNDEBUG=0 is added to CFLAGS, CXXFLAGS, etc. at the end.

The preprocessor behaves exactly the same for #ifdef X and #if X when the command line passes -DX=0.  However, the logic above rejects a compile command line with -DNDEBUG followed by -DNDEBUG=0 becuase NDEBUG is in fact defined.  Changing the check to #if NDEBUG gives identical behavior while also allowing override in package.env

Reproducible: Always

Steps to Reproduce:
1. Add -DNDEBUG to CFLAGS in /etc/portage/make.conf
2. Add override in package.env where -DNDEBUG=0 is appended to CFLAGS for package net-vpn/tor
2. emerge -1 net-vpn/tor
Actual Results:  
emerge fails with message saying -DNDEBUG is not supported

Expected Results:  
emerge succeeds and net-vpn/tor is build such that asserts are enabled

$ emerge --info
Portage 3.0.47 (python 3.11.3-final-0, default/linux/amd64/17.1/desktop/plasma/systemd, gcc-13, glibc-2.37-r2, 6.2.14-jchlb-bf3a8f460f37+ x86_64)
=================================================================
System uname: Linux-6.2.14-jchlb-bf3a8f460f37+-x86_64-Intel-R-_Xeon-R-_CPU_E5-2630_0_@_2.30GHz-with-glibc2.37
KiB Mem:    32861232 total,  23572972 free
KiB Swap:   16777208 total,  16777208 free
Timestamp of repository gentoo: Fri, 05 May 2023 15:45:01 +0000
Head commit of repository gentoo: 77d0eefea33fd059875e65c9f241d4a9e65147aa
sh bash 5.2_p15-r2
ld GNU ld (Gentoo 2.40 p4) 2.40.0
ccache version 4.8 [disabled]
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p15-r2::gentoo
dev-java/java-config:      2.3.1::gentoo
dev-lang/perl:             5.36.1-r1::gentoo
dev-lang/python:           2.7.18_p15::gentoo, 3.6.12-r2::gentoo, 3.7.8-r2::gentoo, 3.8.12_p2::gentoo, 3.9.10_p1::gentoo, 3.10.11::gentoo, 3.11.3::gentoo
dev-lang/rust:             1.69.0-r1::gentoo
dev-util/ccache:           4.8::gentoo
dev-util/cmake:            3.26.3::gentoo
dev-util/meson:            1.1.0::gentoo
sys-apps/baselayout:       2.13-r1::gentoo
sys-apps/sandbox:          2.30-r1::gentoo
sys-apps/systemd:          253.4::gentoo
sys-devel/autoconf:        2.13-r8::gentoo, 2.69-r5::gentoo, 2.71-r6::gentoo
sys-devel/automake:        1.13.4-r2::gentoo, 1.16.5-r1::gentoo
sys-devel/binutils:        2.36.1-r1::gentoo, 2.37_p1-r1::gentoo, 2.40-r4::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/clang:           10.0.0::gentoo, 11.0.1::gentoo, 12.0.1::gentoo, 13.0.0::gentoo, 15.0.7-r1::gentoo, 16.0.3::gentoo
sys-devel/gcc:             13.1.0-r1::gentoo
sys-devel/gcc-config:      2.10::gentoo
sys-devel/libtool:         2.4.7-r1::gentoo
sys-devel/llvm:            15.0.7::gentoo, 16.0.3::gentoo
sys-devel/make:            4.4.1::gentoo
sys-kernel/linux-headers:  6.3::gentoo (virtual/os-headers)
sys-libs/glibc:            2.37-r2::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.us.gentoo.org/gentoo-portage
    priority: -1000
    volatile: True
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-max-age: 24
    sync-rsync-extra-opts: 
    sync-rsync-verify-metamanifest: yes

crossdev
    location: /opt/portage/crossdev
    masters: gentoo
    volatile: True

wolfhound
    location: /opt/portage/wolfhound
    masters: gentoo
    volatile: True

brave-overlay
    location: /var/lib/layman/brave-overlay
    sync-type: laymansync
    sync-uri: https://gitlab.com/jason.oliveira/brave-overlay.git
    masters: gentoo
    priority: 50
    volatile: True

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O3 -DNDEBUG -pipe -march=native -ggdb -flto=26 -floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block -ftree-vectorize"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /etc/stunnel/stunnel.conf /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/maven-bin-3.6/conf /usr/share/maven-bin-3.8/conf /usr/share/maven-bin-3.9/conf"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O3 -DNDEBUG -pipe -march=native -ggdb -flto=26 -floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block -ftree-vectorize"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--jobs=26 --load-average 20.0 --accept-properties=-interactive"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox preserve-libs qa-unresolved-soname-deps sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-flto=26 -O3 -fuse-ld=gold -fuse-linker-plugin"
LEX="flex"
LINGUAS="fr en"
MAKEOPTS="--jobs=26 --load-average=20.0"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="X a52 aac acl acpi activities alsa amd64 bash-completion bidi bluetooth branding bzip2 c++0x cairo caps cdda cdr cjk cli crypt cups dbus declarative dri dts dvd dvdr egl encode exif filecaps flac fontconfig foomaticdb fortran ftp gdbm geoip gif gimp gles gles2 gnome-keyring gnuplot gnutls google gpm gtk gui gzip hddtemp iconv icq icu idn imap inotify iproute2 ipv6 jabber java java6 javascript jingle jit jpeg jpeg2k kde kontact kwallet lame lcms ldap libglvnd libnotify libtirpc lm_sensors lzma mad mime mms mmx mng mono mozilla mp3 mp4 mpeg mplayer msn multilib mysql mysqli ncurses nfsv41 nis nls nptl nsplugin numa odbc offensive ogg opengl openmp oscar pam pango pcntl pcre pdf perl php plasma png policykit posix postscript ppds pulseaudio python qml qt3support qt5 quicktime rdesktop readline rss ruby sasl sdl seccomp semantic-desktop smp sound spell split-usr sse sse2 sse3 sse4 sse4_1 ssl ssse3 startup-notification suid svg syslog systemd sysvipc tcmalloc test-rust threads tiff truetype udev udisks unicode upower usb vdpau vnc vorbis widgets win32codecs wxwidgets x264 xattr xcb xft xinerama xinetd xml xmpp xv xvid yahoo zlib" ABI_X86="64" ADA_TARGET="gnat_2021" ALSA_CARDS="hda-intel" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput evdev" KERNEL="linux" L10N="fr_FR fr en_US en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_9 python3_10 python3_11" RUBY_TARGETS="ruby31 ruby32" USERLAND="GNU" VIDEO_CARDS="nouveau radeon" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-05-09 23:15:14 UTC
Couldn't you do -UNDEBUG in package.env?

Anyway, this needs to be reported upstream. Could you do that?
Comment 2 Joe Harvell 2023-05-09 23:15:55 UTC
Created attachment 861409 [details, diff]
patch
Comment 3 Joe Harvell 2023-05-09 23:23:33 UTC
(In reply to Sam James from comment #1)
> Couldn't you do -UNDEBUG in package.env?
> 
> Anyway, this needs to be reported upstream. Could you do that?

I was unaware of this preprocessor option.  Thanks.  Please close the bug report.
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-05-10 01:37:29 UTC
No worries, thank you!