jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] Allow apostrophe in password ......................................................................
[FIX] Allow apostrophe in password
If the password contains an apostrophe it'll mess up the line in the password file. E.g. if the password is "foo'bar" it'll add the following line:
('username', 'foo'bar')
This escapes now any quotes and it'll generate the following line:
('username', 'foo'bar')
Bug: T105783 Change-Id: I45501958362ef07e20b73448a11f11a4160f3136 --- M .travis.yml M tests/README.rst 2 files changed, 4 insertions(+), 2 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/.travis.yml b/.travis.yml index f6a5a3a..4108055 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,7 +53,7 @@ echo "usernames['wikipedia']['test'] = '$PYWIKIBOT2_USERNAME'" >> ~/.pywikibot/user-config.py ; echo "usernames['wikidata']['test'] = '$PYWIKIBOT2_USERNAME'" >> ~/.pywikibot/user-config.py ; echo "usernames['commons']['commons'] = '$PYWIKIBOT2_USERNAME'" >> ~/.pywikibot/user-config.py ; - echo "('$PYWIKIBOT2_USERNAME', '$USER_PASSWORD')" > ~/.pywikibot/passwordfile ; + printf "('%q', '%q')\n" "$PYWIKIBOT2_USERNAME" "$USER_PASSWORD" > ~/.pywikibot/passwordfile ; echo "import os" >> ~/.pywikibot/user-config.py ; echo "password_file = os.path.expanduser('~/.pywikibot/passwordfile')" >> ~/.pywikibot/user-config.py ; fi diff --git a/tests/README.rst b/tests/README.rst index 8ef0b6b..4f5b2eb 100644 --- a/tests/README.rst +++ b/tests/README.rst @@ -109,7 +109,9 @@ 4. The next build should run tests that require a logged in user
While passwords in travis-ci environment variables are not leaked in normal -operations, you are responsible for your own passwords. +operations, you are responsible for your own passwords. If the password contains +single quotes it is necessary to surround them in double quotes (see also +`travis-ci #4350 https://github.com/travis-ci/travis-ci/issues/4350`_).
It is strongly recommended that an untrusted bot account is created for travis tests, using a password that is not shared with trusted accounts.
pywikibot-commits@lists.wikimedia.org