From d5ccbdbcd29d9b79ba11d42f15c9661d7d60ab24 Mon Sep 17 00:00:00 2001 From: Dev & Sec Date: Fri, 30 Oct 2015 22:54:10 +0000 Subject: [PATCH 1/2] use `printf` instead of `echo -n` for better portability --- bootstrap/venv.sh | 6 +++--- letsencrypt-auto | 10 +++++----- letsencrypt/plugins/manual.py | 7 +++---- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/bootstrap/venv.sh b/bootstrap/venv.sh index ce31e6703..6ca082446 100755 --- a/bootstrap/venv.sh +++ b/bootstrap/venv.sh @@ -25,9 +25,9 @@ pip install -U letsencrypt letsencrypt-apache # letsencrypt-nginx echo echo "Congratulations, Let's Encrypt has been successfully installed/updated!" echo -echo -n "Your prompt should now be prepended with ($VENV_NAME). Next " -echo -n "time, if the prompt is different, 'source' this script again " -echo -n "before running 'letsencrypt'." +printf "%s" "Your prompt should now be prepended with ($VENV_NAME). Next " +printf "time, if the prompt is different, 'source' this script again " +printf "before running 'letsencrypt'." echo echo echo "You can now run 'letsencrypt --help'." diff --git a/letsencrypt-auto b/letsencrypt-auto index 769f5a1d9..41d2e4c97 100755 --- a/letsencrypt-auto +++ b/letsencrypt-auto @@ -70,7 +70,7 @@ then fi fi -echo -n "Updating letsencrypt and virtual environment dependencies..." +printf "Updating letsencrypt and virtual environment dependencies..." if [ "$VERBOSE" = 1 ] ; then echo $VENV_BIN/pip install -U setuptools @@ -83,15 +83,15 @@ if [ "$VERBOSE" = 1 ] ; then fi else $VENV_BIN/pip install -U setuptools > /dev/null - echo -n . + printf . $VENV_BIN/pip install -U pip > /dev/null - echo -n . + printf . # nginx is buggy / disabled for now... $VENV_BIN/pip install -U letsencrypt > /dev/null - echo -n . + printf . $VENV_BIN/pip install -U letsencrypt-apache > /dev/null if $VENV_BIN/pip freeze | grep -q letsencrypt-nginx ; then - echo -n . + printf . $VENV_BIN/pip install -U letsencrypt-nginx > /dev/null fi echo diff --git a/letsencrypt/plugins/manual.py b/letsencrypt/plugins/manual.py index 866965200..9d1857edd 100644 --- a/letsencrypt/plugins/manual.py +++ b/letsencrypt/plugins/manual.py @@ -70,7 +70,7 @@ Are you OK with your IP being logged? CMD_TEMPLATE = """\ mkdir -p {root}/public_html/{response.URI_ROOT_PATH} cd {root}/public_html -echo -n {validation} > {response.URI_ROOT_PATH}/{encoded_token} +printf "%s" "{validation}" > {response.URI_ROOT_PATH}/{encoded_token} # run only once per server: $(command -v python2 || command -v python2.7 || command -v python2.6) -c \\ "import BaseHTTPServer, SimpleHTTPServer; \\ @@ -142,15 +142,14 @@ s.serve_forever()" """ ct=response.CONTENT_TYPE, port=port) if self.conf("test-mode"): logger.debug("Test mode. Executing the manual command: %s", command) - # sh shipped with OS X does't support echo -n - executable = "/bin/bash" if sys.platform == "darwin" else None + # sh shipped with OS X does't support echo -n, but supports printf try: self._httpd = subprocess.Popen( command, # don't care about setting stdout and stderr, # we're in test mode anyway shell=True, - executable=executable, + executable=None, # "preexec_fn" is UNIX specific, but so is "command" preexec_fn=os.setsid) except OSError as error: # ValueError should not happen! From 69365a7a0608731ad484fc1d91cbcc93935578ec Mon Sep 17 00:00:00 2001 From: Dev & Sec Date: Fri, 30 Oct 2015 23:27:16 +0000 Subject: [PATCH 2/2] fix drop quotes issue --- letsencrypt/plugins/manual.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/letsencrypt/plugins/manual.py b/letsencrypt/plugins/manual.py index 9d1857edd..c76463f85 100644 --- a/letsencrypt/plugins/manual.py +++ b/letsencrypt/plugins/manual.py @@ -70,7 +70,7 @@ Are you OK with your IP being logged? CMD_TEMPLATE = """\ mkdir -p {root}/public_html/{response.URI_ROOT_PATH} cd {root}/public_html -printf "%s" "{validation}" > {response.URI_ROOT_PATH}/{encoded_token} +printf "%s" {validation} > {response.URI_ROOT_PATH}/{encoded_token} # run only once per server: $(command -v python2 || command -v python2.7 || command -v python2.6) -c \\ "import BaseHTTPServer, SimpleHTTPServer; \\