Skip to content

Commit 5244fbb

Browse files
authored
Clean up goal wallet new output (algorand#2183)
When you run goal wallet new there is a confusing warning ("One or more non-printable characters ...") presented just before the backup phrase, which is displayed between some sanitized ANSI codes. This is due to security improvements in algorand#1585 to prevent goal from printing control characters. This PR removes the ANSI color formatting altogether from the infoBackupPhrase (already done for Windows in algorand#1942), which is one simple way to clean up this output and remove the warning message.
1 parent 4752312 commit 5244fbb

File tree

9 files changed

+15
-70
lines changed

9 files changed

+15
-70
lines changed

cmd/goal/messages.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ const (
2424
errorGenesisIDFail = "Error determining kmd folder (%s). Ensure the node is running in %s."
2525
errorDirectoryNotExist = "Specified directory '%s' does not exist."
2626
errorParseAddr = "Failed to parse addr: %v"
27-
errorNonPrintableCharacters = "One or more non-printable characters were ommited from the following error message:"
28-
infoNonPrintableCharacters = "One or more non-printable characters were ommited from the subsequent line:"
27+
errorNonPrintableCharacters = "One or more non-printable characters were omitted from the following error message:"
28+
infoNonPrintableCharacters = "One or more non-printable characters were omitted from the subsequent line:"
2929

3030
// Account
3131
infoNoAccounts = "Did not find any account. Please import or create a new one."
@@ -169,6 +169,7 @@ const (
169169
infoCreatedWallet = "Created wallet '%s'"
170170
infoBackupExplanation = "Your new wallet has a backup phrase that can be used for recovery.\nKeeping this backup phrase safe is extremely important.\nWould you like to see it now? (Y/n): "
171171
infoPrintedBackupPhrase = "Your backup phrase is printed below.\nKeep this information safe -- never share it with anyone!"
172+
infoBackupPhrase = "\n%s"
172173
infoNoWallets = "No wallets found. You can create a wallet with `goal wallet new`"
173174
errorCouldntCreateWallet = "Couldn't create wallet: %s"
174175
errorCouldntInitializeWallet = "Couldn't initialize wallet: %s"

cmd/goal/messages_common.go

Lines changed: 0 additions & 24 deletions
This file was deleted.

cmd/goal/messages_windows.go

Lines changed: 0 additions & 22 deletions
This file was deleted.

debug/logfilter/example3.in

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,7 @@
145145

146146

147147

148-
One or more non-printable characters were ommited from the subsequent line:
149-
150-
[32mtest faculty trash brick need involve stand run jelly genius clap business zero ticket head grief rib fox ladder soap injury thrive balance able tissue[0m
148+
test faculty trash brick need involve stand run jelly genius clap business zero ticket head grief rib fox ladder soap injury thrive balance able tissue
151149

152150
WALLET_1_PASSPHRASE: test faculty trash brick need involve stand run jelly genius clap business zero ticket head grief rib fox ladder soap injury thrive balance able tissue
153151
spawn goal wallet list -d /home/travis/gopath/src/github.com/algorand/go-algorand/tmp/out/e2e/103916-1617037129265/tealAndStatefulTealTest/algod/root/Primary/
@@ -198,9 +196,7 @@
198196

199197

200198

201-
One or more non-printable characters were ommited from the subsequent line:
202-
203-
[32mpowder sing write danger match cabin order oblige shrug slide tragic select true rule gym celery wool vendor salon goat summer rule dove able collect[0m
199+
powder sing write danger match cabin order oblige shrug slide tragic select true rule gym celery wool vendor salon goat summer rule dove able collect
204200

205201
WALLET_2_PASSPHRASE: powder sing write danger match cabin order oblige shrug slide tragic select true rule gym celery wool vendor salon goat summer rule dove able collect
206202
spawn goal wallet list -d /home/travis/gopath/src/github.com/algorand/go-algorand/tmp/out/e2e/103916-1617037129265/tealAndStatefulTealTest/algod/root/Primary/

debug/logfilter/example3.out.expected

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@
7575
Your backup phrase is printed below.
7676
Keep this information safe -- never share it with anyone!
7777

78-
One or more non-printable characters were ommited from the subsequent line:
79-
[32mtest faculty trash brick need involve stand run jelly genius clap business zero ticket head grief rib fox ladder soap injury thrive balance able tissue[0m
78+
test faculty trash brick need involve stand run jelly genius clap business zero ticket head grief rib fox ladder soap injury thrive balance able tissue
8079
WALLET_1_PASSPHRASE: test faculty trash brick need involve stand run jelly genius clap business zero ticket head grief rib fox ladder soap injury thrive balance able tissue
8180
spawn goal wallet list -d /home/travis/gopath/src/github.com/algorand/go-algorand/tmp/out/e2e/103916-1617037129265/tealAndStatefulTealTest/algod/root/Primary/
8281
##################################################
@@ -103,8 +102,7 @@
103102
Your backup phrase is printed below.
104103
Keep this information safe -- never share it with anyone!
105104

106-
One or more non-printable characters were ommited from the subsequent line:
107-
[32mpowder sing write danger match cabin order oblige shrug slide tragic select true rule gym celery wool vendor salon goat summer rule dove able collect[0m
105+
powder sing write danger match cabin order oblige shrug slide tragic select true rule gym celery wool vendor salon goat summer rule dove able collect
108106
WALLET_2_PASSPHRASE: powder sing write danger match cabin order oblige shrug slide tragic select true rule gym celery wool vendor salon goat summer rule dove able collect
109107
spawn goal wallet list -d /home/travis/gopath/src/github.com/algorand/go-algorand/tmp/out/e2e/103916-1617037129265/tealAndStatefulTealTest/algod/root/Primary/
110108
##################################################

debug/logfilter/example6.in

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,8 @@ ok github.com/algorand/go-algorand/test/e2e-go/cli/goal 26.354s
268268

269269

270270

271-
One or more non-printable characters were ommited from the subsequent line:
272-
273-
[32mattract shy usage prison umbrella december sail finish struggle spring walk wisdom bread globe eyebrow admit typical tag december poet labor cable radar absent secret[0mWALLET_1_PASSPHRASE: attract shy usage prison umbrella december sail finish struggle spring walk wisdom bread globe eyebrow admit typical tag december poet labor cable radar absent secret
271+
attract shy usage prison umbrella december sail finish struggle spring walk wisdom bread globe eyebrow admit typical tag december poet labor cable radar absent secret
272+
WALLET_1_PASSPHRASE: attract shy usage prison umbrella december sail finish struggle spring walk wisdom bread globe eyebrow admit typical tag december poet labor cable radar absent secret
274273
spawn goal wallet list -d /home/travis/gopath/src/github.com/algorand/go-algorand/tmp/out/e2e/104122-1617229030279/tealAndStatefulTealTest/algod/root/Primary/
275274

276275
##################################################
@@ -317,9 +316,7 @@ ok github.com/algorand/go-algorand/test/e2e-go/cli/goal 26.354s
317316

318317

319318

320-
One or more non-printable characters were ommited from the subsequent line:
321-
322-
[32mcasual double chuckle method salmon talent cabbage maze parade luggage under elite pass best session sign december cliff master proud since crunch joy above jump[0m
319+
casual double chuckle method salmon talent cabbage maze parade luggage under elite pass best session sign december cliff master proud since crunch joy above jump
323320

324321
WALLET_2_PASSPHRASE: casual double chuckle method salmon talent cabbage maze parade luggage under elite pass best session sign december cliff master proud since crunch joy above jump
325322
spawn goal wallet list -d /home/travis/gopath/src/github.com/algorand/go-algorand/tmp/out/e2e/104122-1617229030279/tealAndStatefulTealTest/algod/root/Primary/

debug/logfilter/example6.out.expected

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ ok github.com/algorand/go-algorand/test/e2e-go/cli/goal 26.354s
9898
Your backup phrase is printed below.
9999
Keep this information safe -- never share it with anyone!
100100

101-
One or more non-printable characters were ommited from the subsequent line:
102-
[32mattract shy usage prison umbrella december sail finish struggle spring walk wisdom bread globe eyebrow admit typical tag december poet labor cable radar absent secret[0mWALLET_1_PASSPHRASE: attract shy usage prison umbrella december sail finish struggle spring walk wisdom bread globe eyebrow admit typical tag december poet labor cable radar absent secret
101+
attract shy usage prison umbrella december sail finish struggle spring walk wisdom bread globe eyebrow admit typical tag december poet labor cable radar absent secret
102+
WALLET_1_PASSPHRASE: attract shy usage prison umbrella december sail finish struggle spring walk wisdom bread globe eyebrow admit typical tag december poet labor cable radar absent secret
103103
spawn goal wallet list -d /home/travis/gopath/src/github.com/algorand/go-algorand/tmp/out/e2e/104122-1617229030279/tealAndStatefulTealTest/algod/root/Primary/
104104
##################################################
105105
Wallet: Wallet_1_1617230151
@@ -124,8 +124,7 @@ ok github.com/algorand/go-algorand/test/e2e-go/cli/goal 26.354s
124124
Your backup phrase is printed below.
125125
Keep this information safe -- never share it with anyone!
126126

127-
One or more non-printable characters were ommited from the subsequent line:
128-
[32mcasual double chuckle method salmon talent cabbage maze parade luggage under elite pass best session sign december cliff master proud since crunch joy above jump[0m
127+
casual double chuckle method salmon talent cabbage maze parade luggage under elite pass best session sign december cliff master proud since crunch joy above jump
129128
WALLET_2_PASSPHRASE: casual double chuckle method salmon talent cabbage maze parade luggage under elite pass best session sign december cliff master proud since crunch joy above jump
130129
spawn goal wallet list -d /home/travis/gopath/src/github.com/algorand/go-algorand/tmp/out/e2e/104122-1617229030279/tealAndStatefulTealTest/algod/root/Primary/
131130
##################################################

test/e2e-go/cli/goal/expect/goalExpectCommon.exp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ proc ::AlgorandGoal::CreateWallet { WALLET_NAME WALLET_PASSWORD TEST_PRIMARY_NOD
283283
}
284284
expect {
285285
timeout {::AlgorandGoal::Abort "Timed out CreateWallet pass phrase" }
286-
-re {32m([a-z ]+)} {set WALLET_PASS_PHRASE $expect_out(1,string); close;}
286+
-re {([a-z ]+)} {set WALLET_PASS_PHRASE $expect_out(1,string); close;}
287287
}
288288
} EXCEPTION ] } {
289289
::AlgorandGoal::Abort "ERROR in CreateWallet: $EXCEPTION"

test/e2e-go/cli/goal/expect/goalFormattingTest.exp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if { [catch {
2222
spawn goal clerk inspect $TEST_ALGO_DIR/tx
2323
expect {
2424
timeout { close; ::AlgorandGoal::Abort "failed to inspect transaction file within timeout" }
25-
{One or more non-printable characters were ommited from the following error message:} {
25+
{One or more non-printable characters were omitted from the following error message:} {
2626
set NON_PRINTABLE_CHARS_WARNING 1
2727
exp_continue
2828
}

0 commit comments

Comments
 (0)