由于某种原因,在 WSL 中自动完成对我来说非常慢,它总是需要几秒钟的时间来显示结果(例如ll ~/Te<tab>
,在 2-3 秒后打印ll ~/Temp
)。
set -x
我尝试使用and查找原因,strace
但看不出问题是什么。
(set -x
参见下面的输出)它停在该行+ [[ ~/Te == \$* ]]
,然后再次停在+ xspec=
使用 时strace
,它会在clone
线路处暂停,并且实际上显示在这些线路处花费了大约 1.4 秒。
知道可能是什么问题吗?
设置-x
+ _init_completion -s
+ local exclude= flag outx errx inx OPTIND=1
+ getopts n:e:o:i:s flag -s
+ case $flag in
+ split=false
+ exclude+==
+ getopts n:e:o:i:s flag -s
+ COMPREPLY=()
+ local 'redir=@(?([0-9])<|?([0-9&])>?(>)|>&)'
+ _get_comp_words_by_ref -n '=<>&' cur prev words cword
+ local exclude flag i OPTIND=1
+ words=()
+ local cur cword words
+ upargs=()
+ upvars=()
+ local upargs upvars vcur vcword vprev vwords
+ getopts c:i:n:p:w: flag -n '=<>&' cur prev words cword
+ case $flag in
+ exclude='=<>&'
+ getopts c:i:n:p:w: flag -n '=<>&' cur prev words cword
+ [[ 6 -ge 3 ]]
+ case ${!OPTIND} in
+ vcur=cur
+ let 'OPTIND += 1'
+ [[ 6 -ge 4 ]]
+ case ${!OPTIND} in
+ vprev=prev
+ let 'OPTIND += 1'
+ [[ 6 -ge 5 ]]
+ case ${!OPTIND} in
+ vwords=words
+ let 'OPTIND += 1'
+ [[ 6 -ge 6 ]]
+ case ${!OPTIND} in
+ vcword=cword
+ let 'OPTIND += 1'
+ [[ 6 -ge 7 ]]
+ __get_cword_at_cursor_by_ref '=<>&' words cword cur
+ words=()
+ local cword words
+ __reassemble_comp_words_by_ref '=<>&' words cword
+ local exclude i j line ref
+ [[ -n =<>& ]]
+ exclude='=<>&'
+ eval cword=1
++ cword=1
+ [[ -n =<>& ]]
+ line='./rsync_tmbackup.sh ~/Te'
+ (( i=0, j=0 ))
+ (( i < 2 ))
+ [[ 0 -gt 0 ]]
+ ref='words[0]'
+ eval 'words[0]=${!ref}${COMP_WORDS[i]}'
++ words[0]=./rsync_tmbackup.sh
+ line=' ~/Te'
+ [[ 0 == 1 ]]
+ (( i++, j++ ))
+ (( i < 2 ))
+ [[ 1 -gt 0 ]]
+ [[ ~/Te == +([=<>&]) ]]
+ ref='words[1]'
+ eval 'words[1]=${!ref}${COMP_WORDS[i]}'
++ words[1]='~/Te'
+ line=
+ [[ 1 == 1 ]]
+ eval cword=1
++ cword=1
+ (( i++, j++ ))
+ (( i < 2 ))
+ [[ 2 == 1 ]]
+ local i cur index=24 'lead=./rsync_tmbackup.sh ~/Te'
+ [[ 24 -gt 0 ]]
+ [[ -n ./rsync_tmbackup.sh ~/Te ]]
+ [[ -n ./rsync_tmbackup.sh~/Te ]]
+ cur='./rsync_tmbackup.sh ~/Te'
+ (( i = 0 ))
+ (( i <= cword ))
+ [[ 24 -ge 19 ]]
+ [[ ./rsync_tmbackup.sh != \.\/\r\s\y\n\c\_\t\m\b\a\c\k\u\p\.\s\h ]]
+ [[ 0 -lt 1 ]]
+ local old_size=24
+ cur=' ~/Te'
+ local new_size=5
+ index=5
+ (( ++i ))
+ (( i <= cword ))
+ [[ 5 -ge 4 ]]
+ [[ ~/T != \~\/\T\e ]]
+ cur='~/Te'
+ (( index-- ))
+ [[ 4 -ge 4 ]]
+ [[ ~/Te != \~\/\T\e ]]
+ [[ 1 -lt 1 ]]
+ (( ++i ))
+ (( i <= cword ))
+ [[ -n ~/Te ]]
+ [[ ! -n ~/Te ]]
+ [[ 4 -lt 0 ]]
+ local words cword cur
+ _upvars -a2 words ./rsync_tmbackup.sh '~/Te' -v cword 1 -v cur '~/Te'
+ (( 10 ))
+ (( 10 ))
+ case $1 in
+ [[ -n 2 ]]
+ printf %d 2
+ [[ -n words ]]
+ unset -v words
+ eval 'words=("${@:3:2}")'
++ words=("${@:3:2}")
+ shift 4
+ (( 6 ))
+ case $1 in
+ [[ -n cword ]]
+ unset -v cword
+ eval 'cword="$3"'
++ cword=1
+ shift 3
+ (( 3 ))
+ case $1 in
+ [[ -n cur ]]
+ unset -v cur
+ eval 'cur="$3"'
++ cur='~/Te'
+ shift 3
+ (( 0 ))
+ [[ -n cur ]]
+ upvars+=("$vcur")
+ upargs+=(-v $vcur "$cur")
+ [[ -n cword ]]
+ upvars+=("$vcword")
+ upargs+=(-v $vcword "$cword")
+ [[ -n prev ]]
+ [[ 1 -ge 1 ]]
+ upvars+=("$vprev")
+ upargs+=(-v $vprev "${words[cword - 1]}")
+ [[ -n words ]]
+ upvars+=("$vwords")
+ upargs+=(-a${#words[@]} $vwords "${words[@]}")
+ (( 4 ))
+ local cur cword prev words
+ _upvars -v cur '~/Te' -v cword 1 -v prev ./rsync_tmbackup.sh -a2 words ./rsync_tmbackup.sh '~/Te'
+ (( 13 ))
+ (( 13 ))
+ case $1 in
+ [[ -n cur ]]
+ unset -v cur
+ eval 'cur="$3"'
++ cur='~/Te'
+ shift 3
+ (( 10 ))
+ case $1 in
+ [[ -n cword ]]
+ unset -v cword
+ eval 'cword="$3"'
++ cword=1
+ shift 3
+ (( 7 ))
+ case $1 in
+ [[ -n prev ]]
+ unset -v prev
+ eval 'prev="$3"'
++ prev=./rsync_tmbackup.sh
+ shift 3
+ (( 4 ))
+ case $1 in
+ [[ -n 2 ]]
+ printf %d 2
+ [[ -n words ]]
+ unset -v words
+ eval 'words=("${@:3:2}")'
++ words=("${@:3:2}")
+ shift 4
+ (( 0 ))
+ _variables
+ [[ ~/Te =~ ^(\$\{?)([A-Za-z0-9_]*)$ ]]
+ return 1
+ [[ ~/Te == @(?([0-9])<|?([0-9&])>?(>)|>&)* ]]
+ [[ ./rsync_tmbackup.sh == @(?([0-9])<|?([0-9&])>?(>)|>&) ]]
+ local i skip
+ (( i=1 ))
+ (( i < 2 ))
+ [[ ~/Te == @(?([0-9])<|?([0-9&])>?(>)|>&)* ]]
+ i=2
+ (( 1 ))
+ (( i < 2 ))
+ [[ 1 -le 0 ]]
+ prev=./rsync_tmbackup.sh
+ [[ -n false ]]
+ _split_longopt
+ [[ ~/Te == --?*=* ]]
+ return 1
+ return 0
+ false
+ _filedir
+ local i 'IFS=
' xspec
+ _tilde '~/Te'
+ local result=0
+ [[ ~/Te == \~* ]]
+ [[ ~/Te != */* ]]
+ return 0
+ local -a toks
+ local quoted x tmp
+ _quote_readline_by_ref '~/Te' quoted
+ '[' -z '~/Te' ']'
+ [[ ~/Te == \'* ]]
+ [[ ~/Te == \~* ]]
+ printf -v quoted '~%q' /Te
+ [[ ~/Te == *\\* ]]
+ [[ ~/Te == \$* ]]
++ compgen -d -- '~/Te'
+ x='~/Temp'
+ read -r tmp
+ toks+=("$tmp")
+ read -r tmp
+ [[ '' != -d ]]
+ xspec=
++ compgen -f -X '' -- '~/Te'
+ x='~/Temp'
+ read -r tmp
+ toks+=("$tmp")
+ read -r tmp
+ [[ -n '' ]]
+ [[ 2 -ne 0 ]]
+ compopt -o filenames
+ COMPREPLY+=("${toks[@]}")
mp
strace -T -f -s9999 -p31972
write(2, "\10\33[K", 4) = 4 <0.000098>
read(0, "\177", 1) = 1 <0.138708>
write(2, "\10\33[K", 4) = 4 <0.000326>
read(0, "\t", 1) = 1 <0.527121>
rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 <0.000017>
open(".", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 <0.000082>
fstat(3, {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0 <0.000029>
brk(0x1130b000) = 0x1130b000 <0.000049>
getdents(3, /* d_reclen < sizeof(struct dirent) *//* 1 entries */, 32768) = 163 <0.000048>
getdents(3, /* 0 entries */, 32768) = 0 <0.000021>
brk(0x112fb000) = 0x112fb000 <0.000031>
close(3) = 0 <0.000035>
rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 <0.000015>
open(".", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 <0.000066>
fstat(3, {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0 <0.000023>
brk(0x1130b000) = 0x1130b000 <0.000038>
getdents(3, /* d_reclen < sizeof(struct dirent) *//* 1 entries */, 32768) = 163 <0.000039>
getdents(3, /* 0 entries */, 32768) = 0 <0.000020>
brk(0x112fb000) = 0x112fb000 <0.000028>
close(3) = 0 <0.000033>
rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 <0.000014>
rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 <0.000014>
open("/dev/null", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3 <0.000053>
fcntl(1, F_GETFD) = 0 <0.000014>
fcntl(1, F_DUPFD, 10) = 10 <0.000024>
fcntl(1, F_GETFD) = 0 <0.000014>
fcntl(10, F_SETFD, FD_CLOEXEC) = 0 <0.000015>
dup2(3, 1) = 1 <0.000026>
close(3) = 0 <0.000019>
fcntl(2, F_DUPFD, 10) = 11 <0.000023>
fcntl(2, F_GETFD) = 0 <0.000014>
fcntl(11, F_SETFD, FD_CLOEXEC) = 0 <0.000014>
dup2(1, 2) = 2 <0.000025>
write(1, "2", 1) = 1 <0.000035>
dup2(11, 2) = 2 <0.000025>
fcntl(11, F_GETFD) = 0x1 (flags FD_CLOEXEC) <0.000014>
close(11) = 0 <0.000019>
dup2(10, 1) = 1 <0.000034>
fcntl(10, F_GETFD) = 0x1 (flags FD_CLOEXEC) <0.000014>
close(10) = 0 <0.000020>
rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 <0.000016>
rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 <0.000014>
rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 <0.000014>
rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 <0.000014>
rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 <0.000014>
rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 <0.000014>
open("/dev/null", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3 <0.000052>
fcntl(1, F_GETFD) = 0 <0.000014>
fcntl(1, F_DUPFD, 10) = 10 <0.000036>
fcntl(1, F_GETFD) = 0 <0.000014>
fcntl(10, F_SETFD, FD_CLOEXEC) = 0 <0.000014>
dup2(3, 1) = 1 <0.000058>
close(3) = 0 <0.000019>
fcntl(2, F_DUPFD, 10) = 11 <0.000038>
fcntl(2, F_GETFD) = 0 <0.000013>
fcntl(11, F_SETFD, FD_CLOEXEC) = 0 <0.000013>
dup2(1, 2) = 2 <0.000024>
write(1, "2", 1) = 1 <0.000025>
dup2(11, 2) = 2 <0.000024>
fcntl(11, F_GETFD) = 0x1 (flags FD_CLOEXEC) <0.000026>
close(11) = 0 <0.000037>
dup2(10, 1) = 1 <0.000041>
fcntl(10, F_GETFD) = 0x1 (flags FD_CLOEXEC) <0.000019>
close(10) = 0 <0.000020>
rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 <0.000016>
rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 <0.000016>
pipe([3, 4]) = 0 <0.000050>
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0 <0.000019>
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 <0.000014>
rt_sigprocmask(SIG_BLOCK, [INT CHLD], [], 8) = 0 <0.000016>
pipe([5, 6]) = 0 <0.000048>
clone(strace: Process 13930 attached
child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f98e14709d0) = 13930 <1.384199>
[pid 13930] rt_sigprocmask(SIG_SETMASK, [], <unfinished ...>
[pid 31972] setpgid(13930, 31972 <unfinished ...>
[pid 13930] <... rt_sigprocmask resumed> NULL, 8) = 0 <0.000166>
[pid 31972] <... setpgid resumed> ) = 0 <0.000170>
[pid 13930] rt_sigaction(SIGTSTP, {SIG_IGN, [], SA_RESTORER, 0x7f98e0a254b0}, <unfinished ...>
[pid 31972] rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 <0.000015>
[pid 13930] <... rt_sigaction resumed> {SIG_IGN, [], SA_RESTORER, 0x7f98e0a254b0}, 8) = 0 <0.000185>
[pid 31972] rt_sigaction(SIGCHLD, {0x447ad0, [], SA_RESTORER|SA_RESTART, 0x7f98e0a254b0}, {0x447ad0, [], SA_RESTORER|SA_RESTART, 0x7f98e0a254b0}, 8) = 0 <0.000015>
[pid 13930] rt_sigaction(SIGTTIN, {SIG_IGN, [], SA_RESTORER, 0x7f98e0a254b0}, <unfinished ...>
[pid 31972] close(5 <unfinished ...>
[pid 13930] <... rt_sigaction resumed> {SIG_IGN, [], SA_RESTORER, 0x7f98e0a254b0}, 8) = 0 <0.000197>
[pid 31972] <... close resumed> ) = 0 <0.000212>
[pid 31972] close(6 <unfinished ...>
[pid 13930] rt_sigaction(SIGTTOU, {SIG_IGN, [], SA_RESTORER, 0x7f98e0a254b0}, <unfinished ...>
[pid 31972] <... close resumed> ) = 0 <0.000211>
[pid 31972] close(4 <unfinished ...>
[pid 13930] <... rt_sigaction resumed> {SIG_IGN, [], SA_RESTORER, 0x7f98e0a254b0}, 8) = 0 <0.000312>
[pid 31972] <... close resumed> ) = 0 <0.000203>
[pid 13930] setpgid(13930, 31972 <unfinished ...>
[pid 31972] read(3, <unfinished ...>
[pid 13930] <... setpgid resumed> ) = 0 <0.000193>
[pid 13930] close(5) = 0 <0.000038>
[pid 13930] close(6) = 0 <0.000051>
[pid 13930] rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7f98e0a254b0}, {0x4aceb0, [], SA_RESTORER, 0x7f98e0a254b0}, 8) = 0 <0.000015>
[pid 13930] rt_sigaction(SIGQUIT, {SIG_DFL, [], SA_RESTORER, 0x7f98e0a254b0}, {SIG_IGN, [], SA_RESTORER, 0x7f98e0a254b0}, 8) = 0 <0.000015>
[pid 13930] rt_sigaction(SIGTERM, {SIG_DFL, [], SA_RESTORER, 0x7f98e0a254b0}, {0x4aceb0, [], SA_RESTORER, 0x7f98e0a254b0}, 8) = 0 <0.000014>
[pid 13930] rt_sigaction(SIGCHLD, {SIG_DFL, [], SA_RESTORER|SA_RESTART, 0x7f98e0a254b0}, {0x447ad0, [], SA_RESTORER|SA_RESTART, 0x7f98e0a254b0}, 8) = 0 <0.000014>
[pid 13930] rt_sigaction(SIGCHLD, {0x447ad0, [], SA_RESTORER|SA_RESTART, 0x7f98e0a254b0}, {SIG_DFL, [], SA_RESTORER|SA_RESTART, 0x7f98e0a254b0}, 8) = 0 <0.000014>
[pid 13930] rt_sigaction(SIGINT, {0x45f790, [], SA_RESTORER, 0x7f98e0a254b0}, {SIG_DFL, [], SA_RESTORER, 0x7f98e0a254b0}, 8) = 0 <0.000018>
[pid 13930] dup2(4, 1) = 1 <0.000026>
[pid 13930] close(4) = 0 <0.000017>
[pid 13930] close(3) = 0 <0.000018>
[pid 13930] rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 <0.000013>
[pid 13930] stat("/home", {st_mode=S_IFDIR|0755, st_size=512, ...}) = 0 <0.000045>
[pid 13930] stat("/home/laurent", {st_mode=S_IFDIR|0755, st_size=512, ...}) = 0 <0.000047>
[pid 13930] open("/home/laurent/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 <0.000174>
[pid 13930] fstat(3, {st_mode=S_IFDIR|0755, st_size=512, ...}) = 0 <0.000018>
[pid 13930] brk(0x1130b000) = 0x1130b000 <0.000036>
[pid 13930] getdents(3, /* d_reclen < sizeof(struct dirent) *//* 1 entries */, 32768) = 1055 <0.000041>
[pid 13930] getdents(3, /* 0 entries */, 32768) = 0 <0.000031>
[pid 13930] brk(0x112fb000) = 0x112fb000 <0.000043>
[pid 13930] close(3) = 0 <0.000041>
[pid 13930] stat("/home/laurent/Temp", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0 <0.000114>
[pid 13930] write(1, "~/Temp\n", 7) = 7 <0.000030>
[pid 31972] <... read resumed> "~/Temp\n", 128) = 7 <0.004531>
[pid 31972] read(3, <unfinished ...>
[pid 13930] exit_group(0) = ?
[pid 31972] <... read resumed> "", 128) = 0 <0.000208>
[pid 31972] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13930, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
[pid 13930] +++ exited with 0 +++
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG|WSTOPPED|WCONTINUED, NULL) = 13930 <0.000015>
wait4(-1, 0x7fffc3fb8170, WNOHANG|WSTOPPED|WCONTINUED, NULL) = -1 ECHILD (No child processes) <0.000017>
rt_sigreturn({mask=[]}) = 0 <0.000021>
close(3) = 0 <0.000039>
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0 <0.000014>
rt_sigprocmask(SIG_BLOCK, [CHLD TSTP TTIN TTOU], [CHLD], 8) = 0 <0.000017>
ioctl(255, TIOCSPGRP, [31972]) = 0 <0.000022>
rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0 <0.000014>
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 <0.000017>
time(NULL) = 1496570476 <0.000013>
open("/tmp/sh-thd-1052277775701132528", O_WRONLY|O_CREAT|O_EXCL|O_TRUNC, 0600) = 3 <0.000451>
write(3, "~/Temp", 6) = 6 <0.000093>
write(3, "\n", 1) = 1 <0.000051>
open("/tmp/sh-thd-1052277775701132528", O_RDONLY) = 4 <0.000979>
close(3) = 0 <0.000057>
unlink("/tmp/sh-thd-1052277775701132528") = 0 <0.000328>
fcntl(0, F_GETFD) = 0 <0.000019>
fcntl(0, F_DUPFD, 10) = 10 <0.000028>
fcntl(0, F_GETFD) = 0 <0.000017>
fcntl(10, F_SETFD, FD_CLOEXEC) = 0 <0.000019>
dup2(4, 0) = 0 <0.000036>
close(4) = 0 <0.000025>
ioctl(0, TCGETS, 0x7fffc3fb88f0) = -1 ENOTTY (Inappropriate ioctl for device) <0.000040>
lseek(0, 0, SEEK_CUR) = 0 <0.000018>
read(0, "~/Temp\n", 128) = 7 <0.000043>
ioctl(0, TCGETS, 0x7fffc3fb88f0) = -1 ENOTTY (Inappropriate ioctl for device) <0.000015>
lseek(0, 0, SEEK_CUR) = 7 <0.000015>
read(0, "", 128) = 0 <0.000028>
dup2(10, 0) = 0 <0.000135>
fcntl(10, F_GETFD) = 0x1 (flags FD_CLOEXEC) <0.000019>
close(10) = 0 <0.000020>
rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 <0.000014>
pipe([3, 4]) = 0 <0.000049>
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0 <0.000018>
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 <0.000016>
rt_sigprocmask(SIG_BLOCK, [INT CHLD], [], 8) = 0 <0.000014>
pipe([5, 6]) = 0 <0.000065>
clone(strace: Process 13931 attached
child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f98e14709d0) = 13931 <1.379717>
[pid 13931] rt_sigprocmask(SIG_SETMASK, [], <unfinished ...>
[pid 31972] setpgid(13931, 31972 <unfinished ...>
[pid 13931] <... rt_sigprocmask resumed> NULL, 8) = 0 <0.000206>
[pid 31972] <... setpgid resumed> ) = 0 <0.000197>
[pid 13931] rt_sigaction(SIGTSTP, {SIG_IGN, [], SA_RESTORER, 0x7f98e0a254b0}, <unfinished ...>
[pid 31972] rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 <0.000018>
[pid 13931] <... rt_sigaction resumed> {SIG_IGN, [], SA_RESTORER, 0x7f98e0a254b0}, 8) = 0 <0.000193>
[pid 31972] rt_sigaction(SIGCHLD, {0x447ad0, [], SA_RESTORER|SA_RESTART, 0x7f98e0a254b0}, {0x447ad0, [], SA_RESTORER|SA_RESTART, 0x7f98e0a254b0}, 8) = 0 <0.000016>
[pid 31972] close(5 <unfinished ...>
[pid 13931] rt_sigaction(SIGTTIN, {SIG_IGN, [], SA_RESTORER, 0x7f98e0a254b0}, <unfinished ...>
[pid 31972] <... close resumed> ) = 0 <0.000164>
[pid 31972] close(6 <unfinished ...>
[pid 13931] <... rt_sigaction resumed> {SIG_IGN, [], SA_RESTORER, 0x7f98e0a254b0}, 8) = 0 <0.000236>
[pid 31972] <... close resumed> ) = 0 <0.000160>
[pid 31972] close(4 <unfinished ...>
[pid 13931] rt_sigaction(SIGTTOU, {SIG_IGN, [], SA_RESTORER, 0x7f98e0a254b0}, <unfinished ...>
[pid 31972] <... close resumed> ) = 0 <0.000128>
[pid 31972] read(3, <unfinished ...>
[pid 13931] <... rt_sigaction resumed> {SIG_IGN, [], SA_RESTORER, 0x7f98e0a254b0}, 8) = 0 <0.000199>
[pid 13931] setpgid(13931, 31972) = 0 <0.000021>
[pid 13931] close(5) = 0 <0.000024>
[pid 13931] close(6) = 0 <0.000033>
[pid 13931] rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7f98e0a254b0}, {0x4aceb0, [], SA_RESTORER, 0x7f98e0a254b0}, 8) = 0 <0.000017>
[pid 13931] rt_sigaction(SIGQUIT, {SIG_DFL, [], SA_RESTORER, 0x7f98e0a254b0}, {SIG_IGN, [], SA_RESTORER, 0x7f98e0a254b0}, 8) = 0 <0.000017>
[pid 13931] rt_sigaction(SIGTERM, {SIG_DFL, [], SA_RESTORER, 0x7f98e0a254b0}, {0x4aceb0, [], SA_RESTORER, 0x7f98e0a254b0}, 8) = 0 <0.000014>
[pid 13931] rt_sigaction(SIGCHLD, {SIG_DFL, [], SA_RESTORER|SA_RESTART, 0x7f98e0a254b0}, {0x447ad0, [], SA_RESTORER|SA_RESTART, 0x7f98e0a254b0}, 8) = 0 <0.000016>
[pid 13931] rt_sigaction(SIGCHLD, {0x447ad0, [], SA_RESTORER|SA_RESTART, 0x7f98e0a254b0}, {SIG_DFL, [], SA_RESTORER|SA_RESTART, 0x7f98e0a254b0}, 8) = 0 <0.000019>
[pid 13931] rt_sigaction(SIGINT, {0x45f790, [], SA_RESTORER, 0x7f98e0a254b0}, {SIG_DFL, [], SA_RESTORER, 0x7f98e0a254b0}, 8) = 0 <0.000014>
[pid 13931] dup2(4, 1) = 1 <0.000028>
[pid 13931] close(4) = 0 <0.000020>
[pid 13931] close(3) = 0 <0.000021>
[pid 13931] rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 <0.000019>
[pid 13931] stat("/home", {st_mode=S_IFDIR|0755, st_size=512, ...}) = 0 <0.000048>
[pid 13931] stat("/home/laurent", {st_mode=S_IFDIR|0755, st_size=512, ...}) = 0 <0.000046>
[pid 13931] open("/home/laurent/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 <0.000181>
[pid 13931] fstat(3, {st_mode=S_IFDIR|0755, st_size=512, ...}) = 0 <0.000020>
[pid 13931] brk(0x1130b000) = 0x1130b000 <0.000040>
[pid 13931] getdents(3, /* d_reclen < sizeof(struct dirent) *//* 1 entries */, 32768) = 1055 <0.000039>
[pid 13931] getdents(3, /* 0 entries */, 32768) = 0 <0.000034>
[pid 13931] brk(0x112fb000) = 0x112fb000 <0.000036>
[pid 13931] close(3) = 0 <0.000054>
[pid 13931] write(1, "~/Temp\n", 7 <unfinished ...>
[pid 31972] <... read resumed> "~/Temp\n", 128) = 7 <0.004304>
[pid 13931] <... write resumed> ) = 7 <0.000231>
[pid 31972] read(3, <unfinished ...>
[pid 13931] exit_group(0) = ?
[pid 31972] <... read resumed> "", 128) = 0 <0.000281>
[pid 31972] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13931, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
[pid 13931] +++ exited with 0 +++
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG|WSTOPPED|WCONTINUED, NULL) = 13931 <0.000020>
wait4(-1, 0x7fffc3fb8090, WNOHANG|WSTOPPED|WCONTINUED, NULL) = -1 ECHILD (No child processes) <0.000023>
rt_sigreturn({mask=[]}) = 0 <0.000026>
close(3) = 0 <0.000048>
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0 <0.000028>
rt_sigprocmask(SIG_BLOCK, [CHLD TSTP TTIN TTOU], [CHLD], 8) = 0 <0.000035>
ioctl(255, TIOCSPGRP, [31972]) = 0 <0.000039>
rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0 <0.000024>
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 <0.000020>
time(NULL) = 1496570477 <0.000039>
open("/tmp/sh-thd-2104555551446992382", O_WRONLY|O_CREAT|O_EXCL|O_TRUNC, 0600) = 3 <0.000467>
write(3, "~/Temp", 6) = 6 <0.000106>
write(3, "\n", 1) = 1 <0.000062>
open("/tmp/sh-thd-2104555551446992382", O_RDONLY) = 4 <0.000707>
close(3) = 0 <0.000050>
unlink("/tmp/sh-thd-2104555551446992382") = 0 <0.000295>
fcntl(0, F_GETFD) = 0 <0.000018>
fcntl(0, F_DUPFD, 10) = 10 <0.000025>
fcntl(0, F_GETFD) = 0 <0.000014>
fcntl(10, F_SETFD, FD_CLOEXEC) = 0 <0.000019>
dup2(4, 0) = 0 <0.000031>
close(4) = 0 <0.000024>
ioctl(0, TCGETS, 0x7fffc3fb8810) = -1 ENOTTY (Inappropriate ioctl for device) <0.000019>
lseek(0, 0, SEEK_CUR) = 0 <0.000015>
read(0, "~/Temp\n", 128) = 7 <0.000042>
ioctl(0, TCGETS, 0x7fffc3fb8810) = -1 ENOTTY (Inappropriate ioctl for device) <0.000017>
lseek(0, 0, SEEK_CUR) = 7 <0.000014>
read(0, "", 128) = 0 <0.000028>
dup2(10, 0) = 0 <0.000120>
fcntl(10, F_GETFD) = 0x1 (flags FD_CLOEXEC) <0.000014>
close(10) = 0 <0.000019>
open("/dev/null", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3 <0.000057>
fcntl(2, F_GETFD) = 0 <0.000017>
fcntl(2, F_DUPFD, 10) = 10 <0.000027>
fcntl(2, F_GETFD) = 0 <0.000017>
fcntl(10, F_SETFD, FD_CLOEXEC) = 0 <0.000017>
dup2(3, 2) = 2 <0.000031>
close(3) = 0 <0.000024>
dup2(10, 2) = 2 <0.000038>
fcntl(10, F_GETFD) = 0x1 (flags FD_CLOEXEC) <0.000017>
close(10) = 0 <0.000025>
stat("~/Temp", 0x7fffc3fb9a80) = -1 ENOENT (No such file or directory) <0.000070>
stat("/home", {st_mode=S_IFDIR|0755, st_size=512, ...}) = 0 <0.000050>
stat("/home/laurent", {st_mode=S_IFDIR|0755, st_size=512, ...}) = 0 <0.000041>
stat("/home/laurent/Temp", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0 <0.000130>
lstat("/home/laurent/Temp", {st_mode=S_IFLNK|0777, st_size=11, ...}) = 0 <0.000038>
stat("/home/laurent/Temp", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0 <0.000104>
write(2, "mp", 2) = 2 <0.000056>
read(0,
答案1
检查您的 PATH 变量。我的包含许多来自 Windows 的条目,例如:
...:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0:...
删除所有多余的条目 - 您不需要WINDOWS
此处的路径。它应该看起来像我的
export PATH=/home/bebbo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
而且表演很棒。
PS:为什么使用
sudo updatedb
帮助?因为一段时间以来,网股的触动和速度都加快了。
答案2
我们正在努力改进下一版本 Windows 的文件系统性能,并为之后的版本进行更深入的更改。
截至 2018 年 2 月,缓慢的 FS 已成为一个公认的错误,我们承诺它会变得更好,但显然也需要 Windows 进行更改。
截至 2019 年中期,他们放弃了在 WSL 中修复该问题的尝试,WSL2 将采用(据称是轻量级)虚拟机,该虚拟机将具有更高的性能。
答案3
应用最新的 Windows 更新 2020-04,然后从cmd.exe
wsl --upgrade <DistributionName>
这需要一段时间。一旦完成,文件系统就会更快。