Skip to content

Commit 69d5c67

Browse files
authored
Protect against non-ascii characters in UESERNAME. (#1864)
1 parent c031edf commit 69d5c67

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

src/GMT.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,7 @@ function __init__(test::Bool=false)
480480
f = joinpath(GMTuserdir[1], "theme_jl.txt")
481481
(isfile(f)) && (theme(readline(f)); ThemeIsOn[] = false) # False because we don't want it reset in showfig()
482482
user = (Sys.isunix() || Sys.isapple()) ? Libc.getpwuid(Libc.getuid(), true).username : Sys.iswindows() ? ENV["USERNAME"] : ""
483+
!isascii(user) && (user = string(hash(user), base = 16)[1:8]) # For non-ASCII user names
483484
TMPDIR_USR.username = replace(user, " " => "_")
484485
haskey(ENV, "JULIA_GMT_MULTIFILE") && (TMPDIR_USR.pid_suffix = string("_", getpid()))
485486
PSname[] = TMPDIR_USR.dir * "/" * "GMTjl_" * TMPDIR_USR.username * TMPDIR_USR.pid_suffix * ".ps"

0 commit comments

Comments
 (0)