Browse files

Item14279: Fix encoding of password in CLI bootstrap

Also clarify documentation of utf-8 configuration parameters
from the CLI configure tool.
  • Loading branch information...
gac410 committed Jan 17, 2017
1 parent 219bb4d commit 69f877a70c63616e1e39bdde7774b8e9dcbda178
Showing with 24 additions and 7 deletions.
  1. +3 −2 core/data/System/CommandAndCGIScripts.txt
  2. +11 −3 core/data/System/InstallationGuide.txt
  3. +10 −2 core/tools/configure
@@ -1,4 +1,4 @@
-%META:TOPICINFO{author="ProjectContributor" date="1483547096" format="1.1" version="1"}%
+%META:TOPICINFO{author="ProjectContributor" date="1484612966" format="1.1" version="1"}%
---+ CGI and Command Line Scripts
@@ -647,10 +647,11 @@ This is a fully functional command line interface to the Foswiki configuration.
=tools/configure [-search] [-getspec] [-getcfg] [-check] [-wizard] [-method] [-save] [-json] [-trace] [-help] [-noprompt] [-expert]=
-Note: if you need to pass in international characters, it needs to be run with the =perl -CA= command argument.
+Note: if you need to pass in international characters, it needs to be run with the =perl -CA= command argument. (=perl -CAS= when running a new configuration bootstrap)
| *Function* | *Usage* |
| Bootstrap a new install without helptext | =tools/configure -save -expert= |
+| Bootstrap an installation containing international characters | =perl -CAS tools/configure -save= |
| Set multiple variables | =tools/configure -save -set {Password}='newadminpassword' -set {WebMasterEmail}=''= |
| Check a setting or section of settings. | =tools/configure -check Internationalisation= |
| Run a wizard | =tools/configure -wizard Email -method send_test_email= |
@@ -1,4 +1,4 @@
-%META:TOPICINFO{author="ProjectContributor" date="1481826890" format="1.1" version="1"}%
+%META:TOPICINFO{author="ProjectContributor" date="1484611418" format="1.1" version="1"}%
---+!! Installation Guide
@@ -344,6 +344,14 @@ Foswiki 2.0 includes a shell based configuration tool that can be run from a
server command-line login. It will bootstrap the configuration, and prompt
for settings as required. Here is an example of using it for an interactive
command line bootstrap:
+<div class="foswikiHelp">
+*Note*: If any of your configuration settings use utf-8 characters, (eg. &Uuml;nic&ouml;de) be sure to
+run configure with the perl =-CAS= option so that all prompted input is properly encoded.
+<verbatim class='bash'>
+$ perl -CAS tools/configure -save
<verbatim class='bash'>
$ tools/configure -save
@@ -383,13 +391,13 @@ for more information on setting up Foswiki to use shorter script URLs.
It can also be run in a non-interactive mode, for use in automated deployment
-<verbatim class='bash'>
+<pre class='bash'>
tools/configure -save -noprompt
tools/configure -save -set {DefaultUrlHost}=''
tools/configure -save -set {ScriptUrlPath}='/bin'
tools/configure -save -set {ScriptUrlPaths}{view}=''
tools/configure -save -set {PubUrlPath}='/pub'
-tools/configure -save -set {Password}='adminpass' </verbatim>
+perl -CA tools/configure -save -set {Password}='&Auml;dm&icirc;nP&auml;ss' </pre>
Any configuration keys may be set using this tool.
@@ -241,7 +241,10 @@ sub _prompt {
$reply = '' unless ( defined $reply );
return if ( $opt && $reply eq 'none' );
- eval "\$Foswiki::cfg$keys='$reply'";
+ # Add keys to the params to be processed by the Save wizard.
+ # This invokes all needed handlers like ONSAVE vs. modifying the config directly
+ eval "\$params->{set}{'$keys'} = '$reply'";
if ($@) {
print "Failed to set $keys: "
. Foswiki::Configure::Reporter::stripStacktrace($@);
@@ -280,7 +283,9 @@ unless ( $Foswiki::cfg{isVALID} ) {
unless ( $params->{expert} || $params->{noprompt} ) {
# Ask for missing parameters that cannot bootstrap in CLI
- print "** Enter values for critical configuration items.\n";
+ print "\n** Enter values for critical configuration items.\n";
+ print
+"** If any input will use utf-8 data (non-ASCII), run as 'perl -CAS tools/configure ...'\n";
"** type a new value or hit return to accept the value in brackets.\n";
@@ -343,6 +348,9 @@ unless ( $Foswiki::cfg{isVALID} ) {
+else {
+ print "** Be sure to run as 'perl -CA tools/configure' if any settings will use utf-8 data\n";
if ( $reporter->has_level('errors') ) {
exit 1;

0 comments on commit 69f877a

Please sign in to comment.