Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 650754 - emerge --info is broken without git installed if PORTDIR is a git checkout and sync-type = git
Summary: emerge --info is broken without git installed if PORTDIR is a git checkout an...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - External Interaction (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 651804
  Show dependency tree
 
Reported: 2018-03-17 20:46 UTC by Georgy Yakovlev
Modified: 2018-07-02 18:51 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Georgy Yakovlev gentoo-dev 2018-03-17 20:46:10 UTC
Hi,


If I run portage --info in a chroot which has git-synced repo configured, but no git installed I get the following:

(CHROOT) hostname ~ # which git
which: no git in (/usr/x86_64-pc-linux-gnu/gcc-bin/7.3.0:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin)

(CHROOT) hostname ~ # emerge --info
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.5/emerge", line 50, in <module>
    retval = emerge_main()
  File "/usr/lib64/python3.5/site-packages/_emerge/main.py", line 1264, in emerge_main
    return run_action(emerge_config)
  File "/usr/lib64/python3.5/site-packages/_emerge/actions.py", line 3256, in run_action
    emerge_config.trees, emerge_config.opts, valid_atoms)
  File "/usr/lib64/python3.5/site-packages/_emerge/actions.py", line 1654, in action_info
    head_commit = sync.retrieve_head(options=options)
  File "/usr/lib64/python3.5/site-packages/portage/sync/modules/git/git.py", line 142, in retrieve_head
    cwd=portage._unicode_encode(self.repo.location))))
  File "/usr/lib64/python3.5/subprocess.py", line 316, in check_output
    **kwargs).stdout
  File "/usr/lib64/python3.5/subprocess.py", line 383, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib64/python3.5/subprocess.py", line 676, in __init__
    restore_signals, start_new_session)
  File "/usr/lib64/python3.5/subprocess.py", line 1211, in _execute_child
    executable = os.fsencode(executable)
  File "/usr/lib64/python3.5/os.py", line 864, in fsencode
    raise TypeError("expect bytes or str, not %s" % type(filename).__name__)
TypeError: expect bytes or str, not NoneType


obviously it.s git.py 


Consider this scenario:

/var/db/repos is a filesystem 

/mnt/gentoo is a chroot with a stage unpacked

/var/db/repos bind mounted to /mnt/gentoo/var/db/repos

/etc/portage/repos.conf/gentoo.conf is copied to /mnt/gentoo/etc/portage/repos.conf as is:

portageq repos_config /

[DEFAULT]
auto-sync = yes
main-repo = gentoo
strict-misc-digests = true

[gentoo]
auto-sync = yes
eclass-overrides = 
location = /var/db/repos/gentoo
masters = 
priority = -1000
strict-misc-digests = true
sync-openpgp-key-path = /var/lib/gentoo/gkeys/keyrings/gentoo/release/pubring.gpg
sync-type = git
sync-uri = https://github.com/gentoo-mirror/gentoo.git



I build-test something in a chroot, it fails, I need to report a bug and run emerge --info
I'll get above error.


It's possible to make emerge --info work by setting sync-type to rsync, so it's a workaround.



However I thought maybe it should fail gracefully instead or check presence of git executable before trying retrieve_head() if sync-type = git.


Reproducible: Always




Portage 2.3.24 (python 3.5.4-final-0, default/linux/amd64/17.0, gcc-7.3.0, glibc-2.26-r6, 4.15.10-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.15.10-gentoo-x86_64-AMD_Ryzen_Threadripper_1950X_16-Core_Processor-with-gentoo-2.4.1
KiB Mem:    65886912 total,  41228488 free
KiB Swap:    8388600 total,   8388600 free
Timestamp of repository gentoo: Sat, 17 Mar 2018 18:31:50 +0000
sh bash 4.4_p19
ld GNU ld (Gentoo 2.30 p1) 2.30.0
app-shells/bash:          4.4_p19::gentoo
dev-lang/perl:            5.26.1-r2::gentoo
dev-lang/python:          2.7.14-r1::gentoo, 3.5.4-r1::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.4.1-r2::gentoo
sys-apps/openrc:          0.35.5::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.69-r4::gentoo
sys-devel/automake:       1.16.1-r1::gentoo
sys-devel/binutils:       2.30::gentoo
sys-devel/gcc:            7.3.0::gentoo
sys-devel/gcc-config:     1.9.1::gentoo
sys-devel/libtool:        2.4.6-r4::gentoo
sys-devel/make:           4.2.1-r3::gentoo
sys-kernel/linux-headers: 4.15::gentoo (virtual/os-headers)
sys-libs/glibc:           2.26-r6::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: https://github.com/gentoo-mirror/gentoo.git
    priority: -1000
    sync-rsync-verify-metamanifest: no
    sync-rsync-extra-opts: 

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/var/cache/portage/distfiles"
EMERGE_DEFAULT_OPTS="--ask-enter-invalid --jobs=16  --load-average 32"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs buildpkg cgroup collision-protect config-protect-if-modified distlocks downgrade-backup ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch parallel-install preserve-libs protect-owned sandbox sfperms sign strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="https://gentoo.osuosl.org/ http://gentoo.mirrors.pair.com/ http://mirrors.rit.edu/gentoo/ http://cosmos.illinois.edu/pub/gentoo/ http://mirror.lug.udel.edu/pub/gentoo/ http://lug.mtu.edu/gentoo/"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en"
MAKEOPTS="-j32 -l32"
PKGDIR="/var/cache/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="/tmp"
USE="acl amd64 bash-completion berkdb branding bzip2 cli crypt cxx dri fortran gdbm iconv ipv6 libressl lzma modules multilib ncurses nls nptl openmp pam pcre readline seccomp ssl tcpd unicode xattr zlib" ABI_X86="64" 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="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2 fuji" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" CURL_SSL="libressl" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-0" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python2_7 python3_5" RUBY_TARGETS="ruby22 ruby23" USERLAND="GNU" VIDEO_CARDS="amdgpu radeon radeonsi" 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:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

=================================================================
                        Package Settings
=================================================================

sys-apps/portage-2.3.24-r1::gentoo was built with the following:
USE="(ipc) native-extensions xattr -build -doc -epydoc -gentoo-dev -rsync-verify (-selinux)" ABI_X86="(64)" PYTHON_TARGETS="python2_7 python3_5 -pypy -python3_4 -python3_6"
Comment 1 Georgy Yakovlev gentoo-dev 2018-03-17 20:47:03 UTC
somewhat similar to 
https://bugs.gentoo.org/630538

but this time it's git
Comment 3 Larry the Git Cow gentoo-dev 2018-03-21 18:26:21 UTC
The bug has been referenced in the following commit(s):

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

commit 1327daa7c32ee093b58b52bfa66c3ffdcaf1e1c6
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2018-03-17 21:23:52 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2018-03-21 18:25:54 +0000

    GitSync: abort early for missing git command (bug 650754)
    
    Bug: https://bugs.gentoo.org/650754

 pym/portage/sync/modules/git/git.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)}
Comment 4 Zac Medico gentoo-dev 2018-07-02 18:51:12 UTC
Fixed in portage-2.3.40-r1.