On Fri, Jul 06, 2007 at 11:29:55PM +0200, Xavier wrote:
hmm I made a tiny progress on this one, looks like the bug appears with this error: 550 debug: chrooting in /home/xav/dev/pacman/foo/ 551 error: could not change the root directory (Operation not permitted)
This happens when : 1) running as user 2) installing a package with a scriptlet (like filesystem)
When running as root, the operation is permitted, so that error doesn't appear, and pacman debug output is fine. And that chroot is apparently made for scriptlets, so when there aren't any, it doesn't happen (and in this case also, the log is fine too).
Hm think I found it. a fork was made for running the scriptlet. When it succeeded, exit(0) was used, but in case of errors, it used return(1). So it probably didn't exit, and the following code was executed twice, resulting in duplicated output. If someone could confirm this is correct, it would be great. At least, the following patch fix it :
From e4834035a5d928b2a85d1ada690ecd9b0d66d4e4 Mon Sep 17 00:00:00 2001 From: Chantry Xavier <shiningxc@gmail.com> Date: Sat, 7 Jul 2007 17:11:18 +0200 Subject: [PATCH] libalpm/trans.c : exit the forked process correctly in case of errors.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com> --- lib/libalpm/trans.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index cde8bf0..3264bee 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -645,11 +645,11 @@ int _alpm_runscriptlet(const char *root, const char *installfn, _alpm_log(PM_LOG_DEBUG, _("chrooting in %s"), root); if(chroot(root) != 0) { _alpm_log(PM_LOG_ERROR, _("could not change the root directory (%s)"), strerror(errno)); - return(1); + exit(1); } if(chdir("/") != 0) { _alpm_log(PM_LOG_ERROR, _("could not change directory to / (%s)"), strerror(errno)); - return(1); + exit(1); } umask(0022); _alpm_log(PM_LOG_DEBUG, _("executing \"%s\""), cmdline); -- 1.5.2.2