Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 57297 - Genkernel uses debugfile before it has been determined
Summary: Genkernel uses debugfile before it has been determined
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2004-07-16 08:50 UTC by Martin Parm
Modified: 2004-07-28 04:02 UTC (History)
1 user (show)

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


Attachments
Patch (genkernel-3.0.2c-bug57297.patch,1.91 KB, patch)
2004-07-16 10:03 UTC, Tim Yamin (RETIRED)
Details | Diff
Caching patch (patch-genkernel-bug57297-debugcache.patch,3.07 KB, patch)
2004-07-16 12:04 UTC, Tim Yamin (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Parm 2004-07-16 08:50:47 UTC
Genkernel uses the debugfile before it has been determined (e.g overriden with --debugfile=). Any old log in the default location is deleted by clear_log and a new log is written to the default location untill --debugfile= takes effect.

Reproducible: Always
Steps to Reproduce:
1.genkernel --debugfile=/tmp/genkernel.log --loglevel=2
2.
3.

Actual Results:  
clear_log deletes the old log at the default location. The first part of the log 
(until --debugfile= takes effect in determine_real_args) is written to the 
default location and the rest is written to /tmp/genkernel.log.

Expected Results:  
The log should be written entirely in /tmp/genkernel.log and the old log at the 
default location should be left intact.

The bug is in genkernel-3.0.2c. I haven't looked at older versions.
Comment 1 Tim Yamin (RETIRED) gentoo-dev 2004-07-16 10:03:37 UTC
Created attachment 35577 [details, diff]
Patch

Hi,

Can you please try this patch and tell me if it solves the issue?

Thanks!
Comment 2 Martin Parm 2004-07-16 10:55:09 UTC
The patch almost fixes the bug but not completely.

The problem with clear_log was fixed and if --debugfile is the first argument, then the patch works. However if some other argument comes before --debugfile then genkernel will still write to the wrong file, appending to an old logfile.
Another problem is that because clear_log was moved, then all log-messages from parse_cmdline will be lost.
Comment 3 Tim Yamin (RETIRED) gentoo-dev 2004-07-16 12:04:21 UTC
Created attachment 35592 [details, diff]
Caching patch

This patch should cache all debug messages until a qualified $DEBUGFILE is
finally available; or a fatal error occurs. This should hopefully solve the
issue - please test. You'll need to reverse the previous patch. Thanks!
Comment 4 Martin Parm 2004-07-16 14:53:46 UTC
The new patch seems to work. Now the logfile is written at the right destination. One minor detail, though. '\n' are recorded literally and not interpreted as newline. In addition the newlines are placed wrong compared with the 'echo', which the cache should be equivalent to. Simple changing

 DEBUGCACHE="${DEBUGCACHE}\n${STR}"

to

 DEBUGCACHE=${DEBUGCACHE}${STR}$'\n'

fixes both problems.
Comment 5 Tim Yamin (RETIRED) gentoo-dev 2004-07-16 15:52:14 UTC
Hm; the '\n' is recorded literally since bash doesn't support newlines in variables -  I tried the code snippet in zsh and it worked; hence the patch I added.

Trying either in bash fails:

$ TEST="Test"
$ TEST=${TEST}$'\n'2
$ echo $TEST
Test 2
Comment 6 Tim Yamin (RETIRED) gentoo-dev 2004-07-16 15:54:31 UTC
Hm; ignore the comment - since it does echo "${DEBUGCACHE}" that IFS nastiness doesn't apply. It's in CVS and I'll close this bug when a release with the fix is in Portage. Thanks...
Comment 7 Luke-Jr 2004-07-27 17:35:52 UTC
src_compile() {
    genkernel --no-menuconfig \
    $(use no-bootsplash && echo '--no-bootsplash' || echo '--bootsplash') \
        --install --kerneldir="${S}" --debugfile="${T}/debug.log" \
        --root="${D}" --tempdir="${T}/genkernel/" all
}

ACCESS DENIED  unlink:    /var/log/genkernel.log
rm: cannot remove `/var/log/genkernel.log': Permission denied
ACCESS DENIED  open_wr:   /var/log/genkernel.log
Error: Unknown option '--root=/var/tmp/portage/gentoo-dev-linux-2.6.7-r11/image/'!
--------------------------- ACCESS VIOLATION SUMMARY ---------------------------
LOG FILE = "/tmp/sandbox-sys-kernel_-_gentoo-dev-linux-2.6.7-r11-3934.log"

unlink:    /var/log/genkernel.log
open_wr:   /var/log/genkernel.log
--------------------------------------------------------------------------------

(yes, I realize this is fixed)
Comment 8 Martin Parm 2004-07-28 00:28:47 UTC
Uhm, what is your point, Luke-Jr?
Comment 9 Tim Yamin (RETIRED) gentoo-dev 2004-07-28 04:02:35 UTC
The patch should be in Portage with genkernel-3.0.2e; please reopen this bug if you have any issues with it. Thanks!