Matthew Foulkes <[EMAIL PROTECTED]> writes:

> I looked at the source but am not expert enough to investigate this
> myself. Sorry.

No problem.  To further investigate it, I would very much like to see
the strace output, if you could run that for me.

  strace -o trace.log schroot <schroot options>

Since the program is setuid root, you will need to do this as root.

Could you also try running with "</dev/null".  The termios stuff is
not done unless standard input is a terminal, so this should correct
it.  Is this the case.

Lastly, if you could also try building from source with the attached
patch (it removes all termios getting/setting), I would like to know
if that changes the behaviour.

> The ideal behaviour, in my view, would be for
>
>    schroot -c ia32 -p any_program & 
>
> to be equivalent to logging in to the chroot, changing to the right
> working directory, running
>
>    any_program &
>
> and then logging out of the chroot. At the moment this is not the case.

This should be how it works.  However, it's /not/ entirely equivalent
to running "any_program &", because schroot cannot run backgrounded
processes /inside itself/.  If the oowriter process outlived schroot,
it would prevent chroot cleanup, including filesystem unmounting.

(You can do this, in fact, but you have to create a session first.
It's only useful for running daemons, however.)

> If the termios restore is indeed the problem, one might ask whether this
> ought to be the job of schroot. I don't understand why schroot feels it
> has to fix problems caused by any_program?  Would bash do something
> equivalent? If so, it might be worth investigating the approach used
> there.

Agreed.  It was added as a convenience, but I may review how
appropriate that is.  It might be best only to run it for interactive
use, for example (when no command is specified, and a shell is run).


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please sign and encrypt your mail.
Index: schroot/schroot-base-main.cc
===================================================================
--- schroot/schroot-base-main.cc	(revision 894)
+++ schroot/schroot-base-main.cc	(working copy)
@@ -96,20 +96,6 @@
       std::cout.imbue(std::locale());
       std::cerr.imbue(std::locale());
 
-      // Save terminal state.
-      if (isatty(STDIN_FILENO))
-	{
-	  if (tcgetattr(STDIN_FILENO, &saved_termios) < 0)
-	    {
-	      termios_ok = false;
-	      sbuild::log_warning()
-		<< _("Error saving terminal settings")
-		<< endl;
-	    }
-	  else
-	    termios_ok = true;
-	}
-
       bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
       textdomain (GETTEXT_PACKAGE);
 
@@ -125,14 +111,6 @@
 
       closelog();
 
-      if (isatty(STDIN_FILENO) && termios_ok)
-	{
-	  if (tcsetattr(STDIN_FILENO, TCSANOW, &saved_termios) < 0)
-	    sbuild::log_warning()
-	      << _("Error restoring terminal settings")
-	      << endl;
-	}
-
       return status;
     }
   catch (std::exception const& e)
@@ -154,14 +132,6 @@
 
       closelog();
 
-      if (isatty(STDIN_FILENO) && termios_ok)
-	{
-	  if (tcsetattr(STDIN_FILENO, TCSANOW, &saved_termios) < 0)
-	    sbuild::log_warning()
-	      << _("Error restoring terminal settings")
-	      << endl;
-	}
-
       return EXIT_FAILURE;
     }
 }

Attachment: pgpB4udcly2ie.pgp
Description: PGP signature

Reply via email to