z
z copied to clipboard
Error "bash: /dev/fd/62: No such file or directory" with MinGW (git bash)
Hello!
I get the following error when running z in MinGW (git bash 2.23 on Windows 10):
bash: /dev/fd/62: No such file or directory
I added a set -x
in _z
to see what line outputs this, but I doesn't seem obvious to me.
Here is the full output:
$ z tools
+ _z tools
+ set -x
+ local datafile=/c/Users/y.lerestif/.z
+ '[' -h /c/Users/y.lerestif/.z ']'
+ '[' -z '' -a -f /c/Users/y.lerestif/.z -a '!' -O /c/Users/y.lerestif/.z ']'
+ '[' tools = --add ']'
+ '[' tools = --complete -a -s /c/Users/y.lerestif/.z ']'
+ local echo fnd last list opt typ
+ '[' tools ']'
+ case "$1" in
+ fnd=tools
+ last=tools
+ '[' 1 -gt 0 ']'
+ shift
+ '[' '' ']'
+ '[' tools -a tools '!=' '^/c/tools/z ' ']'
+ case "$last" in
+ '[' -f /c/Users/y.lerestif/.z ']'
+ local cd
+++ date +%s
++ awk -v t=1576498307 -v list= -v typ= -v q=tools '-F|' '
function frecent(rank, time) {
# relate frequency and time
dx = t - time
return rank * (3.75/((0.0001 * dx + 1) + 0.25))
}
function output(matches, best_match, common) {
# list or return the desired directory
if( list ) {
cmd = "sort -g >&2"
for( x in matches ) {
if( matches[x] ) {
printf "%-10s %s\n", matches[x], x | cmd
}
}
if( common ) {
printf "%-10s %s\n", "common:", common > "/dev/stderr"
}
} else {
if( common ) best_match = common
print best_match
}
}
function common(matches) {
# find the common root of a list of matches, if it exists
for( x in matches ) {
if( matches[x] && (!short || length(x) < length(short)) ) {
short = x
}
}
if( short == "/" ) return
for( x in matches ) if( matches[x] && index(x, short) != 1 ) {
return
}
return short
}
BEGIN {
gsub(" ", ".*", q)
hi_rank = ihi_rank = -9999999999
}
{
if( typ == "rank" ) {
rank = $2
} else if( typ == "recent" ) {
rank = $3 - t
} else rank = frecent($2, $3)
if( $1 ~ q ) {
matches[$1] = rank
} else if( tolower($1) ~ tolower(q) ) imatches[$1] = rank
if( matches[$1] && matches[$1] > hi_rank ) {
best_match = $1
hi_rank = matches[$1]
} else if( imatches[$1] && imatches[$1] > ihi_rank ) {
ibest_match = $1
ihi_rank = imatches[$1]
}
}
END {
# prefer case sensitive
if( best_match ) {
output(matches, best_match, common(matches))
} else if( ibest_match ) {
output(imatches, ibest_match, common(imatches))
}
}
'
+++ _z_dirs
+++ local line
+++ read line
+++ '[' -d /usr/bin ']'
+++ echo '/usr/bin|2|1576497276'
+++ read line
+++ '[' -d /c/tools/z.lua ']'
+++ echo '/c/tools/z.lua|3|1576242551'
+++ read line
+++ '[' -d /c/cbs/mct ']'
+++ echo '/c/cbs/mct|3|1576237668'
+++ read line
+++ '[' -d /c/tools/z ']'
+++ echo '/c/tools/z|12|1576498132'
+++ read line
+++ '[' -d /c/tools ']'
+++ echo '/c/tools|11|1576497052'
+++ read line
+++ return 0
bash: /dev/fd/62: No such file or directory
+++ _z_dirs
+++ local line
+++ read line
+++ '[' -d /usr/bin ']'
+++ echo '/usr/bin|2|1576497276'
+ cd=
+ '[' 1 -eq 0 ']'
++ history -a
++ ConEmuC -StoreCWD
+++ command pwd -P
++ _z --add /c/tools/z
++ __git_ps1
++ local exit=1
++ local pcmode=no
++ local detached=no
++ local 'ps1pc_start=\u@\h:\w '
++ local 'ps1pc_end=\$ '
++ local 'printf_format= (%s)'
++ case "$#" in
++ printf_format=' (%s)'
++ local ps1_expanded=yes
++ '[' -z '' ']'
++ '[' -z '4.4.23(1)-release' ']'
++ shopt -q promptvars
++ local repo_info rev_parse_exit_code
+++ git rev-parse --git-dir --is-inside-git-dir --is-bare-repository --is-inside-work-tree --short HEAD
++ repo_info='.git
false
false
true
4f08e7f'
++ rev_parse_exit_code=0
++ '[' -z '.git
false
false
true
4f08e7f' ']'
++ local short_sha=
++ '[' 0 = 0 ']'
++ short_sha=4f08e7f
++ repo_info='.git
false
false
true'
++ local inside_worktree=true
++ repo_info='.git
false
false'
++ local bare_repo=false
++ repo_info='.git
false'
++ local inside_gitdir=false
++ local g=.git
++ '[' true = true ']'
++ '[' -n '' ']'
++ local r=
++ local b=
++ local step=
++ local total=
++ '[' -d .git/rebase-merge ']'
++ '[' -d .git/rebase-apply ']'
++ '[' -f .git/MERGE_HEAD ']'
++ __git_sequencer_status
++ local todo
++ test -f .git/CHERRY_PICK_HEAD
++ test -f .git/REVERT_HEAD
++ __git_eread .git/sequencer/todo todo
++ test -r .git/sequencer/todo
++ return 1
++ '[' -f .git/BISECT_LOG ']'
++ '[' -n '' ']'
++ '[' -h .git/HEAD ']'
++ local head=
++ __git_eread .git/HEAD head
++ test -r .git/HEAD
++ IFS='
'
++ read head
++ b=refs/heads/master
++ '[' 'ref: refs/heads/master' = refs/heads/master ']'
++ '[' -n '' ']'
++ local w=
++ local i=
++ local s=
++ local u=
++ local c=
++ local p=
++ '[' true = false ']'
++ '[' true = true ']'
++ '[' -n '' ']'
++ '[' -n '' ']'
++ '[' -n '' ']'
++ '[' -n '' ']'
++ local 'z= '
++ '[' no = yes ']'
++ b=master
++ '[' no = yes ']'
++ local f=
++ local gitstring=master
++ '[' no = yes ']'
++ printf -- ' (%s)' master
++ return 1```
I get the same error (on windows)
I had a similar error, from a bit of a google it appears that the mingw filesystem does not support certain file descriptors, so you have this issue running some commands on git bash, but wouldn't running them on a proper linux machine: https://github.com/bats-core/bats-core/issues/256
This happens on some installations and does not occur on others. This fixed it for me: rm /dev/fd && ln -s /proc/self/fd /dev/fd