Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 895526 - sys-apps/portage-9999 emerge --sync returns "code = 0" despite error (git merge failed)
Summary: sys-apps/portage-9999 emerge --sync returns "code = 0" despite error (git mer...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on: 891001
Blocks:
  Show dependency tree
 
Reported: 2023-02-20 11:34 UTC by jospezial
Modified: 2023-02-27 03:22 UTC (History)
2 users (show)

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


Attachments
/etc/portage/repos.conf/eselect-repo.conf (eselect-repo.conf,1.95 KB, text/plain)
2023-02-22 11:57 UTC, jospezial
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jospezial 2023-02-20 11:34:57 UTC
I bumped a gcc ebuild by my self. This should get overwritten on sync or "code = 1" should be returned.

>>> Syncing repository 'gentoo' into '/var/db/repos/gentoo'...
/usr/bin/git fetch origin --depth 1
remote: Enumerating objects: 557, done.
remote: Counting objects: 100% (458/458), done.
remote: Compressing objects: 100% (87/87), done.
remote: Total 225 (delta 161), reused 194 (delta 137), pack-reused 0
Receiving objects: 100% (225/225), 109.35 KiB | 982.00 KiB/s, done.
Resolving deltas: 100% (161/161), completed with 140 local objects.
From https://github.com/gentoo-mirror/gentoo
 + a44ef610c6...7f4068bd20 stable     -> origin/stable  (forced update)
error: Entry 'sys-devel/gcc/Manifest' not uptodate. Cannot merge.
fatal: Could not reset index file to revision 'refs/remotes/origin/stable'.
=== Sync completed for gentoo
>>> Syncing repository 'edgets' into '/var/db/repos/edgets'...
/usr/bin/git fetch origin --depth 1
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
=== Sync completed for edgets
...
=== Sync completed for FireBurn

Action: sync for repo: gentoo, returned code = 0
Action: sync for repo: edgets, returned code = 0
Action: sync for repo: x11, returned code = 0
Action: sync for repo: stefantalpalaru, returned code = 0
Action: sync for repo: seden, returned code = 0
Action: sync for repo: qt, returned code = 0
Action: sync for repo: poly-c, returned code = 0
Action: sync for repo: pg_overlay, returned code = 0
Action: sync for repo: netfab-overlay, returned code = 0
Action: sync for repo: kde, returned code = 0
Action: sync for repo: java, returned code = 0
Action: sync for repo: gerislay, returned code = 0
Action: sync for repo: gamerlay, returned code = 0
Action: sync for repo: FireBurn, returned code = 0
Comment 1 jospezial 2023-02-20 11:36:23 UTC
Portage 3.0.44 (python 3.11.2-final-0, default/linux/amd64/17.1, gcc-12, glibc-2.36-r7, 6.2.0-rc8 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-6.2.0-rc8-x86_64-AMD_Athlon-tm-_II_X2_240_Processor-with-glibc2.36
KiB Mem:     4026644 total,    768108 free
KiB Swap:   11010040 total,  11010040 free
Timestamp of repository FireBurn: Sun, 19 Feb 2023 19:48:14 +0000
Head commit of repository FireBurn: 4192ffe7f2b49b578d35ac05420fc5da8e23ab77

Timestamp of repository gamerlay: Sun, 19 Feb 2023 19:48:18 +0000
Head commit of repository gamerlay: 95a3f8fbd4216d4ca61e497032cc704a910fca1c

Timestamp of repository gerislay: Sun, 19 Feb 2023 19:48:36 +0000
Head commit of repository gerislay: 5ad255a36066dd718b4f6b67bf40cd79f03a8947

Timestamp of repository java: Sun, 19 Feb 2023 19:48:19 +0000
Head commit of repository java: cdee805ccbb0689119697d0bb7a95966869e40ed

Head commit of repository kde: ad6ea856fde61fd25a4e79ce1d348bf3f2b67523

Head commit of repository netfab-overlay: 7484e8031443ee5ab845f21f3fe02f1c0fcbb491

Timestamp of repository pg_overlay: Sun, 19 Feb 2023 23:46:51 +0000
Head commit of repository pg_overlay: ac1a3650404174be9b3819293ea72c7911bfef2b

Timestamp of repository poly-c: Mon, 20 Feb 2023 07:52:10 +0000
Timestamp of repository qt: Sun, 19 Feb 2023 19:48:22 +0000
Head commit of repository qt: 8b41d87475a200f1675c51789bfa98bf91667684

Timestamp of repository seden: Sun, 19 Feb 2023 19:48:23 +0000
Head commit of repository seden: c9abb662b11e362f53c339968af7a65e765b935a

Timestamp of repository stefantalpalaru: Sun, 19 Feb 2023 20:16:51 +0000
Head commit of repository stefantalpalaru: 39add11e93ff565057d5e6b22ad366c39b18bce0

Timestamp of repository x11: Sun, 19 Feb 2023 19:48:26 +0000
Head commit of repository x11: 14c1d4e710452ac205b5d92feee82d7ac5db2796

Timestamp of repository gentoo: Sun, 19 Feb 2023 15:46:59 +0000
Head commit of repository gentoo: df90866b6417e13a07323af89c6b6d7a5134d7ea

Timestamp of repository edgets: Sun, 19 Feb 2023 19:48:42 +0000
Head commit of repository edgets: 5aac41b066d20ccc7d368004755810ec4d46ec6a

sh bash 5.2_p15-r2
ld GNU ld (Gentoo 2.40 p2) 2.40.0
ccache version 4.7.4 [enabled]
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.0-r2::gentoo
dev-lang/python:           3.10.10_p1::gentoo, 3.11.2_p1::gentoo
dev-lang/rust-bin:         1.67.1::gentoo
dev-util/ccache:           4.7.4::gentoo
dev-util/cmake:            3.25.2::gentoo
dev-util/meson:            1.0.0::gentoo
sys-apps/baselayout:       2.13-r1::gentoo
sys-apps/openrc:           0.46::gentoo
sys-apps/sandbox:          2.30-r1::gentoo
sys-devel/autoconf:        2.71-r5::gentoo
sys-devel/automake:        1.16.5::gentoo
sys-devel/binutils:        2.40-r1::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/clang:           15.0.7-r1::gentoo
sys-devel/gcc:             12.2.1_p20230218::gentoo
sys-devel/gcc-config:      2.10::gentoo
sys-devel/libtool:         2.4.7-r1::gentoo
sys-devel/lld:             15.0.7::gentoo
sys-devel/llvm:            15.0.7::gentoo
sys-devel/make:            4.4::gentoo
sys-kernel/linux-headers:  6.1::gentoo (virtual/os-headers)
sys-libs/glibc:            2.36-r7::gentoo
Repositories:

FireBurn
    location: /var/db/repos/FireBurn
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/FireBurn.git
    masters: gentoo
    priority: -1001
    volatile: True

gamerlay
    location: /var/db/repos/gamerlay
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gamerlay.git
    masters: gentoo
    priority: -1001
    volatile: True

gerislay
    location: /var/db/repos/gerislay
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gerislay.git
    masters: gentoo
    priority: -1001
    volatile: True

java
    location: /var/db/repos/java
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/java.git
    masters: gentoo
    priority: -1001
    volatile: True

kde
    location: /var/db/repos/kde
    sync-type: git
    sync-uri: https://anongit.gentoo.org/git/proj/kde.git
    masters: gentoo
    priority: -1001
    volatile: True

netfab-overlay
    location: /var/db/repos/netfab-overlay
    sync-type: git
    sync-uri: https://github.com/netfab/overlay
    masters: gentoo
    priority: -1001
    volatile: True

overlay_jl
    location: /var/db/repos/overlay_jl
    masters: gentoo
    priority: -1001
    volatile: True

pg_overlay
    location: /var/db/repos/pg_overlay
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/pg_overlay.git
    masters: gentoo
    priority: -1001
    volatile: True

poly-c
    location: /var/db/repos/poly-c
    sync-type: rsync
    sync-uri: rsync://rsync.gentoofan.org/poly-c
    masters: gentoo
    priority: -1001
    volatile: True
    sync-rsync-extra-opts: 

qt
    location: /var/db/repos/qt
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/qt.git
    masters: gentoo
    priority: -1001
    volatile: True

seden
    location: /var/db/repos/seden
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/seden.git
    masters: gentoo
    priority: -1001
    volatile: True

stefantalpalaru
    location: /var/db/repos/stefantalpalaru
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/stefantalpalaru.git
    masters: gentoo
    priority: -1001
    volatile: True

x11
    location: /var/db/repos/x11
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/x11.git
    masters: gentoo
    priority: -1001
    volatile: True

gentoo
    location: /var/db/repos/gentoo
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gentoo.git
    priority: -1000
    volatile: True

edgets
    location: /var/db/repos/edgets
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/edgets.git
    masters: gentoo
    volatile: True

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -mtune=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
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="-march=native -mtune=native -O2 -pipe"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--autounmask=y --autounmask-write=y --keep-going --quiet-build=y --verbose-conflicts"
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="-march=native -mtune=native -O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live ccache 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 strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=native -mtune=native -O2 -pipe"
GENTOO_MIRRORS="http://ftp.halifax.rwth-aachen.de/gentoo/ https://mirrors.dotsrc.org/gentoo/ https://mirror.leaseweb.com/gentoo/"
LANG="de_DE.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LEX="flex"
LINGUAS="de"
MAKEOPTS="-j2"
PKGDIR="/var/cache/binpkgs"
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 Xaw3d a52 aac aacplus aacs aalib acl acpi activefilter admin adns aften alsa amd64 ap apm apng archive arping audiofile automount avif bash bazaar bdplus bluray boost btrfs bzip2 cairo ccache cdda cddb cdio cdr cdrom chm chroot cjk clang cli client colordiff colorpicker compress corefonts cpio cpuload crypt css cue cups curl custom-modes d3d9 dav1d dbus declarative dga dhcp dom dri dri3 drm dts duktape dump dv dvb dvd dvdnav eap eap-sim eap-tls ebook egl elogind encode enscript epub equalizer exif extensions extras faac faad farstream fat fax fbcon fdformat fdk ffmpeg fftw firefox flac fluidsynth fontconfig foomatic freedoom ftp fuse gadu gd gegl geoip gif git gpg gphoto2 graphite grub gstreamer gtk gtk3 gtk4 gui gzip haptic hddtemp hdf hdf5 hid highlight history hpcups hpijs http http2 iconv icu id3tag idn imagemagick initramfs inotify introspection ipc ipod ipv6 iso jack jbootstrap jit jpeg jpeg2k jpegxl kde keyfinder ladspa lame lcms legacy-systray lensfun libaom libass libcanberra libdrm libglvnd libinput libmpv libnotify libplacebo librtmp libsamplerate libssh2 libtirpc libv4l libwww live lm-sensors logrotate lua lv2 lximage lz4 lzma lzo mad magic man matroska md5sum meanwhile mercurial metalink midi mikmod mime minizip mixer mjpeg mmap mms mng mobi mod modern-top modplug mono mount mouse mp3 mp4 mpeg mpeg2 mplayer mtp multilib multimedia musepack musicbrainz nano-syntax ncat ncurses network networkmonitor newnet ngspice nls normalize nowlistening nping nptl ntfs ntfsprogs ntp nvidia obex ocr odbc odf offload ogg ogm openal opencl opengl openh264 openmp openssl opus osdmenu otr p2p pam pango panorama parse-clocks pcap pci pcre pcre16 pcre32 pdf pdfimport phonon pipes pkcs11 plasma plugins png policykit postproc postscript powermanagement ppds printsupport privacy projectm pulseaudio pvr python qalculate qml qrcode qt5 qtkeychain quicktime radio rar raw readline replaygain rtc rtmp rubberband sbsms scanner screencast screensaver scripttools sdl seccomp secure-delete sensors serial serialport sftp sha512 shorten sixel skins slang smi sndfile sockets socks socks5 sound source-highlight speech speex spell split-usr sql sqlite sqlite3 squashfs ssh ssl staging startup-notification statistics statusnotifier stk stream subtitles sudo svg symlink sync-plugin-portage syslog sysstat system-ffmpeg system-harfbuzz system-icu system-jpeg system-libvpx system-sqlite sysv-utils szip taglib test-rust text texteffect tftp themes theora threads thumbnail tiff timidity tracepath translator truetype twolame udev udf udisks unicode upower urlpicpreview usb utils v4l v4l2 vaapi vala vamp vdpau vector-icons video videos virtualbox vkd3d vnc vorbis vpx vroot vst vulkan vulkaninfo wad wav wavpack wayland webp webpresence widgets winbind winpopup wmf worldclock wps wxwidgets x264 x265 xattr xcb xcomposite xfs xine xinerama xkb xml xmp xorg xosd xpm xrandr xscreensaver xv xvid yahoo zink zip zlib zstd zvbi" ABI_X86="64" ADA_TARGET="gnat_2021" 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="mmx mmxext popcnt sse sse2 sse3 sse4a" CURL_SSL="openssl" 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" KERNEL="linux" L10N="de" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="AMDGPU" 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_10 python3_11" RUBY_TARGETS="ruby31" USERLAND="GNU" VIDEO_CARDS="radeon amdgpu radeonsi" 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

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

sys-apps/portage-9999::gentoo was built with the following:
USE="(ipc) native-extensions rsync-verify xattr -apidoc -build -doc -gentoo-dev (-selinux) -test" ABI_X86="(64)" PYTHON_TARGETS="python3_10 python3_11 -pypy3 -python3_9"
FEATURES="sandbox strict binpkg-dostrip binpkg-logs pid-sandbox multilib-strict unknown-features-warn ebuild-locks sfperms userpriv merge-sync news userfetch unmerge-logs usersandbox network-sandbox distlocks assume-digests unmerge-orphans xattr parallel-fetch config-protect-if-modified usersync protect-owned fixlafiles ccache binpkg-multi-instance binpkg-docompress qa-unresolved-soname-deps ipc-sandbox preserve-libs buildpkg-live"


dev-vcs/git-2.39.2::gentoo was built with the following:
USE="blksha1 curl gpg highlight iconv nls pcre perl safe-directory webdav -cgi -cvs -doc -gnome-keyring -mediawiki -mediawiki-experimental -perforce (-selinux) -subversion -test -tk -xinetd" ABI_X86="(64)" PYTHON_SINGLE_TARGET="python3_10 -python3_11 -python3_9"
FEATURES="binpkg-multi-instance unmerge-orphans multilib-strict merge-sync qa-unresolved-soname-deps assume-digests protect-owned binpkg-docompress sfperms usersandbox sandbox xattr unknown-features-warn userpriv parallel-fetch news pid-sandbox config-protect-if-modified strict unmerge-logs binpkg-dostrip fixlafiles ebuild-locks network-sandbox buildpkg-live usersync ccache preserve-libs distlocks userfetch binpkg-logs ipc-sandbox"
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-02-21 07:56:56 UTC
It's not required but it'd speed things up a bit for me if you could give me a quick test case for whatever modification you made, e.g.
1. git checkout a44ef610c6 in /var/db/repos/gentoo
2. <some one-liner to make whatever change you made to Manifest/ebuild>
3. emerge --sync
Comment 3 jospezial 2023-02-21 12:19:30 UTC
(In reply to Sam James from comment #2)
> It's not required but it'd speed things up a bit for me if you could give me
> a quick test case for whatever modification you made, e.g.
> 1. git checkout a44ef610c6 in /var/db/repos/gentoo
> 2. <some one-liner to make whatever change you made to Manifest/ebuild>
> 3. emerge --sync

I don't understand, should I do these steps above or do you want to know
what I did?:

Time was before https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b36bbf1c14a610a5aea405fad6559583659bcffe
1. emerge -vvv --sync
(git checkout a44ef610c6 in /var/db/repos/gentoo should reproduce that stamp, I think)
2. cp -av /var/db/repos/gentoo/sys-devel/gcc/gcc-12.2.1_p20230211.ebuild /var/db/repos/gentoo/sys-devel/gcc/gcc-12.2.1_p20230218.ebuild
3.ebuild /var/db/repos/gentoo/sys-devel/gcc/gcc-12.2.1_p20230218.ebuild digest
4. some hours later (after you (Sam) gcc bumped )
emerge -vvv --sync

To get it synced again I did:
cd /var/db/repos/gentoo/
git status
git checkout sys-devel/gcc/Manifest
rm sys-devel/gcc/gcc-12.2.1_p20230218.ebuild
cd
emerge -vvv --sync

Normally I use a local overlay, but did it the other way that time.

I am not sure what non-zero error code should be outputted.
I think some time ago I saw a "returned code = 128" on a failed sync, but don't remember what error or repo that was.
Comment 4 John Helmert III archtester Gentoo Infrastructure gentoo-dev Security 2023-02-22 00:28:39 UTC
Can we see the gentoo repo configuration in /etc/portage/repos.conf?
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-02-22 07:28:25 UTC
(In reply to jospezial from comment #3)
> (In reply to Sam James from comment #2)
> > It's not required but it'd speed things up a bit for me if you could give me
> > a quick test case for whatever modification you made, e.g.
> > 1. git checkout a44ef610c6 in /var/db/repos/gentoo
> > 2. <some one-liner to make whatever change you made to Manifest/ebuild>
> > 3. emerge --sync
> 
> I don't understand, should I do these steps above or do you want to know
> what I did?:

Thanks, the what-you-did is exactly what I wanted:

> 
> Time was before
> https://gitweb.gentoo.org/repo/gentoo.git/commit/
> ?id=b36bbf1c14a610a5aea405fad6559583659bcffe
> 1. emerge -vvv --sync
> (git checkout a44ef610c6 in /var/db/repos/gentoo should reproduce that
> stamp, I think)
> 2. cp -av /var/db/repos/gentoo/sys-devel/gcc/gcc-12.2.1_p20230211.ebuild
> /var/db/repos/gentoo/sys-devel/gcc/gcc-12.2.1_p20230218.ebuild
> 3.ebuild /var/db/repos/gentoo/sys-devel/gcc/gcc-12.2.1_p20230218.ebuild
> digest
> 4. some hours later (after you (Sam) gcc bumped )
> emerge -vvv --sync
Comment 6 jospezial 2023-02-22 11:57:03 UTC
Created attachment 853868 [details]
/etc/portage/repos.conf/eselect-repo.conf
Comment 7 jospezial 2023-02-22 12:41:25 UTC
all in /var/db/repos/ is owned by root:root

I did not know about the "volatile=" setting before, so did not change/use it.
Comment 8 Larry the Git Cow gentoo-dev 2023-02-22 17:33:23 UTC
The bug has been referenced in the following commit(s):

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

commit 31a1cbea211633ddb162124ea42d008015f4ab5f
Author:     Florian Schmaus <flow@gentoo.org>
AuthorDate: 2023-02-22 14:11:17 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-02-22 17:33:17 +0000

    sync: git: report error if volatile repository
    
    Previously portage would not report a merge_cmd error if the
    repository was volatile. This could potentially be the cause of
    bug #895526, however if it unclear, at the time of writing this, if
    the repository in the bug is a volatile one.
    
    Bug: https://bugs.gentoo.org/895526
    Signed-off-by: Florian Schmaus <flow@gentoo.org>
    Closes: https://github.com/gentoo/portage/pull/993
    Signed-off-by: Sam James <sam@gentoo.org>

 NEWS                                |  3 +++
 lib/portage/sync/modules/git/git.py | 19 ++++++++++---------
 2 files changed, 13 insertions(+), 9 deletions(-)
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-02-22 17:34:39 UTC
There's another place we need to tweak - a check above the area just changed needs to be adjusted to always reset --hard if volatile.
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-02-25 22:48:17 UTC
(In reply to Sam James from comment #9)
> There's another place we need to tweak - a check above the area just changed
> needs to be adjusted to always reset --hard if volatile.

Oh, actually, I drafted:
```
diff --git a/lib/portage/sync/modules/git/git.py b/lib/portage/sync/modules/git/git.py
index ce30be4cd..2a61fcd08 100644
--- a/lib/portage/sync/modules/git/git.py
+++ b/lib/portage/sync/modules/git/git.py
@@ -356,11 +356,11 @@ class GitSync(NewBase):
             == 0
         )

-        if not is_clean and not self.repo.volatile:
-            # If the repo isn't clean, clobber any changes for parity
-            # with rsync. Only do this for non-volatile repositories.
+        if not self.repo.volatile:
+            # For non-volatile (non-user-modifiable) repositories, clobber any
+            # changes for parity with rsync.
             merge_cmd = [self.bin_command, "reset", "--hard"]
-        elif shallow:
+        elif not is_clean and shallow:
             # Since the default merge strategy typically fails when
             # the depth is not unlimited, `git reset --merge`.
             merge_cmd = [self.bin_command, "reset", "--merge"]
```

then I remembered why we did this in the first place. It's because `git reset --hard` is expensive even if the repo has no changes.

So, I think we're back to Flow's change. Flow's change fixes errors being reported for volatile repos and your repo was volatile, so i think we're good...
Comment 11 Larry the Git Cow gentoo-dev 2023-02-26 20:12:11 UTC
The bug has been closed via the following commit(s):

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

commit bd8f9f6c590dca750285e296a6c3d530f1053d89
Author:     Florian Schmaus <flow@gentoo.org>
AuthorDate: 2023-02-26 19:47:01 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-02-26 20:12:04 +0000

    repository: config: fix volatile detection, add missing () operator
    
    Path(self.location).owner was missing the function-call operator.
    
    Closes: https://bugs.gentoo.org/895526
    Fixes: ef123a214708 ("config: Add 'volatile' configuration option")
    Signed-off-by: Florian Schmaus <flow@gentoo.org>
    Closes: https://github.com/gentoo/portage/pull/997
    Signed-off-by: Sam James <sam@gentoo.org>

 lib/portage/repository/config.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 12 Larry the Git Cow gentoo-dev 2023-02-26 22:01:31 UTC
The bug has been referenced in the following commit(s):

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

commit cd8ade10313d72cb0e3dd2229df02e0ea8681daa
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-02-26 22:01:01 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-02-26 22:01:10 +0000

    sys-apps/portage: add 3.0.45
    
    Bug: https://bugs.gentoo.org/891001
    Bug: https://bugs.gentoo.org/889330
    Bug: https://bugs.gentoo.org/890777
    Bug: https://bugs.gentoo.org/891391
    Bug: https://bugs.gentoo.org/893638
    Bug: https://bugs.gentoo.org/795825
    Bug: https://bugs.gentoo.org/884869
    Bug: https://bugs.gentoo.org/888585
    Bug: https://bugs.gentoo.org/892651
    Bug: https://bugs.gentoo.org/895526
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-apps/portage/Manifest              |   1 +
 sys-apps/portage/portage-3.0.45.ebuild | 288 +++++++++++++++++++++++++++++++++
 2 files changed, 289 insertions(+)
Comment 13 jospezial 2023-02-27 02:43:52 UTC
I tested my example with latest portage. It fixes this bug with the return code.
Interesting would be what happens on sync with local file changes without a detached head (caused by git checkout to previous commit stamp).

Completed (1 of 1) sys-apps/portage-9999::gentoo
jlgentoo ~ # cd /var/db/repos/gentoo/
jlgentoo /var/db/repos/gentoo # git status
Auf Branch stable
Ihr Branch ist auf demselben Stand wie 'origin/stable'.
jlgentoo /var/db/repos/gentoo # git log|cat
commit 82d2234cf102735d40d89536a04838792f380780
Author: Repository mirror & CI <repomirrorci@gentoo.org>
Date:   Mon Feb 27 01:02:05 2023 +0000

    2023-02-27 01:02:04 UTC
jlgentoo /var/db/repos/gentoo # git checkout a44ef610c6
Aktualisiere Dateien: 100% (8630/8630), fertig.
Hinweis: Wechsle zu 'a44ef610c6'.

Sie befinden sich im Zustand eines 'losgelösten HEAD'. Sie können sich
umschauen, experimentelle Änderungen vornehmen und diese committen, und
Sie können alle möglichen Commits, die Sie in diesem Zustand machen,
ohne Auswirkungen auf irgendeinen Branch verwerfen, indem Sie zu einem
anderen Branch wechseln.

Wenn Sie einen neuen Branch erstellen möchten, um Ihre erstellten Commits
zu behalten, können Sie das (jetzt oder später) durch Nutzung von
'switch' mit der Option -c tun. Beispiel:

  git switch -c <neuer-Branchname>

Oder um diese Operation rückgängig zu machen:
  git switch -

Sie können diesen Hinweis ausschalten, indem Sie die Konfigurationsvariable
'advice.detachedHead' auf 'false' setzen.

HEAD ist jetzt bei a44ef610c Merge updates from master
jlgentoo /var/db/repos/gentoo # git status
HEAD losgelöst bei a44ef610c
nichts zu committen, Arbeitsverzeichnis unverändert
jlgentoo /var/db/repos/gentoo # cp -av /var/db/repos/gentoo/sys-devel/gcc/gcc-12.2.1_p20230211.ebuild /var/db/repos/gentoo/sys-devel/gcc/gcc-12.2.1_p20230218.ebuild
'/var/db/repos/gentoo/sys-devel/gcc/gcc-12.2.1_p20230211.ebuild' -> '/var/db/repos/gentoo/sys-devel/gcc/gcc-12.2.1_p20230218.ebuild'
jlgentoo /var/db/repos/gentoo # ebuild /var/db/repos/gentoo/sys-devel/gcc/gcc-12.2.1_p20230218.ebuild digest
>>> Creating Manifest for /var/db/repos/gentoo/sys-devel/gcc
jlgentoo /var/db/repos/gentoo # cd
jlgentoo ~ # emerge -vvv --sync;emerge -v1 portage;eselect news read;emerge -uvat1D @world --newuse --with-bdeps=y;eject -T
>>> Syncing repository 'gentoo' into '/var/db/repos/gentoo'...
fatal: HEAD does not point to a branch
!!! git rev-parse error in /var/db/repos/gentoo
>>> Syncing repository 'edgets' into '/var/db/repos/edgets'...
/usr/bin/git fetch origin --depth 1
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
/usr/bin/git reset --merge refs/remotes/origin/master
=== Sync completed for edgets
>>> Syncing repository 'x11' into '/var/db/repos/x11'...
/usr/bin/git fetch origin --depth 1
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
/usr/bin/git reset --merge refs/remotes/origin/master
=== Sync completed for x11
....................
>>> Syncing repository 'FireBurn' into '/var/db/repos/FireBurn'...
/usr/bin/git fetch origin --depth 1
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
/usr/bin/git reset --merge refs/remotes/origin/master
=== Sync completed for FireBurn

Performing Global Updates
(Could take a couple of minutes if you have a lot of binary packages.)
  .='update pass'  *='binary update'  #='/var/db update'  @='/var/db move'
  s='/var/db SLOT move'  %='binary move'  S='binary SLOT move'
  p='update /etc/portage/package.*'
/var/db/repos/gentoo/profiles/updates/1Q-2023.............
/var/db/repos/gentoo/profiles/updates/4Q-2022...............
@#


Action: sync for repo: gentoo, returned code = 128
Action: sync for repo: edgets, returned code = 0
Action: sync for repo: x11, returned code = 0
Action: sync for repo: stefantalpalaru, returned code = 0
Action: sync for repo: seden, returned code = 0
Action: sync for repo: qt, returned code = 0
Action: sync for repo: poly-c, returned code = 0
Action: sync for repo: pg_overlay, returned code = 0
Action: sync for repo: netfab-overlay, returned code = 0
Action: sync for repo: kde, returned code = 0
Action: sync for repo: java, returned code = 0
Action: sync for repo: gerislay, returned code = 0
Action: sync for repo: gamerlay, returned code = 0
Action: sync for repo: FireBurn, returned code = 0

jlgentoo /var/db/repos/gentoo # git branch|cat
* (HEAD losgelöst bei a44ef610c)
  stable

It would be nice to see whether a repo is treated as volatile or not.
So I don't know if the sync fail is correct. Maybe "git switch -" should be added to the sync.
jlgentoo /var/db/repos/gentoo # git switch -
Warnung: Sie lassen 1 Commit zurück. Folgender Commit ist in
keinem Ihrer Branches enthalten:

  a44ef610c Merge updates from master

Wenn Sie diese durch einen neuen Branch behalten möchten, dann könnte jetzt
ein guter Zeitpunkt sein, dies zu tun mit:

 git branch <neuer-Branchname> a44ef610c

Zu Branch 'stable' gewechselt
Ihr Branch ist auf demselben Stand wie 'origin/stable'.

That seemed to sync the repo or was already uptodate.
Later after that action the sync succeeds:

jlgentoo /var/db/repos/gentoo # emerge -vvv --sync
>>> Syncing repository 'gentoo' into '/var/db/repos/gentoo'...
/usr/bin/git fetch origin --depth 1
remote: Enumerating objects: 20, done.
remote: Counting objects: 100% (20/20), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 11 (delta 6), reused 11 (delta 6), pack-reused 0
Unpacking objects: 100% (11/11), 2.21 KiB | 23.00 KiB/s, done.
From https://github.com/gentoo-mirror/gentoo
 + 82d2234cf...c2a834296 stable     -> origin/stable  (forced update)
/usr/bin/git reset --merge refs/remotes/origin/stable
=== Sync completed for gentoo
>>> Syncing repository 'edgets' into '/var/db/repos/edgets'...
Comment 14 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-02-27 02:52:32 UTC
emerge --info should show you if it's being treated as volatile or not. Could you show me that?

Just the gentoo repo bit like this in your first comment:
>gentoo
>    location: /var/db/repos/gentoo
>    sync-type: git
>    sync-uri: https://github.com/gentoo-mirror/gentoo.git
>    priority: -1000
>    volatile: True
>

I think we could maybe add some debug logging here too.
Comment 15 jospezial 2023-02-27 03:12:20 UTC
(In reply to Sam James from comment #14)
> emerge --info should show you if it's being treated as volatile or not.
> Could you show me that?
> 
> Just the gentoo repo bit like this in your first comment:
> >gentoo
> >    location: /var/db/repos/gentoo
> >    sync-type: git
> >    sync-uri: https://github.com/gentoo-mirror/gentoo.git
> >    priority: -1000
> >    volatile: True
> >

Did not notice that volatile in info. It is new.

As you can see, previously they all had true. All repos now show "volatile: False". 
Is this the correct behaviour or not?

gentoo
    location: /var/db/repos/gentoo
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gentoo.git
    priority: -1000
    volatile: False
Comment 16 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-02-27 03:14:38 UTC
I think for you, it's correct that they're all non-volatile *but* that means sync is not working correctly. It should blast over the repo contents when non-volatile.
Comment 17 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-02-27 03:22:38 UTC
Would you mind filing another bug with that last example (the checkout then the failed sync, can just copy/paste that comment)?

I can do it if not.