Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 89434 - lchown missing from os on x86 python 2.3
Summary: lchown missing from os on x86 python 2.3
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High major (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-17 10:18 UTC by Max Lorenz
Modified: 2005-04-23 03:00 UTC (History)
0 users

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


Attachments
Python config.log (config.log,216.70 KB, text/plain)
2005-04-20 09:02 UTC, Max Lorenz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Max Lorenz 2005-04-17 10:18:47 UTC
Everything using Portage, like emerge, equery, euse, etc-update etc. fails with the follwing error:

!!! Failed to complete portage imports. There are internal modules for
!!! portage and failure here indicates that you have a problem with your
!!! installation of portage. Please try a rescue portage located in the
!!! portage tree under '/usr/portage/sys-apps/portage/files/' (default).
!!! There is a README.RESCUE file that details the steps required to perform
!!! a recovery of portage.
    No module named missingos

This happens after I updated gcc, glibc etc. and did `emerge -e system' twice overnight, which finished without errors. After that everything related to portage fails

Reproducible: Always
Steps to Reproduce:
1.invoke portage
2.
3.

Actual Results:  
exits with error

Expected Results:  
working Portage

`emerge --info' doesn't work obviously.

Stable x86 system
hardened profile 
hardened kernel (w/ PaX and grsecurity w/o RBAC)
Portage 2.0.51.19
Python 2.3.4


Honestly I don't know if this is PEBKAC or an actual bug, I just want to know
what's going on.

FYI, I found bug #34820 but it is rather old and I don't know what ot make of it

thanks in advance
Comment 1 Jason Stubbs (RETIRED) gentoo-dev 2005-04-18 06:53:39 UTC
What python version are you running?
Comment 2 Max Lorenz 2005-04-18 08:55:34 UTC
Hi,

`python -V' says 2.3.4
Comment 3 Jason Stubbs (RETIRED) gentoo-dev 2005-04-18 22:35:27 UTC
What does the following give you?

python -c 'import os; print dir(os)'
Comment 4 Max Lorenz 2005-04-19 06:22:34 UTC
homer root # python -c 'import os; print dir(os)'
['EX_CANTCREAT', 'EX_CONFIG', 'EX_DATAERR', 'EX_IOERR', 'EX_NOHOST', 'EX_NOINPUT', 'EX_NOPERM', 'EX_NOUSER', 'EX_OK', 'EX_OSERR', 'EX_OSFILE', 'EX_PROTOCOL', 'EX_SOFTWARE', 'EX_TEMPFAIL', 'EX_UNAVAILABLE', 'EX_USAGE', 'F_OK', 'NGROUPS_MAX', 'O_APPEND', 'O_CREAT', 'O_DIRECT', 'O_DIRECTORY', 'O_DSYNC', 'O_EXCL', 'O_LARGEFILE', 'O_NDELAY', 'O_NOCTTY', 'O_NOFOLLOW', 'O_NONBLOCK', 'O_RDONLY', 'O_RDWR', 'O_RSYNC', 'O_SYNC', 'O_TRUNC', 'O_WRONLY', 'P_NOWAIT', 'P_NOWAITO', 'P_WAIT', 'R_OK', 'TMP_MAX', 'UserDict', 'WCONTINUED', 'WCOREDUMP', 'WEXITSTATUS', 'WIFCONTINUED', 'WIFEXITED', 'WIFSIGNALED', 'WIFSTOPPED', 'WNOHANG', 'WSTOPSIG', 'WTERMSIG', 'WUNTRACED', 'W_OK', 'X_OK', '_Environ', '__all__', '__builtins__', '__doc__', '__file__', '__name__', '_copy_reg', '_execvpe', '_exists', '_exit', '_get_exports_list', '_make_stat_result', '_make_statvfs_result', '_pickle_stat_result', '_pickle_statvfs_result', '_spawnvef', 'abort', 'access', 'altsep', 'chdir', 'chmod', 'chown', 'chroot', 'close', 'confstr', 'confstr_names', 'ctermid', 'curdir', 'defpath', 'dup', 'dup2', 'environ', 'error', 'execl', 'execle', 'execlp', 'execlpe', 'execv', 'execve', 'execvp', 'execvpe', 'extsep', 'fchdir', 'fdatasync', 'fdopen', 'fork', 'forkpty', 'fpathconf', 'fstat', 'fstatvfs', 'fsync', 'ftruncate', 'getcwd', 'getcwdu', 'getegid', 'getenv', 'geteuid', 'getgid', 'getgroups', 'getloadavg', 'getlogin', 'getpgid', 'getpgrp', 'getpid', 'getppid', 'getuid', 'isatty', 'kill', 'killpg', 'linesep', 'link', 'listdir', 'lseek', 'lstat', 'major', 'makedev', 'makedirs', 'minor', 'mkdir', 'mkfifo', 'mknod', 'name', 'nice', 'open', 'openpty', 'pardir', 'path', 'pathconf', 'pathconf_names', 'pathsep', 'pipe', 'popen', 'popen2', 'popen3', 'popen4', 'putenv', 'read', 'readlink', 'remove', 'removedirs', 'rename', 'renames', 'rmdir', 'sep', 'setegid', 'seteuid', 'setgid', 'setgroups', 'setpgid', 'setpgrp', 'setregid', 'setreuid', 'setsid', 'setuid', 'spawnl', 'spawnle', 'spawnlp', 'spawnlpe', 'spawnv', 'spawnve', 'spawnvp', 'spawnvpe', 'stat', 'stat_float_times', 'stat_result', 'statvfs', 'statvfs_result', 'strerror', 'symlink', 'sys', 'sysconf', 'sysconf_names', 'system', 'tcgetpgrp', 'tcsetpgrp', 'tempnam', 'times', 'tmpfile', 'tmpnam', 'ttyname', 'umask', 'uname', 'unlink', 'unsetenv', 'utime', 'wait', 'waitpid', 'walk', 'write']


On an additional note, the only problem with portage I could find during the 'emerge -e system' was, quoting from PORT_LOGDIR:

> Recalculating the counter... FAILED to update counter.
> -rw-r--r--  1 root root 4 Apr 17 13:58 /var/cache/edb/counter.old
> !!! This is a problem.
Comment 5 Jason Stubbs (RETIRED) gentoo-dev 2005-04-19 07:51:49 UTC
And there's the problem.
Comment 6 Max Lorenz 2005-04-19 15:58:34 UTC
mmmh, you mean the counter thing? How did it happen? Because frankly I fail to see how I could have contributed to this. So it is a bug? After greping through the logfiles like madman, I think it happened during the 2nd run of 'emerge -e system'. There are some error messages like the first one but everything compiled and merged fine, AFAICT.
So, is there a way to solve this or should I take the README.RESCUE route?
TIA, max
Comment 7 Alastair Tse (RETIRED) gentoo-dev 2005-04-20 02:04:40 UTC
so this works? 

python -c "import os; print os.lchown"
Comment 8 Max Lorenz 2005-04-20 03:24:09 UTC
Nope.

homer root # python -c "import os; print os.lchown"
Traceback (most recent call last):
  File "<string>", line 1, in ?
AttributeError: 'module' object has no attribute 'lchown'
Comment 9 Alastair Tse (RETIRED) gentoo-dev 2005-04-20 05:50:07 UTC
can you try doing the following? just to test whether you have a glibc with lchown. if you do, then it is very odd that python didn't compile with LCHOWN support. 

$ cat > lchown-test.c
#include <sys/types.h>
#include <unistd.h>

int main(int argc, void **argv) {
  lchown(NULL, 0, 0);
  return 0;
}      
$ gcc -c lchown-test.c   

see if the above produces any errors, i would doubt that it will fail. anyway, if that works, extract the source of python from your /usr/portage/distfiles and then run ./configure on it and attach the config.log
Comment 10 Max Lorenz 2005-04-20 09:02:01 UTC
Created attachment 56764 [details]
Python config.log

Odd, lchown-test.c compiled fine and the config.log tells me that lchown is
there.
After searching through the portage logs it seems that everything before and
after python (like perl or coreutils) found lchown, but python did not??
config.log is attached.

Thanks, max
Comment 11 Alastair Tse (RETIRED) gentoo-dev 2005-04-20 09:58:38 UTC
well, that means the lchown wasn't missing, but something transient made it so that python's configure couldn't detect it. without being able to reproduce it, i can't see how to prevent it from happening agian. although this is the first time i've seen this happen.
Comment 12 Max Lorenz 2005-04-20 16:58:55 UTC
So am I correct assuming that there's no (relatively) easy way to reproduce this or find out what happened? If logs or access to the system is of any help, by all means contact me.

Oh well, just for reassurance that means portage rescue, remerge python, remerge portage (and a 'emerge -e system' for good measure?) and I'll be good to go. Right?

Thanks for your help, much appreciated.
Max
Comment 13 Alastair Tse (RETIRED) gentoo-dev 2005-04-21 03:44:03 UTC
unfortunately, i can't think of anything that could help us reproduce it. 

basically, the easiest way to get it working again. one is to change all instances of "lchown(" to "os.chown(" in /usr/lib/portage/pym/portage.py temporarily, and then emerge python first, then emerge portage. 

lchown is basically just a safe version of chown that doesn't follow symlinks.
Comment 14 Max Lorenz 2005-04-22 15:52:52 UTC
Yes! It worked, though i had to change the lchown stuff in portage_data.py as well. Many thanks! So I guess this bug can be closed now or whatever the appropriate action is to deal with this kind of bug.

One last question, could the missing support for lchown halfway trough the 'emerge -e system' have any negative side-effects, IOW should I 'emerge -e system' again?

Thanks again,
Max
Comment 15 Alastair Tse (RETIRED) gentoo-dev 2005-04-23 03:00:49 UTC
as long as lchown is in python and portage is back using it, then it all should be fine. detection failed at some point in python, but i don't know any other package that requires lchown specifically.