Package: cupt
Version: 2.2.0~rc1
Severity: important
Hi,
| # cupt --no-auto-remove build-dep git-buildpackage
| [...]
| Unpacking highlight-common (from .../highlight-common_2.16-1_all.deb) ...
| Setting up highlight-common (2.16-1) ...
|
| Configuration file `/etc/highlight/filetypes.conf'
| ==> Deleted (by you or by a script) since installation.
| ==> Package distributor has shipped an updated version.
| What would you like to do about it ? Your options are:
| Y or I : install the package maintainer's version
| N or O : keep your currently-installed version
| D : show the differences between the versions
| Z : start a shell to examine the situation
| The default action is to keep your current version.
| *** filetypes.conf (Y/I/N/O/D/Z) [default=N] ? dpkg: error processing
highlight-common (--install):
| EOF on stdin at conffile prompt
| Errors were encountered while processing:
| highlight-common
| E: pipe '/usr/bin/dpkg --install --no-triggers --force-bad-path
//var/cache/apt/archives/highlight-common_2.16-1_all.deb' execution failed:
exit code '1'
How about something along these lines (which is almost certainly broken;
take it as pseudocode)?
-- >8 --
Subject: lib: internal: worker: do not redirect commands' input unnecessarily
Commit 'fbdc779d' taught the worker to submit input for hooks and
other commands that require special data on stdin through a pipe
instead of asking the shell to redirect for us. To keep the code
simple, it taught cupt to _always_ make stdin of external commands a
pipe, with the unpleasant consequence that the user cannot interact
via the terminal even if there was no input to be passed from cupt:
| # cupt upgrade highlight-common
| [...]
| Unpacking highlight-common (from .../highlight-common_2.16-1_all.deb)
...
| Setting up highlight-common (2.16-1) ...
|
| Configuration file `/etc/highlight/filetypes.conf'
[...]
| The default action is to keep your current version.
| *** filetypes.conf (Y/I/N/O/D/Z) [default=N] ? dpkg: error processing
highlight-common (--install):
| EOF on stdin at conffile prompt
| Errors were encountered while processing:
| highlight-common
| E: pipe '/usr/bin/dpkg --install --no-triggers --force-bad-path
//var/cache/apt/archives/highlight-common_2.16-1_all.deb' execution failed:
exit code '1'
"Fix" it by only redirecting stdin when the commandInput parameter is
nonempty.
NEEDSWORK: Notice that this means cupt cannot pass an empty stream to
hooks any more --- if commandInput is empty, any hook expecting input
on stdin will sit waiting for input from the terminal. This would be
a problem for version-1 pre-install-packages hooks when packages are
only being configured and not unpacked.
Signed-off-by: Jonathan Nieder <[email protected]>
---
cpp/lib/src/internal/worker/base.cpp | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/cpp/lib/src/internal/worker/base.cpp
b/cpp/lib/src/internal/worker/base.cpp
index 9dabb451..dcc59246 100644
--- a/cpp/lib/src/internal/worker/base.cpp
+++ b/cpp/lib/src/internal/worker/base.cpp
@@ -81,7 +81,22 @@ void WorkerBase::_run_external_command(Logger::Subsystem
subsystem,
{
const char* id = (errorId.empty() ? command.c_str() :
errorId.c_str());
- try
+ if (commandInput.empty())
+ {
+ // invoking command
+ auto result = ::system(command.c_str());
+ if (result == -1)
+ {
+ fatal("unable to launch command '%s': EEE",
+ command.c_str());
+ }
+ else if (result)
+ {
+ fatal("command '%s' execution failed: %s",
command.c_str(),
+
getWaitStatusDescription(result).c_str());
+ }
+ }
+ else try
{
// invoking command
string errorString;
@@ -92,10 +107,7 @@ void WorkerBase::_run_external_command(Logger::Subsystem
subsystem,
command.c_str(),
errorString.c_str());
}
- if (!commandInput.empty())
- {
- pipeFile.put(commandInput);
- }
+ pipeFile.put(commandInput);
}
catch (...)
{
--
1.7.6
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]