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

Bug 734000

Summary: git-r3.eclass - mkdir: cannot create directory ‘/usr/portage/distfiles/git3-src/Thomas-Tsai_partclone.git’: Permission denied
Product: Gentoo Linux Reporter: contactopublico57
Component: EclassesAssignee: Michał Górny <mgorny>
Status: UNCONFIRMED ---    
Severity: normal CC: adjudicatordarren, dev-portage, flippynelle, gentoo
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=737136
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: log, etc as requested

Description contactopublico57 2020-07-26 21:11:54 UTC
Created attachment 650898 [details]
log, etc as requested

sudo emerge fails unpack of git source:

mkdir: cannot create directory ‘/usr/portage/distfiles/git3-src/Thomas-Tsai_partclone.git’: Permission denied
 [31;01m*[0m ERROR: sys-block/partclone-9999::ssnb failed (unpack phase): 

fails unpack even if directory manually created

make.conf:
EGIT3_STORE_DIR=${DISTDIR}/git3-src 

https://devmanual.gentoo.org/eclass-reference/git-r3.eclass/index.html

EGIT3_STORE_DIR
    Storage directory for git sources.
    This is intended to be set by user in make.conf. Ebuilds must not set it.
    EGIT3_STORE_DIR=${DISTDIR}/git3-src
Comment 1 contactopublico57 2020-07-26 21:16:22 UTC
Comment on attachment 650898 [details]
log, etc as requested

>Portage 3.0.0 (python 3.7.8-final-0, default/linux/amd64/17.1/systemd, gcc-10.1.0, glibc-2.31-r6, 5.8.0-rc4 x86_64)
>=================================================================
>                         System Settings
>=================================================================
>System uname: Linux-5.8.0-rc4-x86_64-with-gentoo-2.7
>KiB Mem:     3911808 total,   1118260 free
>KiB Swap:    2097144 total,   2096376 free
>Timestamp of repository gentoo: Sun, 26 Jul 2020 00:45:01 +0000
>Head commit of repository gentoo: 57df63dd15ee9141f688ba90d5224c5d0efeceb3
>sh bash 5.0_p18
>ld GNU ld (Gentoo 2.34 p4) 2.34.0
>app-shells/bash:          5.0_p18::gentoo
>dev-lang/perl:            5.30.3-r1::gentoo
>dev-lang/python:          3.7.8-r2::gentoo
>dev-util/cmake:           3.18.0::gentoo
>dev-util/pkgconfig:       0.29.2::gentoo
>sys-apps/baselayout:      2.7::gentoo
>sys-apps/sandbox:         2.20::gentoo
>sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
>sys-devel/automake:       1.16.2::gentoo
>sys-devel/binutils:       2.34-r1::gentoo
>sys-devel/gcc:            10.1.0-r2::gentoo
>sys-devel/gcc-config:     2.3.1::gentoo
>sys-devel/libtool:        2.4.6-r6::gentoo
>sys-devel/make:           4.3::gentoo
>sys-kernel/linux-headers: 4.20::gentoo (virtual/os-headers)
>sys-libs/glibc:           2.31-r6::gentoo
>Repositories:
>
>gentoo
>    location: /usr/portage
>    sync-type: rsync
>    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
>    priority: -1000
>    sync-rsync-extra-opts: 
>    sync-rsync-verify-metamanifest: no
>    sync-rsync-verify-jobs: 1
>    sync-rsync-verify-max-age: 24
>
>overlay
>    location: /usr/local/portage/overlay
>    masters: gentoo
>    priority: 0
>
>ssnb
>    location: /var/lib/layman/ssnb
>    sync-type: laymansync
>    sync-uri: https://anongit.gentoo.org/git/repo/user/ssnb.git
>    masters: gentoo
>    priority: 50
>
>ACCEPT_KEYWORDS="amd64 ~amd64 ~x86"
>ACCEPT_LICENSE="@FREE @BINARY-REDISTRIBUTABLE"
>CBUILD="x86_64-pc-linux-gnu"
>CFLAGS="-march=native -O2 -pipe"
>CHOST="x86_64-pc-linux-gnu"
>CONFIG_PROTECT="/etc /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 /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
>CXXFLAGS="-march=native -O2 -pipe"
>DISTDIR="/usr/portage/distfiles"
>ENV_UNSET="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 -pipe"
>FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs candy config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news nodoc parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userpriv usersandbox usersync xattr"
>FFLAGS="-O2 -pipe"
>GENTOO_MIRRORS="http://distfiles.gentoo.org http://www.ibiblio.org/pub/Linux/distributions/gentoo"
>LANG="en_US.utf8"
>LDFLAGS="-Wl,-O1 -Wl,--as-needed"
>LINGUAS="en"
>MAKEOPTS="-j2"
>PKGDIR="/usr/portage/packages"
>PORTAGE_BINHOST="http://packages.gentooexperimental.org/packages/amd64-unstable/"
>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"
>USE="(-selinux) X a52 aac accessibility acl alsa alsa_pcm_plugins_adpcm alsa_pcm_plugins_alaw alsa_pcm_plugins_asym alsa_pcm_plugins_copy alsa_pcm_plugins_dmix alsa_pcm_plugins_dshare alsa_pcm_plugins_dsnoop alsa_pcm_plugins_empty alsa_pcm_plugins_extplug alsa_pcm_plugins_file alsa_pcm_plugins_hooks alsa_pcm_plugins_iec958 alsa_pcm_plugins_ioplug alsa_pcm_plugins_ladspa alsa_pcm_plugins_lfloat alsa_pcm_plugins_linear alsa_pcm_plugins_meter alsa_pcm_plugins_mmap_emul alsa_pcm_plugins_mulaw alsa_pcm_plugins_multi alsa_pcm_plugins_null alsa_pcm_plugins_plug alsa_pcm_plugins_rate alsa_pcm_plugins_route alsa_pcm_plugins_share alsa_pcm_plugins_shm alsa_pcm_plugins_softvol amd64 aom apparmor argon2 audit berkdb branding build bzip2 cdda cli crypt cryptsetup curl dbus dri dts dv dvb dvd dynamic elfutils example fbcon fbcondecor ffmpeg flac fortran gdbm gif gimp gnuefi gstreamer gtk gtk3 http iconv idn importd introspection ipv6 jack jpeg kdbus kmod lame lcms libass libidn2 libnotify libtirpc libvisual livecd loop-aes lz4 lz5 lzma matroska mms mmx mng modplug modules mp3 mp4 mpeg mpeg2 mpeg4pt2 multilib nat ncurses networkmanager nls nptl nptlonly ogg opengl openmp opus oss pam pax_kernel pcre png policykit portaudio pulseaudio qrcode qt5 readline resolvconf seccomp socks5 split-usr sse sse2 ssl systemd sysv-utils taglib tcpd theora tiff truetype udev unicode usb usrmerge v4l vaapi vala vanilla vcd vdpau vlc vorbis vpx wavpack x264 xattr xkb xml xvid zlib" ABI_X86="64" ADA_TARGET="gnat_2018" 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" 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 sse sse2 3dnow 3dnowext mmxext" CURL_SSL="nss idn" 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="efi-64" INPUT_DEVICES="evdev keyboard mouse synaptics virtualbox mutouch vmmouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2 php7-3" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_7" PYTHON_TARGETS="python3_7" RUBY_TARGETS="ruby25 ruby26 ruby27" USERLAND="GNU" VIDEO_CARDS="fbdev intel i915 i965" 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, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
>


[ebuild  N    ] sys-block/partclone-9999  USE="e2fs ncurses -apfs -btrfs -exfat -f2fs -fat -fuse -hfs -minix -nilfs2 -ntfs -reiser4 -reiserfs -static -xfs" 

log:

[32;01m * [39;49;00mPackage:    sys-block/partclone-9999
[32;01m * [39;49;00mRepository: ssnb
[32;01m * [39;49;00mUSE:        abi_x86_64 amd64 e2fs elibc_glibc kernel_linux ncurses userland_GNU
[32;01m * [39;49;00mFEATURES:   network-sandbox preserve-libs sandbox userpriv usersandbox
>>> Unpacking source...
mkdir: cannot create directory ‘/usr/portage/distfiles/git3-src/Thomas-Tsai_partclone.git’: Permission denied
 [31;01m*[0m ERROR: sys-block/partclone-9999::ssnb failed (unpack phase):
 [31;01m*[0m   (no error message)
 [31;01m*[0m 
 [31;01m*[0m Call stack:
 [31;01m*[0m     ebuild.sh, line  125:  Called src_unpack
 [31;01m*[0m   environment, line 2005:  Called git-r3_src_unpack
 [31;01m*[0m   environment, line 1767:  Called git-r3_src_fetch
 [31;01m*[0m   environment, line 1761:  Called git-r3_fetch
 [31;01m*[0m   environment, line 1529:  Called _git-r3_set_gitdir 'https://github.com/Thomas-Tsai/partclone.git'
 [31;01m*[0m   environment, line  529:  Called die
 [31;01m*[0m The specific snippet of code:
 [31;01m*[0m           mkdir "${GIT_DIR}" || die;
 [31;01m*[0m 
 [31;01m*[0m If you need support, post the output of `emerge --info '=sys-block/partclone-9999::ssnb'`,
 [31;01m*[0m the complete build log and the output of `emerge -pqv '=sys-block/partclone-9999::ssnb'`.
 [31;01m*[0m The complete build log is located at '/usr/portage/logs/sys-block:partclone-9999:20200726-203516.log'.
 [31;01m*[0m For convenience, a symlink to the build log is located at '/var/tmp/portage/sys-block/partclone-9999/temp/build.log'.
 [31;01m*[0m The ebuild environment file is located at '/var/tmp/portage/sys-block/partclone-9999/temp/environment'.
 [31;01m*[0m Working directory: '/var/tmp/portage/sys-block/partclone-9999/work'
 [31;01m*[0m S: '/var/tmp/portage/sys-block/partclone-9999/work/partclone-9999'
Comment 2 Zac Medico gentoo-dev 2020-08-14 17:48:50 UTC
This is similar to bug 737136. When FEATURES=userpriv is enabled (the default), ${DISTDIR}/git3-src needs to be writable by the "portage" user. You can correct the problem like this:

chown -R portage:portage /usr/portage/distfiles/git3-src

It's not possible for portage to do this on your behalf, since it is completely unaware of the ${DISTDIR}/git3-src directory (it is entirely created and managed by git-r3.eclass).
Comment 3 contactopublico57 2020-12-09 18:24:41 UTC
chown -R portage:portage /usr/portage/distfiles/git3-src

This permitted writing to the directory but source subsequently failed to download to the target directory and unpack/build failed.
Comment 4 contactopublico57 2021-05-14 18:17:06 UTC
I was finally able to install the ebuild from here: 

https://gpo.zugaina.org/AJAX/Ebuild/53404217

Although it did not appear to be downloading and unpacking the source into 
the EGIT3_STORE_DIR.

>>> Unpacking source...
>>> Unpacking partclone-0.3.17.tar.gz to /var/tmp/portage/portage/sys-block/partclone-0.3.17/work
>>> Source unpacked in /var/tmp/portage/portage/sys-block/partclone-0.3.17/work
>>> Preparing source in /var/tmp/portage/portage/sys-block/partclone-0.3.17/work/partclone-0.3.17 ...
 * Running eautoreconf in '/var/tmp/portage/portage/sys-block/partclone-0.3.17/work/partclone-0.3.17' ...
Comment 5 Adjudicator Darren 2021-05-16 09:45:49 UTC
(In reply to contactopublico57 from comment #4)
> I was finally able to install the ebuild from here: 
> 
> https://gpo.zugaina.org/AJAX/Ebuild/53404217
> 
> Although it did not appear to be downloading and unpacking the source into 
> the EGIT3_STORE_DIR.
> 
> >>> Unpacking source...
> >>> Unpacking partclone-0.3.17.tar.gz to /var/tmp/portage/portage/sys-block/partclone-0.3.17/work
> >>> Source unpacked in /var/tmp/portage/portage/sys-block/partclone-0.3.17/work
> >>> Preparing source in /var/tmp/portage/portage/sys-block/partclone-0.3.17/work/partclone-0.3.17 ...
>  * Running eautoreconf in
> '/var/tmp/portage/portage/sys-block/partclone-0.3.17/work/partclone-0.3.17'
> ...

that is a normal ebuild so it's expected to act that way.
You could try the -9999 one if you wish to test the git stuff, https://gpo.zugaina.org/sys-block/partclone
Comment 6 Kobboi 2021-10-06 14:58:10 UTC
(In reply to Zac Medico from comment #2)
> This is similar to bug 737136. When FEATURES=userpriv is enabled (the
> default), ${DISTDIR}/git3-src needs to be writable by the "portage" user.
> You can correct the problem like this:
> 
> chown -R portage:portage /usr/portage/distfiles/git3-src
> 
> It's not possible for portage to do this on your behalf, since it is
> completely unaware of the ${DISTDIR}/git3-src directory (it is entirely
> created and managed by git-r3.eclass).

I am hitting something similar trying to work on a new live ebuild as an unprivileged user.

Why can't the git-r3 eclass make sure that git3-src/ is rw for $user:portage (for whatever $user is running the code, portage or someone else in that group)? And the same for all directories and files in it? That way both regular updates as well as 'dev' actions would be supported.

(I'm probably saying something stupid but will learn from the reply).
Comment 7 jospezial 2023-09-24 15:51:36 UTC
I deleted the distfiles folder.
Why can portage create /var/cache/distfiles/ when it fetches the sources for normal ebuilds
drwxr-xr-x 11 root     root 4096 24. Sep 16:59 cache
|_ drwxrwxr-x 2 root    portage 20480 24. Sep 17:02 distfiles

but when git-r3 is used it can't create the deleted distfiles directory?

>>> Unpacking source...
mkdir: cannot create directory ‘/var/cache/distfiles’: Permission denied
 * ERROR: sys-apps/portage-9999::gentoo failed (unpack phase):
 *   Unable to create /var/cache/distfiles/git3-src
 * 
 * Call stack:
 *     ebuild.sh, line  136:  Called src_unpack
 *   environment, line 3874:  Called git-r3_src_unpack
 *   environment, line 2682:  Called git-r3_src_fetch
 *   environment, line 2676:  Called git-r3_fetch
 *   environment, line 2426:  Called _git-r3_set_gitdir 'https://anongit.gentoo.org/git/proj/portage.git'
 *   environment, line  520:  Called die
 * The specific snippet of code:
 *           mkdir -p "${EGIT3_STORE_DIR}" ) || die "Unable to create ${EGIT3_STORE_DIR}";


userfetch userpriv are enabled.

Could portage always create $DISTDIR if it does not exist?