summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-11-11 18:35:32 +0100
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-11-11 18:35:32 +0100
commit996c6447aeb6b4747d21b5fd18ce025b718d99a2 (patch)
treea18451560d0071dd2f4f15c59ae195e8063398ff
parentedbda33bdef6a480fcfcb5d6b9a219c10cbeaaba (diff)
* cmdline/acqprogress.cc:
- don't ask the user for media change if quiet >= 2, stdout is not a tty and assume-yes, force-yes or trivial-only option is set to avoid cpu eating endless loops in unattended runs like apt.cron (Closes: #602354, LP: #665580)
-rw-r--r--cmdline/acqprogress.cc12
-rw-r--r--debian/changelog7
2 files changed, 18 insertions, 1 deletions
diff --git a/cmdline/acqprogress.cc b/cmdline/acqprogress.cc
index 32e8243bf..ba334ce05 100644
--- a/cmdline/acqprogress.cc
+++ b/cmdline/acqprogress.cc
@@ -11,6 +11,7 @@
#include "acqprogress.h"
#include <apt-pkg/acquire-item.h>
#include <apt-pkg/acquire-worker.h>
+#include <apt-pkg/configuration.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/error.h>
@@ -19,6 +20,7 @@
#include <stdio.h>
#include <signal.h>
#include <iostream>
+#include <unistd.h>
/*}}}*/
using namespace std;
@@ -266,6 +268,16 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
/* Prompt for a media swap */
bool AcqTextStatus::MediaChange(string Media,string Drive)
{
+ // If we do not output on a terminal and one of the options to avoid user
+ // interaction is given, we assume that no user is present who could react
+ // on your media change request
+ if (isatty(STDOUT_FILENO) != 1 && Quiet >= 2 &&
+ (_config->FindB("APT::Get::Assume-Yes",false) == true ||
+ _config->FindB("APT::Get::Force-Yes",false) == true ||
+ _config->FindB("APT::Get::Trivial-Only",false) == true))
+
+ return false;
+
if (Quiet <= 0)
cout << '\r' << BlankLine << '\r';
ioprintf(cout,_("Media change: please insert the disc labeled\n"
diff --git a/debian/changelog b/debian/changelog
index 52581d8c9..7110541fb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -17,8 +17,13 @@ apt (0.8.9) UNRELEASED; urgency=low
* apt-pkg/depcache.cc:
- don't install previously not installed providers in a try
to statisfy a "Breaks: provides" dependency by upgrade
+ * cmdline/acqprogress.cc:
+ - don't ask the user for media change if quiet >= 2, stdout is not
+ a tty and assume-yes, force-yes or trivial-only option is set to
+ avoid cpu eating endless loops in unattended runs like apt.cron
+ (Closes: #602354, LP: #665580)
- -- David Kalnischkies <kalnischkies@gmail.com> Wed, 10 Nov 2010 13:22:39 +0100
+ -- David Kalnischkies <kalnischkies@gmail.com> Thu, 11 Nov 2010 18:32:21 +0100
apt (0.8.8) unstable; urgency=low