aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-16 18:20:42 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-16 18:21:13 +0000
commit6e08fbefeecfbe5ecdf7615bf4bf3941a2b68dec (patch)
tree327006b4e534addf3a90c5b828f9f6818248bbc8
parenta5f766843dd12407c9f66626504d9d8f077b4970 (diff)
downloadpaludis-6e08fbefeecfbe5ecdf7615bf4bf3941a2b68dec.tar.gz
paludis-6e08fbefeecfbe5ecdf7615bf4bf3941a2b68dec.tar.xz
Handle spaces in pipe commands
-rwxr-xr-xpaludis/repositories/e/ebuild/pipe_functions.bash6
-rw-r--r--paludis/repositories/e/ebuild/utils/locked_pipe_command.cc4
-rw-r--r--paludis/repositories/e/pipe_command_handler.cc5
3 files changed, 8 insertions, 7 deletions
diff --git a/paludis/repositories/e/ebuild/pipe_functions.bash b/paludis/repositories/e/ebuild/pipe_functions.bash
index 22ead7f..a8a1585 100755
--- a/paludis/repositories/e/ebuild/pipe_functions.bash
+++ b/paludis/repositories/e/ebuild/pipe_functions.bash
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# vim: set sw=4 sts=4 et :
-# Copyright (c) 2007, 2008 Ciaran McCreesh
+# Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
#
# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005
# Gentoo Foundation and distributed under the terms of the GNU General
@@ -43,8 +43,8 @@ paludis_pipe_command()
exit 123
fi
- local r r1 rest
- r="$(echo "$@" | {
+ local r r1 rest a
+ r="$(for a in "$@" ; do echo -n "$a"$'\2' ; done | {
if ! locked_pipe_command "${PALUDIS_PIPE_COMMAND_WRITE_FD}" "${PALUDIS_PIPE_COMMAND_READ_FD}" ; then
type die &>/dev/null && eval die "\"locked_pipe_command failed\""
echo "locked_pipe_command failed" 1>&2
diff --git a/paludis/repositories/e/ebuild/utils/locked_pipe_command.cc b/paludis/repositories/e/ebuild/utils/locked_pipe_command.cc
index eca3780..ad71045 100644
--- a/paludis/repositories/e/ebuild/utils/locked_pipe_command.cc
+++ b/paludis/repositories/e/ebuild/utils/locked_pipe_command.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007 Ciaran McCreesh
+ * Copyright (c) 2007, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -65,7 +65,7 @@ main(int argc, char *argv[])
return EXIT_FAILURE;
}
- /* append null to the pipe read buffer */
+ /* append an 'end' marker to the pipe read buffer */
buf[0] = '\0';
while (((w = write(write_fd, buf, 1))) == 0)
sleep(0);
diff --git a/paludis/repositories/e/pipe_command_handler.cc b/paludis/repositories/e/pipe_command_handler.cc
index f315aca..612a113 100644
--- a/paludis/repositories/e/pipe_command_handler.cc
+++ b/paludis/repositories/e/pipe_command_handler.cc
@@ -67,7 +67,7 @@ paludis::erepository::pipe_command_handler(const Environment * const environment
try
{
std::vector<std::string> tokens;
- tokenise_whitespace(s, std::back_inserter(tokens));
+ tokenise<delim_kind::AnyOfTag, delim_mode::DelimiterTag>(s, stringify('\2'), "", std::back_inserter(tokens));
if (tokens.empty())
{
Log::get_instance()->message("e.pipe_commands.empty", ll_warning, lc_context) << "Got empty pipe command";
@@ -78,7 +78,8 @@ paludis::erepository::pipe_command_handler(const Environment * const environment
{
if (tokens.size() != 3)
{
- Log::get_instance()->message("e.pipe_commands.ping.bad", ll_warning, lc_context) << "Got bad PING command";
+ Log::get_instance()->message("e.pipe_commands.ping.bad", ll_warning, lc_context) << "Got bad PING command, tokens are { '"
+ << join(tokens.begin(), tokens.end(), "', '") << "' }";
return "Ebad PING command";
}
else