Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 371447

Summary: sys-apps/portage: emerge should use FETCHCOMMAND when downloading binary packages
Product: Portage Development Reporter: Jason Waldhelm <jason>
Component: Core - ConfigurationAssignee: Portage team <dev-portage>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: Normal    
Version: 2.2   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Jason Waldhelm 2011-06-13 18:15:17 UTC
emerge seems to ignore --bind-address= wget option when placed in the FETCHCOMMAND or RESUMECOMMAND (/etc/make.conf).  I've also placed bind_address= in /etc/wgetrc and in ~/.wgetrc with the same result (the option seems to be ignored).  The FTP traffic still appears to be coming from the eth0 address instead of the ip address i specify using the bind_address or --bind-address option.  I am using a BINHOST if that matters.

Reproducible: Always

Steps to Reproduce:
1. Set --bind-address (via FETCHCOMMAND) or bind_address in wgetrc files
2. Watch the fetch traffic not come from the ip address you want
3.



Portage 2.2.0_alpha40 (hardened/linux/amd64, gcc-4.5.2, glibc-2.11.3-r0, 2.6.38-hardened-r6 x86_64)
=================================================================
System uname: Linux-2.6.38-hardened-r6-x86_64-Intel-R-_Atom-TM-_CPU_D510_@_1.66GHz-with-gentoo-2.0.2
Timestamp of tree: Mon, 13 Jun 2011 10:00:01 +0000
app-shells/bash:          4.2_p10
dev-lang/python:          2.7.1-r1, 3.1.3-r1, 3.2
sys-apps/baselayout:      2.0.2
sys-apps/openrc:          0.8.2-r1
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.68
sys-devel/automake:       1.11.1-r1
sys-devel/binutils:       2.21
sys-devel/gcc:            4.4.4-r2, 4.5.2
sys-devel/gcc-config:     1.4.1-r1
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82
sys-kernel/linux-headers: 2.6.38 (virtual/os-headers)
sys-libs/glibc:           2.11.3
Repositories: gentoo x-portage
Installed sets: 
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -fomit-frame-pointer -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /var/www/localhost/htdocs"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -fomit-frame-pointer -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles fixpackages getbinpkg news nodoc noinfo noman parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j5"
PKGDIR="/var/tmp/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="--address=172.31.1.1"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://gary/gentoo-portage"
USE="acl amd64 apache2 bash-completion berkdb bzip2 cli cracklib crypt cxx dba dri fastcgi gd gdbm gpm hardened iconv imap ipv6 justify logrotate maildir mcal mmx modules mudflap multilib ncurses nls nptl nptlonly openmp pam pcre pear perl postgres pppd prelude python readline sasl session spell spf srs sse sse2 ssl sysfs tcpd tidy truetype urandom xml xml2 xmlrpc xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" 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 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_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" APACHE2_MPMS="prefork" CALLIGRA_FEATURES="braindump flow karbon kexi kpresenter krita tables words" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga neomagic nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS
Comment 1 Zac Medico gentoo-dev 2011-06-13 23:48:03 UTC
The binhost code doesn't use FETCHCOMMAND to fetch the package metadata. Instead, it uses python's urlopen function, so maybe that's that source of your trouble. 

When actually fetching the binary packages themselves (not the metadata), FETCHCOMMAND is use.
Comment 2 Jason Waldhelm 2011-06-14 13:42:17 UTC
Then has something changed in the handling of this between 2.2.0_alpha6 and _alpha40?  I have machines using the same BINHOST configuration on _alpha6 that work just fine.
Comment 3 Zac Medico gentoo-dev 2011-06-14 16:31:51 UTC
Nothing has really changed. However, this fallback code was added which calls FETCHCOMMAND_$PROTOCOL if urlopen fails:

http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=53f096c5d72dd15336fdf921f29ceae9b5842148

If the behavior has changed, it might be due to upgrading to a new version of python with different urlopen behavior.
Comment 4 Jason Waldhelm 2011-06-14 17:09:11 UTC
The working one is on python-2.6 and the "broken" is on python-2.7
Comment 5 Zac Medico gentoo-dev 2011-06-14 17:48:19 UTC
As a workaround, you might be able to use the FETCHCOMMAND_$PROTOCOL fallback that I mentioned in comment #3. In order to do that, you can define FETCHCOMMAND_HTTP=${FETCHCOMMAND} in make.conf (or do that for whatever protocol you happen to be using).
Comment 6 Jason Waldhelm 2011-06-16 09:56:45 UTC
I must not be doing something properly.

I added to make.conf:
FETCHCOMMAND_FTP=${FETCHCOMMAND}

and added "--bind-address=172.31.1.1" to FETCHCOMMAND, yet still have problems.

I'm not sure I'm understanding how to set FETCHCOMMAND_* correctly.
Comment 7 Zac Medico gentoo-dev 2020-09-06 18:43:57 UTC
FETCHCOMMAND has been mostly ignored since we added Package index support in 2007:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=00152eff9e23a6a6f0efb226c3f234bcd9c20865

For awhile we did use FETCHCOMMAND_HTTPS for versions of python that did not support certificate/hostname verification (bug 668302):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=b5969af9f575e4e4b669f44e76ad01f0dbc2dd27

Marking as a duplicate of bug 668302 since there's newer discussion there.

*** This bug has been marked as a duplicate of bug 668302 ***