Arch Linux

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#13214 - makepkg/fakeroot seems to break kernel configuration scripts.

Attached to Project: Arch Linux
Opened by kludge (kludge) - Wednesday, 11 February 2009, 20:16 GMT
Last edited by Allan McRae (Allan) - Friday, 20 March 2009, 23:22 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To No-one
Architecture i686
Severity Critical
Priority Normal
Reported Version None
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No



i realize this is a pretty vague description, but i haven't had the time to track it down more specifically yet. i will look at it more closely as soon as a i can.

Additional info:
* kernels - .4 (using the abs kernel26 PKGBUILD and the kernel26-vanilla and parallel PKGBUILDS for me)
* pacman 3.2.2-1
* fakeroot 1.2.1-1

Steps to reproduce:
run 'makepkg' against any kernel PKGBUILD that calls 'make {x,g,menu}config'
This task depends upon

Closed by  Allan McRae (Allan)
Friday, 20 March 2009, 23:22 GMT
Reason for closing:  Not a bug
Additional comments about closing:  See final comment
Comment by Aaron Griffin (phrakture) - Wednesday, 11 February 2009, 20:20 GMT
Please provide full descriptions of the problem in bug reports rather than linking to forum posts... reading now
Comment by Aaron Griffin (phrakture) - Wednesday, 11 February 2009, 20:22 GMT
Too much to read there - please provide a better description of the problem so I don't have to sift through all this crap to determine who to assign this bug to. From simple reading of both forum posts I gather the following: you are using a PKGBUILD from the wiki which doesn't work, the PKGBUILD from ABS works fine... is this correct?
Comment by Allan McRae (Allan) - Wednesday, 11 February 2009, 21:25 GMT
My guess is that this is similar to  FS#12653 . This will be fixed when pacman-3.3 comes out and makepkg allows the build to be done outside the fakeroot.
Comment by kludge (kludge) - Wednesday, 11 February 2009, 21:40 GMT
sorry 'bout that, aaron. 2nd attempt:

when running makepkg on kernel PKGBUILDs, the kernel configuration interfaces (usually) break. i have encountered this behavior with the kernel26 PKGBUILD from the ABS, the kernel26-parallel PKGBUILD from the AUR [1], a pkgbuild of my own for totally vanilla kernel sources (essentially the ABS PKGBUILD minus the arch patches), and the 'Custom Kernel Compilation with ABS' PKGBUILD from the wiki [2].

with 'make menuconfig' the menu is unuseable. the arrow keys produce '[[B[[C[[A', etc. and the options are not selectable. i can only exit the menu with <ctrl>-C, which also aborts makepkg.

this occurs in both a terminal emulator within an x session and at the console. when 'makepkg' is run in the console, the 'make menuconfig' menu takes up only the upper-left quarter of the screen and exhibits the behavior described above. 'make menuconfig' run mannually inside ${startdir}/src/linux-2.6.28/ occupies the whole console and works properly.

with 'make xconfig,' the x configuration app fails to launch with:

HOSTCC scripts/basic/fixdep
HOSTCC scripts/basic/docproc
HOSTCC scripts/basic/hash
HOSTCC scripts/kconfig/conf.o
sed < scripts/kconfig/lkc_proto.h > scripts/kconfig/lkc_defs.h 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
SHIPPED scripts/kconfig/
HOSTCC scripts/kconfig/kxgettext.o
SHIPPED scripts/kconfig/lex.zconf.c
SHIPPED scripts/kconfig/zconf.hash.c
/opt/qt/bin/moc -i scripts/kconfig/qconf.h -o scripts/kconfig/qconf.moc
HOSTCC scripts/kconfig/kconfig_load.o
HOSTCC scripts/kconfig/
HOSTCXX scripts/kconfig/qconf.o
HOSTLD scripts/kconfig/qconf
scripts/kconfig/qconf arch/x86/Kconfig
make[1]: *** [xconfig] Segmentation fault
make: *** [xconfig] Error 2

'make xconfig' run manually inside ${startdir}/src/linux-2.6.28/ works as expected.

this behavior is not 100% consistent. occassionally, the 'xconfig' and 'menuconfig' make targets work properly when called by 'makepkg.' i have not found any pattern that determines when they work and when they break, though i haven't had the time yet to add debugging statements to 'makepkg' or 'fakeroot'.

these errors aside, kernel compilation works as expected with all of the PKGBUILDs mentioned above.

Comment by Aaron Griffin (phrakture) - Wednesday, 11 February 2009, 21:44 GMT
menuconfig failing sounds like a terminfo/termcap issue

Can you try running "bash --noprofile --norc" and THEN running makepkg with menuconfig?
Comment by Jan de Groot (JGC) - Wednesday, 11 February 2009, 22:00 GMT
So you're running make xconfig (which is bad when run as (fake)root), or make menuconfig from a PKGBUILD, which is supposed to be an non-interactive script? I don't know what makepkg is doing actually, but I can imagine that some redirection inside makepkg can freak out ncurses applications.
Comment by kludge (kludge) - Thursday, 12 February 2009, 00:25 GMT
hmm... not sure how that got posted twice... sorry.

@jan: in short, yes, though i've never seen it documented that PKGBUILDs are supposed to be non-interactive.

@aaron: before trying "bash --noprofile --norc", i wanted to see if i could reliably reproduce the behavior. so i ran 'makepkg' with the ABS PGKBUILD, with 'yes "" | make config' changed to 'make menuconfig.' 'menuconfig' worked as expected. then i tried the same thing with the kernel26parallel PKGBUILG from the AUR, only i ran 'makepkg -L', and 'menuconfig' fails as described. (i got into the habit of using the '-L' flag when tracking down

i removed src/ from both and ran 'makepkg' again, swapping the '-L' flags. ('makepkg -L' against the ABS PKGBUILD, 'makepkg' against kernel26parallel.) 'menuconfig' worked for kernel26parallel, and failed on the ABS PKGBUILD.

somehow, i hadn't noticed that was what made the difference before. it's almost certainly the cause is this line in /usr/bin/makepkg:

line 696: build 2>&1 | tee "$BUILDLOG"; ret=${PIPESTATUS[0]}

i'm going to hypothesize that it's 'tee' grabbing the ncurses output of 'make menuconfig'.

the '-L' flag seems to have no effect on 'make xconfig', for which i can't reproduce the breakage. it's most likely a separate issue entirely.

@all: so, if PKGBUILDs are expected to be entirely non-interactive, then makepkg seems to be working exactly as expected, and i've created a furor over a user error. crap. my bad.
Comment by Aaron Griffin (phrakture) - Thursday, 12 February 2009, 00:34 GMT
Ahah, good catch. I would have caught that if you mentioned using -L, as I know that can cause some problems. Your hypothesis makes perfect sense - that the redirection and tee are screwing up ncurses. The X app doesn't have this issue because it doesn't accept input from the console.

Still, this brings up a good point that the -L flag may be confusing and make some things more error prone.

I wonder if there's a solution....
Comment by Allan McRae (Allan) - Thursday, 12 February 2009, 00:39 GMT
In the splitpkg work I did, I had to hack around tee in the run_package() function. I guess that using the same hack in run_build() may actually solve this with the downside being much uglier and harder to understand code.

To test this out replace:

build 2>&1 | tee "$BUILDLOG"; ret=${PIPESTATUS[0]}


logpipe=$(mktemp -u "$startdir/logpipe.XXXXXXXX")
mknod "$logpipe" p
exec 3>&1
tee "$BUILDLOG" < "$logpipe" &
exec 1>"$logpipe" 2>"$logpipe"
$pkgfunc 2>&1 || ret=$?
exec 1>&3 2>&3 3>&-
rm "$logpipe"
Comment by Aaron Griffin (phrakture) - Thursday, 12 February 2009, 00:59 GMT
with pkgfunc=build, I'd assume?
Comment by Allan McRae (Allan) - Thursday, 12 February 2009, 01:17 GMT
Comment by kludge (kludge) - Thursday, 12 February 2009, 02:04 GMT
@allan: i replaced line 696 of /usr/bin/makepkg with your magic, and replaced $pkgfunc with 'build'... and no love. i've tried to read up on filedscriptors and whack at it bit, but i got nothing.
Comment by Gerardo Exequiel Pozzi (djgera) - Wednesday, 18 February 2009, 20:39 GMT
This is an issue with fakeroot and nvidia libGL libs. Please read comments that i posted here  FS#12592 
Comment by kludge (kludge) - Thursday, 19 February 2009, 08:54 GMT

unlikely. i don't have a single nvidia anything installed on this system.
Comment by Gerardo Exequiel Pozzi (djgera) - Thursday, 19 February 2009, 13:05 GMT
Correct, YES this isn't related with the libGL from nvidia. This is another bug (a know bug) with pthread linked programs (see README from fakeroot ;))

For the 'xconfig' is related that the fakeroot sometimes crash on multithreads programs randomly. For this cases fakeroot recommend to use the "tcp version".

Please recompile your fakeroot with --with-ipc=tcp and test again.

you can see that qconf is linked agains libpthread, run in at your linux source dir
$ ldd scripts/kconfig/qconf | grep pthread => /lib/ (0xb76f3000)

Comment by Gerardo Exequiel Pozzi (djgera) - Thursday, 19 February 2009, 13:19 GMT
Oohh, and for 'menuconfig' you can reproduce the behavior of the 'makepkg' outside this with: "make menuconfig 2>&1 | tee" you can see the same chars from arrows if you executed simply "cat 2>&1 | tee" ;)

Comment by Allan McRae (Allan) - Friday, 20 March 2009, 23:22 GMT
I'm going to close this because makepkg is supposed to be non interactive so the config file should be constructed beforehand.

Also, the build step will be able to be run outside of fakeroot once pacman-3.3 is release so this will then work (apart from logging, but makepkg, non-interactive, remember...).