Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 867010 - mail-filter/libmilter-1.0.2_p3-r2: Ebuild version 1.0.2_p3 does not match detected version * Extracted version (hex): 0x01000002
Summary: mail-filter/libmilter-1.0.2_p3-r2: Ebuild version 1.0.2_p3 does not match det...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2022-08-27 17:24 UTC by Ian Pickworth
Modified: 2022-11-26 22:05 UTC (History)
5 users (show)

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


Attachments
Patch for .../portage/mail-filter/libmilter/libmilter-1.0.2_p3-r2.ebuild (ebuild.patch,800 bytes, patch)
2022-08-27 17:33 UTC, Ian Pickworth
Details | Diff
/var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/temp/environment (environment,55.10 KB, text/plain)
2022-08-27 19:42 UTC, Ian Pickworth
Details
/etc/portage/bashrc (bashrc,157 bytes, text/plain)
2022-08-27 19:42 UTC, Ian Pickworth
Details
.bashrc (user-bashrc,900 bytes, text/plain)
2022-08-27 19:43 UTC, Ian Pickworth
Details
0001-mail-filter-libmilter-die-showing-einfo-declaration.patch (0001-mail-filter-libmilter-die-showing-einfo-declaration.patch,942 bytes, patch)
2022-08-27 19:55 UTC, Ionen Wolkens
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Pickworth 2022-08-27 17:24:12 UTC
The full build log showing the error is below.

The error is caused by the use of einfo calls in the local function extract_version_from_source()
einfo appears to also echo the text it is presented with, which results in incorrect value being returned in this call:

local actual_libmilter_ver_final=$(extract_version_from_source)

Error message then follows - which also shows the return string is not what is expected.

I will create a patch for the ebuild that uses elog instead - and solves the problem.

--------------- Build log -------------------

>>> Emerging (1 of 3) mail-filter/libmilter-1.0.2_p3-r2::gentoo
 * Fetching files in the background.
 * To view fetch progress, run in another terminal:
 * tail -f /var/log/emerge-fetch.log
 * sendmail.8.17.1.9.tar.gz BLAKE2B SHA512 size ;-) ...                  [ ok ]
>>> Unpacking source...
>>> Unpacking sendmail.8.17.1.9.tar.gz to /var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/work
>>> Source unpacked in /var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/work
>>> Preparing source in /var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/work/sendmail-8.17.1.9 ...
 * Applying sendmail-8.16.1-build-system.patch ...                       [ ok ]
 * Applying libmilter-sharedlib.patch ...                                [ ok ]
 * Ebuild version 1.0.2_p3 does not match detected version  * Extracted version (hex): 0x01000002
 * Extracted version (major): 1
 * Extracted version (minor): 0
 * Extracted version (plvl): 2
 * Extracted version (final): 1.0.2
1.0.2!
 * Expected version: 1.0.2
 * Detected version:  * Extracted version (hex): 0x01000002
 * Extracted version (major): 1
 * Extracted version (minor): 0
 * Extracted version (plvl): 2
 * Extracted version (final): 1.0.2
1.0.2
 * ERROR: mail-filter/libmilter-1.0.2_p3-r2::gentoo failed (prepare phase):
 *   Package version 1.0.2_p3 appears to be incorrect. Please check the source or rename the ebuild.
 *
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-08-27 17:25:54 UTC
I'm not sure I understand why this passes for me and not for you.

Could you include the full build.log (it has additional info at the top) and emerge --info?
Comment 2 Ian Pickworth 2022-08-27 17:33:38 UTC
Created attachment 801535 [details, diff]
Patch for .../portage/mail-filter/libmilter/libmilter-1.0.2_p3-r2.ebuild

Change einfo to elog in extract_version_from_source() function
Comment 3 Ian Pickworth 2022-08-27 17:35:13 UTC
After applying this patch, the build log is as follows:


>>> Emerging (1 of 3) mail-filter/libmilter-1.0.2_p3-r2::gentoo
 * Fetching files in the background.
 * To view fetch progress, run in another terminal:
 * tail -f /var/log/emerge-fetch.log
 * sendmail.8.17.1.9.tar.gz BLAKE2B SHA512 size ;-) ...                                                                      [ ok ]
>>> Unpacking source...
>>> Unpacking sendmail.8.17.1.9.tar.gz to /var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/work
>>> Source unpacked in /var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/work
>>> Preparing source in /var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/work/sendmail-8.17.1.9 ...
 * Applying sendmail-8.16.1-build-system.patch ...                                                                           [ ok ]
 * Applying libmilter-sharedlib.patch ...                                                                                    [ ok ]
 * Extracted version (hex): 0x01000002
 * Extracted version (major): 1
 * Extracted version (minor): 0
 * Extracted version (plvl): 2
 * Extracted version (final): 1.0.2
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/work/sendmail-8.17.1.9 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/work/sendmail-8.17.1.9 ...

.... etc ....
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-08-27 17:36:37 UTC
Can you attach the actual build.log emerge produces when it fails & include emerge --info?
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-08-27 17:40:03 UTC
(In reply to Sam James from comment #4)
> Can you attach the actual build.log emerge produces when it fails & include
> emerge --info?

(This would be useful anyway, but it's *especially* important given this makes 0 sense so far. See e.g. https://mgorny.pl/articles/the-ultimate-guide-to-eapi-7.html#output-commands-no-longer-pollute-stdout -- what the ebuild currently does should be fine.

We need to understand what's different about your environment.)
Comment 6 Ian Pickworth 2022-08-27 17:57:57 UTC
The output in the build log is what I posted, but here it is again.... in full.

* Package:    mail-filter/libmilter-1.0.2_p3-r2
 * Repository: gentoo
 * USE:        abi_x86_32 elibc_glibc ipv6 kernel_linux userland_GNU x86
 * FEATURES:   network-sandbox preserve-libs sandbox userpriv usersandbox
>>> Unpacking source...
>>> Unpacking sendmail.8.17.1.9.tar.gz to /var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/work
>>> Source unpacked in /var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/work
>>> Preparing source in /var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/work/sendmail-8.17.1.9 ...
 * Applying sendmail-8.16.1-build-system.patch ...
 [ ok ]
 * Applying libmilter-sharedlib.patch ...
 [ ok ]
 * Ebuild version 1.0.2_p3 does not match detected version  * Extracted version (hex): 0x01000002
 * Extracted version (major): 1
 * Extracted version (minor): 0
 * Extracted version (plvl): 2
 * Extracted version (final): 1.0.2
1.0.2!
 * Expected version: 1.0.2
 * Detected version:  * Extracted version (hex): 0x01000002
 * Extracted version (major): 1
 * Extracted version (minor): 0
 * Extracted version (plvl): 2
 * Extracted version (final): 1.0.2
1.0.2
 * ERROR: mail-filter/libmilter-1.0.2_p3-r2::gentoo failed (prepare phase):
 *   Package version 1.0.2_p3 appears to be incorrect. Please check the source or rename the ebuild.
 * 
 * Call stack:
 *     ebuild.sh, line 127:  Called src_prepare
 *   environment, line 1189:  Called die
 * The specific snippet of code:
 *           die "Package version ${PV} appears to be incorrect. Please check the source or rename the ebuild.";
 * 
 * If you need support, post the output of `emerge --info '=mail-filter/libmilter-1.0.2_p3-r2::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=mail-filter/libmilter-1.0.2_p3-r2::gentoo'`.
 * The complete build log is located at '/var/log/portage/mail-filter:libmilter-1.0.2_p3-r2:20220827-171107.log'.
 * For convenience, a symlink to the build log is located at '/var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/temp/environment'.
 * Working directory: '/var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/work/sendmail-8.17.1.9'
 * S: '/var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/work/sendmail-8.17.1.9'
~
Comment 7 Ian Pickworth 2022-08-27 17:59:12 UTC
And here is emerge --info

ian ~ # emerge --info
Portage 3.0.30 (python 3.10.6-final-0, default/linux/x86/17.0, gcc-11.3.0, glibc-2.35-r8, 5.19.4-gentoo i686)
=================================================================
System uname: Linux-5.19.4-gentoo-i686-AMD_EPYC_Processor_-with_IBPB-with-glibc2.35
KiB Mem:    31130000 total,  29070568 free
KiB Swap:    1048572 total,   1048572 free
Timestamp of repository gentoo: Fri, 26 Aug 2022 23:15:01 +0000
Head commit of repository gentoo: da1fee13a6026c0f6a5cd9d4c0d95ef6abe7a554
sh bash 5.1_p16-r1
ld GNU ld (Gentoo 2.38 p4) 2.38
app-misc/pax-utils:        1.3.4::gentoo
app-shells/bash:           5.1_p16-r1::gentoo
dev-lang/perl:             5.34.1-r3::gentoo
dev-lang/python:           3.10.6_p2::gentoo
dev-lang/rust-bin:         1.62.1::gentoo
dev-util/cmake:            3.22.4::gentoo
dev-util/meson:            0.62.2::gentoo
sys-apps/baselayout:       2.8::gentoo
sys-apps/openrc:           0.44.10::gentoo
sys-apps/sandbox:          2.29::gentoo
sys-devel/autoconf:        2.71-r1::gentoo
sys-devel/automake:        1.16.5::gentoo
sys-devel/binutils:        2.38-r2::gentoo
sys-devel/binutils-config: 5.4.1::gentoo
sys-devel/gcc:             11.3.0::gentoo
sys-devel/gcc-config:      2.5-r1::gentoo
sys-devel/libtool:         2.4.7::gentoo
sys-devel/make:            4.3::gentoo
sys-kernel/linux-headers:  5.15-r3::gentoo (virtual/os-headers)
sys-libs/glibc:            2.35-r8::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://ian2.pickworth.me.uk/gentoo-portage
    priority: -1000
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-metamanifest: no
    sync-rsync-extra-opts: 
    sync-rsync-verify-jobs: 1

private-overlay
    location: /usr/local/portage
    masters: gentoo
    priority: 0

Installed sets: @system
ACCEPT_KEYWORDS="x86"
ACCEPT_LICENSE="@FREE @FREE lha arj unRAR"
CBUILD="i586-pc-linux-gnu"
CFLAGS="-O2 -march=i586 -pipe -fomit-frame-pointer"
CHOST="i586-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/php/apache2-php8.0/ext-active/ /etc/php/apache2-php8.1/ext-active/ /etc/php/cgi-php8.0/ext-active/ /etc/php/cgi-php8.1/ext-active/ /etc/php/cli-php8.0/ext-active/ /etc/php/cli-php8.1/ext-active/ /etc/php/fpm-php8.0/ext-active/ /etc/php/fpm-php8.1/ext-active/ /etc/php/phpdbg-php8.0/ext-active/ /etc/php/phpdbg-php8.1/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -march=i586 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY 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"
FCFLAGS="-O2 -march=i686 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg-live clean-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms split-elog strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -march=i686 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_GB.iso88591"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j3"
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="acl apache2 bzip2 cli crypt dri fortran gdbm iconv ipv6 libglvnd libtirpc ncurses nls nocardbus nptl nptlonly openmp pam pcre readline seccomp split-usr sse ssl unicode vhosts virus-scan x86 xattr zlib" ABI_X86="32" ADA_TARGET="gnat_2020" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_aliasi unixd authn_core authz_core socache_shmcb" APACHE2_MPMS="event" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" 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" GRUB_PLATFORMS="coreboot pc" INPUT_DEVICES="libinput" KERNEL="linux" 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="php5-3 php5-4" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10" RUBY_TARGETS="ruby27" USERLAND="GNU" VIDEO_CARDS="amdgpu fbdev intel nouveau radeon radeonsi vesa dummy v4l" 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, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LEX, LFLAGS, LIBTOOL, LINGUAS, 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

ian ~ #
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-08-27 18:03:25 UTC
(In reply to Ian Pickworth from comment #6)
> The output in the build log is what I posted, but here it is again.... in
> full.

It wasn't, as the top row of repository/USE/FEATURES was missing. Thanks for including it.
Comment 9 Ian Pickworth 2022-08-27 18:05:54 UTC
(In reply to Sam James from comment #5)
> (In reply to Sam James from comment #4)
> > Can you attach the actual build.log emerge produces when it fails & include
> > emerge --info?
> 
> (This would be useful anyway, but it's *especially* important given this
> makes 0 sense so far. See e.g.
> https://mgorny.pl/articles/the-ultimate-guide-to-eapi-7.html#output-commands-
> no-longer-pollute-stdout -- what the ebuild currently does should be fine.
> 
> We need to understand what's different about your environment.)

Well, they are not being output to stdout, so the documentation is correct.

They are, however, being "returned", since the function uses and "echo" to return its value - all the einfo messages are pre-pended to that.

Not a bash expert - but perhaps "return" would have been a better coding choice rather than "echo".
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-08-27 18:07:44 UTC
(In reply to Ian Pickworth from comment #9)
> (In reply to Sam James from comment #5)
> > (In reply to Sam James from comment #4)
> > > Can you attach the actual build.log emerge produces when it fails & include
> > > emerge --info?
> > 
> > (This would be useful anyway, but it's *especially* important given this
> > makes 0 sense so far. See e.g.
> > https://mgorny.pl/articles/the-ultimate-guide-to-eapi-7.html#output-commands-
> > no-longer-pollute-stdout -- what the ebuild currently does should be fine.
> > 
> > We need to understand what's different about your environment.)
> 
> Well, they are not being output to stdout, so the documentation is correct.
> 
> They are, however, being "returned", since the function uses and "echo" to
> return its value - all the einfo messages are pre-pended to that.
> 

Note that it talks about command substitution though -- that page
gives an example which should be equivalent to what we're doing here.

It also doesn't answer why it works for me, although we've had odd
Bash portability problems before. I'll dig out an i586 chroot.

Any other immediate ideas you have about what makes your environment
interesting? I don't suppose you have any other installs to test with?

> Not a bash expert - but perhaps "return" would have been a better coding
> choice rather than "echo".

return can only handle exit codes in bash, unfortunately.
Comment 11 Ionen Wolkens gentoo-dev 2022-08-27 18:10:50 UTC
Just in case, any custom /etc/portage/bashrc? Could optionally attach:

/var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/temp/environment

(albeit note it'll have your full environment, alternatively least grep ^einfo)

>Not a bash expert - but perhaps "return" would have been a better coding choice rather than "echo".
As noted above. Alternatively a function "can" set variables that will still be visible after, but that can get rather confusing. Using echo for this is rather standard.
Comment 12 Ionen Wolkens gentoo-dev 2022-08-27 19:02:47 UTC
I might add that elog and einfo work the same way, the only difference I can see is that one sets a different log level that portage will use /later/ for post-emerge messages, and so it changes nothing for that function.

If elog works for you, then I don't really an explanation other than having something somewhere that overrides einfo.
Comment 13 Ian Pickworth 2022-08-27 19:42:11 UTC
Created attachment 801547 [details]
/var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/temp/environment

Full contents of this file following a failed emerge.
Comment 14 Ian Pickworth 2022-08-27 19:42:57 UTC
Created attachment 801550 [details]
/etc/portage/bashrc

System bashrc file
Comment 15 Ian Pickworth 2022-08-27 19:43:49 UTC
Created attachment 801553 [details]
.bashrc

.bashrc for the user that portage runs under when emerging.
Comment 16 Ian Pickworth 2022-08-27 19:47:58 UTC
(In reply to Sam James from comment #10)
> Any other immediate ideas you have about what makes your environment
> interesting? I don't suppose you have any other installs to test with?

The first line in my emerge log - this is an old 32 bit install:

    Sat Apr 10 01:13:07 2004 >>> sys-apps/portage-2.0.50-r3

I do not recall doing anything with it since 2004 to modify the behaviour of portage or any of it's libraries or functions. For the most part I have kept at stable packages only - except where I need things that are arch masked.
Comment 17 Ian Pickworth 2022-08-27 19:51:38 UTC
(In reply to Ionen Wolkens from comment #11)
> Just in case, any custom /etc/portage/bashrc? Could optionally attach:
> 
> /var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/temp/environment
> 
> (albeit note it'll have your full environment, alternatively least grep
> ^einfo)
> 

I've attached both bashrc files relevant, and the environment file your quoted *after* a failed build (it gets deleted on a successful build).

Output from
 grep ^einfo /var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/temp/environment
is null.

Output from 
 grep einfo /var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/temp/environment
is:
ian ~ # grep einfo /var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/temp/environment
            einfo "Applying patches from ${f} ...";
                    einfo "${PORTAGE_COLOR_INFO}$(for ((column = 0; column < ${columns} - 3; column++)); do echo -n =; done)${PORTAGE_COLOR_NORMAL}";
                    einfo "Applying user patches from ${basedir} ...";
        einfo "User patches applied.";
        einfo "${PORTAGE_COLOR_INFO}$(for ((column = 0; column < ${columns} - 3; column++)); do echo -n =; done)${PORTAGE_COLOR_NORMAL}";
        einfo "Extracted version (hex): ${actual_libmilter_ver}";
        einfo "Extracted version (major): ${actual_libmilter_ver_major}";
        einfo "Extracted version (minor): ${actual_libmilter_ver_minor}";
        einfo "Extracted version (plvl): ${actual_libmilter_ver_plvl}";
        einfo "Extracted version (final): ${actual_libmilter_ver_major}.${actual_libmilter_ver_minor}.${actual_libmilter_ver_plvl}";
ian ~ #
Comment 18 Ionen Wolkens gentoo-dev 2022-08-27 19:55:43 UTC
Created attachment 801556 [details, diff]
0001-mail-filter-libmilter-die-showing-einfo-declaration.patch

Could you try to emerge libmilter with the following patch? It'll die showing what einfo is declared as.

My suspicion is that it could be reading from files from a old portage install, perhaps in /usr/local
Comment 19 Ian Pickworth 2022-08-27 20:00:16 UTC
I have a 64-bit system that is a bit newer (first build log entry):

  Sun Mar 27 00:04:13 2016 >>> sys-devel/bc-1.06.95-r1

On this system, mail-filter/libmilter-1.0.2_p3-r2 builds without problems.
Comment 20 Ian Pickworth 2022-08-27 20:07:30 UTC
(In reply to Ionen Wolkens from comment #18)
> Created attachment 801556 [details, diff] [details, diff]
> 0001-mail-filter-libmilter-die-showing-einfo-declaration.patch
> 
> Could you try to emerge libmilter with the following patch? It'll die
> showing what einfo is declared as.
> 
> My suspicion is that it could be reading from files from a old portage
> install, perhaps in /usr/local

Applied the patch and got this when emerging:

an ~ # emerge  --oneshot =mail-filter/libmilter-1.0.2_p3-r2
Calculating dependencies... done!

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) mail-filter/libmilter-1.0.2_p3-r2::gentoo
 * sendmail.8.17.1.9.tar.gz BLAKE2B SHA512 size ;-) ...                                 [ ok ]
>>> Unpacking source...
>>> Unpacking sendmail.8.17.1.9.tar.gz to /var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/work
>>> Source unpacked in /var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/work
>>> Preparing source in /var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/work/sendmail-8.17.1.9 ...
 * Applying sendmail-8.16.1-build-system.patch ...                                      [ ok ]
 * Applying libmilter-sharedlib.patch ...                                               [ ok ]
 * ERROR: mail-filter/libmilter-1.0.2_p3-r2::gentoo failed (prepare phase):
 *   einfo () 
{ 
    enotice info "${*}"
}
 * 
 * Call stack:
 *     ebuild.sh, line 127:  Called src_prepare
 *   environment, line 1171:  Called die
 * The specific snippet of code:
 *       die "$(declare -f einfo)";
 * 
 * If you need support, post the output of `emerge --info '=mail-filter/libmilter-1.0.2_p3-r2::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=mail-filter/libmilter-1.0.2_p3-r2::gentoo'`.
 * The complete build log is located at '/var/log/portage/mail-filter:libmilter-1.0.2_p3-r2:20220827-200435.log'.
 * For convenience, a symlink to the build log is located at '/var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/temp/environment'.
 * Working directory: '/var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/work/sendmail-8.17.1.9'
 * S: '/var/tmp/portage/mail-filter/libmilter-1.0.2_p3-r2/work/sendmail-8.17.1.9'

>>> Failed to emerge mail-filter/libmilter-1.0.2_p3-r2, Log file:

>>>  '/var/log/portage/mail-filter:libmilter-1.0.2_p3-r2:20220827-200435.log'
ian ~ #
Comment 21 Ian Pickworth 2022-08-27 20:10:38 UTC
Saw the "enotice" and whent and found it in the environment file:

enotice () 
{ 
    local color;
    local type;
    type="${1}";
    case "${type}" in 
        "info")
            color="${GOOD}"
        ;;
        "warn")
            color="${WARN}"
        ;;
        "error")
            color="${BAD}"
        ;;
    esac;
    shift;
    if [ ! -z "${PORT_ENOTICE_DIR}" ]; then
        echo "${type}:${*}" >> ${PORT_ENOTICE_DIR}/${PF};
    fi;
    echo " ${color}*${NORMAL} ${*}"
}


Looks like the culprit?
Comment 22 Ian Pickworth 2022-08-27 20:13:45 UTC
I modified your patch to show the definition of elog, and it gave this:

 * ERROR: mail-filter/libmilter-1.0.2_p3-r2::gentoo failed (prepare phase):
 *   elog () 
{ 
    __elog_base LOG "$*";
    [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo 1>&2;
    echo -e "$@" | while read -r; do
        echo " ${PORTAGE_COLOR_LOG}*${PORTAGE_COLOR_NORMAL} ${REPLY}" 1>&2;
    done;
    LAST_E_CMD="elog";
    return 0
}
 * 
 * Call stack:
 *     ebuild.sh, line 127:  Called src_prepare
 *   environment, line 1171:  Called die


So, in my case this explains the difference, but not why it exists :-(
Comment 23 Ionen Wolkens gentoo-dev 2022-08-27 20:16:00 UTC
Yeah, einfo is supposed to look much the same:

 *   einfo () 
 * { 
 *     __elog_base INFO "$*";
 *     [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo 1>&2;
 *     echo -e "$@" | while read -r; do
 *         echo " ${PORTAGE_COLOR_INFO}*${PORTAGE_COLOR_NORMAL} ${REPLY}" 1>&2;
 *     done;
 *     LAST_E_CMD="einfo";
 *     return 0
 * }

The 1>&2 sends the echo to stderr, so it's not captured. There is no reference to enotice in portage, so it's coming from somewhere else.
Comment 24 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-08-27 20:21:39 UTC
grep -rsin "enotice" /etc/portage /etc/make.conf as a start?

https://web.archive.org/web/20090219233847/http://www.gentoo.org:80/doc/en/handbook/handbook-x86.xml?full=1 mentions it:
>Important: If you used enotice with Portage-2.0.*, you must completely remove >enotice, as it is incompatible with elog. 

I can't find what enotice actually as (as in a proper source) yet though.
Comment 25 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-08-27 20:25:25 UTC
(In reply to Sam James from comment #24)
> grep -rsin "enotice" /etc/portage /etc/make.conf as a start?
> 
> https://web.archive.org/web/20090219233847/http://www.gentoo.org:80/doc/en/
> handbook/handbook-x86.xml?full=1 mentions it:
> >Important: If you used enotice with Portage-2.0.*, you must completely remove >enotice, as it is incompatible with elog. 
> 
> I can't find what enotice actually as (as in a proper source) yet though.

bug 11359 has some details on what enotice is and how apparently one would install it. http://www.wikigentoo.ksiezyc.pl/Dell_Precision_690_Part_3.htm references it a bit too.
Comment 26 Ian Pickworth 2022-08-27 20:36:47 UTC
(In reply to Sam James from comment #24)
> grep -rsin "enotice" /etc/portage /etc/make.conf as a start?

That uncovers this file: /etc/portage/profile/profile.bashrc

Contents:

ian ~ # cat /etc/portage/profile/profile.bashrc
if [ "$EBUILD_PHASE" != "depend" ]; then
	if [ ! -z "${PORT_ENOTICE_DIR}" ]; then
		export SANDBOX_WRITE="$SANDBOX_WRITE:${PORT_ENOTICE_DIR}"
		install -d "${PORT_ENOTICE_DIR}" &>/dev/null
		chown root:portage "${PORT_ENOTICE_DIR}" &>/dev/null
		chmod g+rwxs "${PORT_ENOTICE_DIR}" &>/dev/null
		if  [ "$EBUILD_PHASE" == "unpack" ]; then
			rm -f ${PORT_ENOTICE_DIR}/${PF}
		fi
	fi
fi

einfo() {
	enotice info "${*}"
}

ewarn() {
	enotice warn "${*}"
}

eerror()
{
	enotice error "${*}"
}

enotice()
{
	local color
	local type

	type="${1}"

	case "${type}" in
		"info")
			color="${GOOD}"
			;;
		"warn")
			color="${WARN}"
			;;
		"error")
			color="${BAD}"
			;;
	esac

	shift

	if [ ! -z "${PORT_ENOTICE_DIR}" ]; then
		echo "${type}:${*}" >> ${PORT_ENOTICE_DIR}/${PF}
	fi
	echo " ${color}*${NORMAL} ${*}"
}
ian ~ # 

So, there it is. Date on the file is Nov 10  2004, so it's been there from the very beginning of this Gentoo install.

I'll try removing it, and see what happens.....
Comment 27 Ian Pickworth 2022-08-27 20:48:59 UTC
Removing the file:

  /etc/portage/profile/profile.bashrc

allowed the ebuild to emerge successfully.

There is no package in portage today that claims ownership of this file. Since the file date in 2004, it must have been part of the portage version at the time. I would remember creating such an elaborate bash file - I don't do bash scripts often (perl man myself).

It is possible that on one of the many upgrades to portage over the years either should have deleted this, or maybe told me to delete it and I missed it.

So this could be a very elaborate and old user error.

Sorry for the bother chaps.

Footnote: Is there any documentation about what can be used in the /etc/portage/profile path? Interesting that it will pick up things to override eclasses (or at least looks that way).
Comment 28 Ionen Wolkens gentoo-dev 2022-08-27 21:22:56 UTC
(In reply to Ian Pickworth from comment #27)
> Footnote: Is there any documentation about what can be used in the
> /etc/portage/profile path? Interesting that it will pick up things to
> override eclasses (or at least looks that way).
Well bashrc can override any bash functions, /etc/portage/bashrc could've overriden that einfo as well and that's why I asked. But I didn't think about profile/ I admit.

It can have same things that can be used in /usr/portage/gentoo/profiles as it's meant for profile overrides (PMS[1] describes some but profile.bashrc is a bit more on the unofficial side as I understand it), typical use is to unforce/mask USE flags, like a /etc/portage/profile/use.stable.mask with -cuda to allow cuda USE in stable.

Typically users don't need to touch that directory, but I can see ancient stuff and practices from 2004 doing this :) Any files in there that you don't recognize probably doesn't belong, (albeit crossdev does make use of it for one).

[1] https://projects.gentoo.org/pms/8/pms.html#x1-410005
Comment 29 Nico Baggus 2022-11-25 11:57:57 UTC
Same issue, 
The profile.bashrc is also is on a system that was setup (original) in 2012, with a date in 2012.

So it is more recent than 2012, july 1st.
Comment 30 Larry the Git Cow gentoo-dev 2022-11-26 22:05:09 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=56444ec8f0916a5a2881d888aae9a8082cf87ac5

commit 56444ec8f0916a5a2881d888aae9a8082cf87ac5
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2022-11-26 17:00:05 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2022-11-26 22:04:18 +0000

    sys-apps/portage: warn about obsolete enotice in profile.bashrc
    
    Closes: https://bugs.gentoo.org/867010
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 .../{portage-3.0.38.1-r3.ebuild => portage-3.0.38.1-r4.ebuild} | 10 ++++++++++
 .../{portage-3.0.39-r1.ebuild => portage-3.0.39-r2.ebuild}     | 10 ++++++++++
 sys-apps/portage/portage-9999.ebuild                           | 10 ++++++++++
 3 files changed, 30 insertions(+)