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.
Created attachment 35577 [details, diff] Patch Hi, Can you please try this patch and tell me if it solves the issue? Thanks!
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.
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!
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.
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
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...
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)
Uhm, what is your point, Luke-Jr?
The patch should be in Portage with genkernel-3.0.2e; please reopen this bug if you have any issues with it. Thanks!