[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#327499: Preseeding early/late commands can fail on directory change



Package: preseed-common
Tags: patch

This bug is the result of the following thread on the d-boot list:
http://lists.debian.org/debian-boot/2005/09/msg00092.html

----------  Forwarded Message  ----------

Subject: Re: Preseeing w/o asking a question
Date: Friday 09 September 2005 13:31
From: Paul Millar <p.millar@physics.gla.ac.uk>
To: Joey Hess <joeyh@debian.org>
Cc: debian-boot@lists.debian.org

On Thursday 08 Sep 2005 18:23, Joey Hess wrote:
> > It was a single line, but a big(ish) one (77 characters, iirc).  I've
> > reduced its size (52 characters, now) and it seems to be working.  Is
> > there some limit to the size of a string?
>
> It's possible to run into some limits once the string is 20000
> character long or so (ARG_MAX), but it's more likely that your first
> command exited nonzero and your truncated one succeeds.

Nope, this is all a red-herring.

The real problem was that base-config/late_command is sensitive to cwd
 after the script exits.  As an illustration, try:
    base-config     base-config/late_command string  cd /tmp
For me, this is sufficient to stall the installer.

There's a trivial patch to base-config below that should fix the problem
 (but I haven't tested it :^).  Alternatively, one could eval the
 $PRESEED_COMMAND within a new shell for better protection (rather than
 in base-config's shell).

Meanwhile, being careful to make sure the script ends with the same cwd
 as it starts is a work-around.

Cheers,

Paul.


--- lib/menu/finish-orig        2005-09-09 11:36:30.892331830 +0100
+++ lib/menu/finish     2005-09-09 11:35:39.678301614 +0100
@@ -30,8 +30,10 @@
        # See if there is a preseeded command. If so, run it.
        PRESEED_COMMAND=$($0 get_preseed_command 4>&1 || true)
        if [ -n "$PRESEED_COMMAND" ]; then
+               curdir=$(pwd)
                # TODO error handling (needs error dialog)
                eval $PRESEED_COMMAND || true
+               cd $(curdir)
        fi

        DMS=""

-------------------------------------------------------



Reply to: