--- /usr/lib/portage/pym/portage/util/movefile.py.back 2013-03-16 20:30:24.881280226 +0100 +++ /usr/lib/portage/pym/portage/util/movefile.py 2013-03-16 21:12:20.987584777 +0100 @@ -28,6 +28,7 @@ _os.chmod(dest, stat.S_IMODE(src_stat.st_mode)) if hasattr(_os, "getxattr"): + print 'Fea, has attr' # Python >=3.3 and GNU/Linux def _copyxattr(src, dest): for attr in _os.listxattr(src): @@ -39,17 +40,20 @@ if raise_exception: raise OperationNotSupported("Filesystem containing file '%s' does not support extended attributes" % dest) else: + print 'Fea, has not attr' try: import xattr except ImportError: xattr = None if xattr is not None: def _copyxattr(src, dest): + print 'Fea, case 1' for attr in xattr.list(src): try: xattr.set(dest, attr, xattr.get(src, attr)) raise_exception = False - except IOError: + except IOError as e: + print 'IOERROR copyxattr: {0}'.format(e) raise_exception = True if raise_exception: raise OperationNotSupported("Filesystem containing file '%s' does not support extended attributes" % dest) @@ -64,6 +68,7 @@ _devnull.close() if _has_getfattr_and_setfattr: def _copyxattr(src, dest): + print 'Fea, case 2' getfattr_process = subprocess.Popen(["getfattr", "-d", "--absolute-names", src], stdout=subprocess.PIPE) getfattr_process.wait() extended_attributes = getfattr_process.stdout.readlines() @@ -76,6 +81,7 @@ raise OperationNotSupported("Filesystem containing file '%s' does not support extended attributes" % dest) else: def _copyxattr(src, dest): + print 'Fea, case 3 O_o' pass def movefile(src, dest, newmtime=None, sstat=None, mysettings=None, @@ -191,6 +197,7 @@ # For atomic replacement, first create the link as a temp file # and them use os.rename() to replace the destination. if hardlink_candidates: + print 'Fea, hard' head, tail = os.path.split(dest) hardlink_tmp = os.path.join(head, ".%s._portage_merge_.%s" % \ (tail, os.getpid())) @@ -218,10 +225,13 @@ return None hardlinked = True break + else: + print 'Fea, not hard' renamefailed=1 if hardlinked: renamefailed = False + print '{0} {1} {2}=={3}'.format(hardlinked, selinux_enabled, sstat.st_dev, dstat.st_dev) if not hardlinked and (selinux_enabled or sstat.st_dev == dstat.st_dev): try: if selinux_enabled: @@ -230,6 +240,7 @@ os.rename(src,dest) renamefailed=0 except OSError as e: + print 'renamefailed, err {0}'.format(e) if e.errno != errno.EXDEV: # Some random error. writemsg("!!! %s\n" % _("Failed to move %(src)s to %(dest)s") % @@ -238,25 +249,31 @@ return None # Invalid cross-device-link 'bind' mounted or actually Cross-Device if renamefailed: + print 'Fea, renamefailed' + + print '{0}, then {1}, then {2}'.format(stat.ST_MODE, sstat[stat.ST_MODE], stat.S_ISREG(sstat[stat.ST_MODE])) if stat.S_ISREG(sstat[stat.ST_MODE]): + print 'Fea, stat.S_ISREG(sstat[stat.ST_MODE])' dest_tmp = dest + "#new" dest_tmp_bytes = _unicode_encode(dest_tmp, encoding=encoding, errors='strict') try: # For safety copy then move it over. + print '{0} -> {1}'.format(src_bytes, dest_tmp_bytes) _copyfile(src_bytes, dest_tmp_bytes) if xattr_enabled: try: _copyxattr(src_bytes, dest_tmp_bytes) except SystemExit: raise - except: + except Exception as e: + print 'Fea, l263: {0}'.format(e) msg = _("Failed to copy extended attributes. " "In order to avoid this error, set " "FEATURES=\"-xattr\" in make.conf.") msg = textwrap.wrap(msg, 65) for line in msg: writemsg("!!! %s\n" % (line,), noiselevel=-1) - raise + raise e _apply_stat(sstat, dest_tmp_bytes) _rename(dest_tmp_bytes, dest_bytes) _os.unlink(src_bytes) @@ -268,6 +285,8 @@ writemsg("!!! %s\n" % (e,), noiselevel=-1) return None else: + print 'Fea, falback mv' + #we don't yet handle special, so we need to fall back to /bin/mv a = spawn([MOVE_BINARY, '-f', src, dest], env=os.environ) if a != os.EX_OK: