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

Bug 487930

Summary: =perl-core/Encode-2.550.0 - /bin/pwd: cannot open directory '../../../../../../..': Permission denied
Product: Portage Development Reporter: Martin Mokrejš <mmokrejs>
Component: CoreAssignee: Portage team <dev-portage>
Status: CONFIRMED ---    
Severity: normal CC: anrock623, gentoo
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Martin Mokrejš 2013-10-13 21:03:03 UTC
# cat /mnt/1TB/var/tmp/portage/perl-core/Encode-2.550.0/temp/build.log
 * Package:    perl-core/Encode-2.550.0
 * Repository: gentoo
 * Maintainer: perl@gentoo.org
 * USE:        amd64 elibc_glibc kernel_linux userland_GNU
 * FEATURES:   nostrip preserve-libs sandbox splitdebug userpriv usersandbox
>>> Unpacking source...
>>> Unpacking Encode-2.55.tar.gz to /mnt/1TB/var/tmp/portage/perl-core/Encode-2.550.0/work
>>> Source unpacked in /mnt/1TB/var/tmp/portage/perl-core/Encode-2.550.0/work
>>> Preparing source in /mnt/1TB/var/tmp/portage/perl-core/Encode-2.550.0/work/Encode-2.55 ...
 * Applying gentoo_enc2xs.diff ...
 [ ok ]
>>> Source prepared.
>>> Configuring source in /mnt/1TB/var/tmp/portage/perl-core/Encode-2.550.0/work/Encode-2.55 ...
 * Using ExtUtils::MakeMaker
 * perl Makefile.PL PREFIX=/usr INSTALLDIRS=vendor INSTALLMAN3DIR=none DESTDIR=/mnt/1TB/var/tmp/portage/perl-core/Encode-2.550.0/image/
Checking if your kit is complete...
Looks good
/bin/pwd: cannot open directory '../../../../../../..': Permission denied
Can't figure out your cwd! at /usr/lib64/perl5/vendor_perl/5.16.3/ExtUtils/MakeMaker.pm line 213.
 * ERROR: perl-core/Encode-2.550.0::gentoo failed (configure phase):
 *   Unable to build!
 * 
 * Call stack:
 *     ebuild.sh, line   93:  Called src_configure
 *   environment, line 2714:  Called perl-module_src_configure
 *   environment, line 2324:  Called perl-module_src_prep
 *   environment, line 2396:  Called die
 * The specific snippet of code:
 *               perl Makefile.PL "$@" <<< "${pm_echovar}" || die "Unable to build!";
 * 
 * If you need support, post the output of `emerge --info '=perl-core/Encode-2.550.0::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=perl-core/Encode-2.550.0::gentoo'`.
 * The complete build log is located at '/mnt/1TB/var/tmp/portage/perl-core/Encode-2.550.0/temp/build.log'.
 * The ebuild environment file is located at '/mnt/1TB/var/tmp/portage/perl-core/Encode-2.550.0/temp/environment'.
 * Working directory: '/mnt/1TB/var/tmp/portage/perl-core/Encode-2.550.0/work/Encode-2.55'
 * S: '/mnt/1TB/var/tmp/portage/perl-core/Encode-2.550.0/work/Encode-2.55'
Comment 1 Martin Mokrejš 2013-10-13 21:10:54 UTC
Ah, maybe is a portage issue?


With emacs I got:

make[2]: Leaving directory `/mnt/1TB/var/tmp/portage/app-editors/emacs-24.3-r2/work/emacs-24.3/lisp'
if test "no" = "yes"; then \
  rm -f bootstrap-emacs; \
  ln temacs bootstrap-emacs; \
else \
  `/bin/pwd`/temacs --batch --load loadup bootstrap || exit 1; \
  test "X/sbin/paxctl" = X || /sbin/paxctl -zex emacs; \
  mv -f emacs bootstrap-emacs; \
fi
/bin/pwd: cannot open directory '../../../../../../../..': Permission denied
/bin/sh: line 4: /temacs: No such file or directory
make[1]: *** [bootstrap-emacs] Error 1
make[1]: Leaving directory `/mnt/1TB/var/tmp/portage/app-editors/emacs-24.3-r2/work/emacs-24.3/src'
make: *** [src] Error 2
 * ERROR: app-editors/emacs-24.3-r2::gentoo failed (compile phase):
 *   emake failed



With seamonkey I got:

make[2]: Leaving directory `/mnt/1TB/var/tmp/portage/www-client/seamonkey-2.21/work/comm-release/seamonk/mozilla'
if test -d ./mozilla/dist/bin ; then touch ./mozilla/dist/bin/.purgecaches ; fi
make[1]: Leaving directory `/mnt/1TB/var/tmp/portage/www-client/seamonkey-2.21/work/comm-release/seamonk'
/mnt/1TB/var/tmp/portage/www-client/seamonkey-2.21/temp/environment: line 4889: cd: /mnt/1TB/var/tmp/portage/www-client/seamonkey-2.21/work/comm-release/seamonk/mailnews/extensions/enigmail: No such file or directory
make -j3 
make: *** No targets specified and no makefile found.  Stop.
emake failed
 * ERROR: www-client/seamonkey-2.21::gentoo failed (compile phase):
 *   make enigmail failed
 * 
 * Call stack:
 *     ebuild.sh, line  93:  Called src_compile
 *   environment, line 4890:  Called die
 * The specific snippet of code:
 *           emake || die "make enigmail failed";


There is a free space on the /mnt/1TB filesystem, the filesystem did not crash per dmesg, so I don't know why is this. Why other packages did not choke with a similar message I don't know either. ;)
Comment 2 Tom Wijsman (TomWij) (RETIRED) gentoo-dev 2013-10-13 23:36:00 UTC
Probably, I think the parent folders need to have proper permissions too with recent versions of Portage; could you check that?

Mine are Access: (1777/drwxrwxrwt)  Uid: (    0/    root)   Gid: (  250/ portage)
Comment 3 Martin Mokrejš 2013-10-14 22:29:13 UTC
# ls -lad /mnt/1TB/var/tmp/portage/perl-core/Encode-2.520.0/work/Encode-2.52
drwxr-xr-x 15 portage portage 4096 Aug 14 04:31 /mnt/1TB/var/tmp/portage/perl-core/Encode-2.520.0/work/Encode-2.52
# ls -lad /mnt/1TB/var/tmp/portage/perl-core/Encode-2.520.0/work            
drwx------ 3 portage portage 4096 Oct 15 00:21 /mnt/1TB/var/tmp/portage/perl-core/Encode-2.520.0/work
# ls -lad /mnt/1TB/var/tmp/portage/perl-core/Encode-2.520.0     
drwxrwxr-x 7 portage portage 4096 Oct 15 00:21 /mnt/1TB/var/tmp/portage/perl-core/Encode-2.520.0
# ls -lad /mnt/1TB/var/tmp/portage/perl-core               
drwxrwxr-x 4 portage portage 4096 Oct 15 00:21 /mnt/1TB/var/tmp/portage/perl-core
# ls -lad /mnt/1TB/var/tmp/portage          
drwxrwxr-x 8 portage portage 4096 Oct 15 00:21 /mnt/1TB/var/tmp/portage
# ls -lad /mnt/1TB/var/tmp        
drwxrwxrwx 3 root root 4096 Oct 13 22:52 /mnt/1TB/var/tmp
# ls -lad /mnt/1TB/var    
drwxr-xr-x 3 root root 4096 Aug  8  2011 /mnt/1TB/var
# ls -lad /mnt/1TB    
drwx--x--x 10 mmokrejs mmokrejs 16384 Sep 14 00:36 /mnt/1TB
# ls -lad /mnt    
drwxr-xr-x 24 root root 4096 Sep 16 00:56 /mnt
# 


So, why does not emerge check this upon startup?

None of the following helped:
chown root.root /mnt/1TB
chgrp portage /mnt/1TB

but

chmod g+rwx /mnt/1TB did help (so portage group could write).

# emerge --version
Portage 2.2.7 (default/linux/amd64/13.0/no-multilib, gcc-4.8.1, glibc-2.17, 3.10.10-default-pciehp x86_64)
#
Comment 4 Tom Wijsman (TomWij) (RETIRED) gentoo-dev 2013-10-14 23:33:15 UTC
This catches unaware people; so yes, we should have Portage check this early on to avoid wasting time or at least guide them to check this as part of the error.
Comment 5 Stefan Briesenick (RETIRED) gentoo-dev 2015-07-14 14:35:04 UTC
something is utterly broken. This problem exists in many packages now. Not all, but many.

Any hints which packages to downgrade, so I have a working environment again for the time being?
Comment 6 Stefan Briesenick (RETIRED) gentoo-dev 2015-07-14 14:37:03 UTC
huh, this is an very old bug. Ok, I have to say, that I have that problem NOW, not in the past. Any hints to fix it?
Comment 7 Zac Medico gentoo-dev 2015-07-14 16:42:10 UTC
You can try FEATURES="-userpriv" to see if that helps.
Comment 8 Stefan Briesenick (RETIRED) gentoo-dev 2015-07-24 15:18:28 UTC
seems to work... :-/

thanks!
Comment 9 Zac Medico gentoo-dev 2015-07-24 16:14:34 UTC
It looks like you need to ensure that all of the parent directories of PORTAGE_TMPDIR have +rx permissions for the portage user. If the +r bit is missing, then apparently it breaks an assumption in the perl-core/Encode build system (involving ExtUtils::MakeMaker).
Comment 10 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2015-07-24 16:26:41 UTC
Do not need to CC perl there, it looks like user side issue not a perl one:)
Comment 11 Zac Medico gentoo-dev 2015-07-24 16:28:04 UTC
I have /usr/lib64/perl5/5.20.2/ExtUtils/MakeMaker.pm from dev-lang/perl-5.20.2, and the relevant code succeeds for me if I don't have read access to a parent directory:

perl -e 'use Cwd qw(cwd abs_path); my $pwd = cwd(); print "$pwd\n";'
Comment 12 Zac Medico gentoo-dev 2015-07-24 16:31:56 UTC
(In reply to Stefan Briesenick from comment #6)
> huh, this is an very old bug. Ok, I have to say, that I have that problem
> NOW, not in the past. Any hints to fix it?

What versions of dev-lang/perl, virtual/perl-ExtUtils-MakeMaker, and/or perl-core/ExtUtils-MakeMaker do you have? What are the permissions of all the parent directories of PORTAGE_TMPDIR?
Comment 13 Fabian Köster 2020-12-30 23:49:24 UTC
The same problem occurred for me as well on one machine for multiple packages. Using FEATURES="-userpriv" they all emerged fine.

Most recent package was dev-perl/Unicode-LineBreak-2019.1.0::gentoo

 * perl Makefile.PL PREFIX=/usr INSTALLDIRS=vendor INSTALLMAN3DIR=none DESTDIR=/var/tmp/portage/dev-perl/Unicode-LineBreak-2019.1.0/image    
Use bundled sombok 2.4.0 with Unicode 8.0.0                                                                                                                                                                                                                                               
Checking if your kit is complete...               
Looks good                                                                                                                                                                                                                                                                                
/bin/pwd: cannot open directory ‘../../../../../../..’: Permission denied                                                                    
Can't figure out your cwd! at /usr/lib64/perl5/5.30.3/ExtUtils/MakeMaker.pm line 237. 

> What versions of dev-lang/perl, virtual/perl-ExtUtils-MakeMaker, and/or perl-core/ExtUtils-MakeMaker do you have? 

For me it is:

dev-lang/perl-5.30.3::gentoo was built with the following:
USE="berkdb gdbm -debug -doc -ithreads" ABI_X86="(64)"

virtual/perl-ExtUtils-MakeMaker-7.340.0-r2::gentoo was built with the following:
USE="" ABI_X86="(64)"

> What are the permissions of all the parent directories of PORTAGE_TMPDIR?

That question actually lead me on the right path!

 # ls -ld /
drwxr-x--x 22 root bacula 4096 17. Jun 2020  /

For some reason my root path had the wrong group (bacula vs root) and also the wrong perms. I fixed both and now the problem seems to be gone, I can successfully emerge dev-perl/Unicode-LineBreak-2019.1.0 without having to disable userpriv.

Thank you very much for your help!