* _make suppress error on OpenBSD.
@ 2000-05-09 12:08 Tanaka Akira
2000-05-09 19:34 ` closing stdin (Re: _make suppress error on OpenBSD.) Tanaka Akira
0 siblings, 1 reply; 4+ messages in thread
From: Tanaka Akira @ 2000-05-09 12:08 UTC (permalink / raw)
To: zsh-workers
Z:akr@coulee% Src/zsh -f
coulee% bindkey -e; autoload -U compinit; compinit -D
coulee% make awk: i/o error occurred while closing /dev/stdin
input record number 366, file Makefile
source line number 1
FORCE config install.bin mostlyclean-recursive test
META-FAQ config.h install.fns prep uninstall
Makefile config.status install.html realclean uninstall.bin
all distclean install.info realclean-here uninstall.fns
check distclean-here install.man realclean-recursive uninstall.html
clean distclean-recursive install.modules stamp-h uninstall.info
clean-here install mostlyclean targz-doc uninstall.man
clean-recursive install-strip mostlyclean-here targz-src uninstall.modules
This patch suppress this error.
Index: Completion/User/_make
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_make,v
retrieving revision 1.7
diff -u -r1.7 _make
--- Completion/User/_make 2000/04/27 12:44:21 1.7
+++ Completion/User/_make 2000/05/09 12:04:50
@@ -39,7 +39,7 @@
$(awk '/^[a-zA-Z0-9][^\/\t=]+:/ {print $1}
/^\.include *<bsd\.port\.(subdir\.|pre\.)?mk>/ || /^\.include *".*mk\/bsd\.pkg\.(subdir\.)?mk"/ {
print "fetch fetch-list extract patch configure build install reinstall deinstall package describe checkpatch checksum makesum" }' \
- FS=: $file)
+ FS=: $file </dev/null)
)
fi
_wanted targets expl 'make target' compadd "$tmp[@]" && return 0
--
Tanaka Akira
^ permalink raw reply [flat|nested] 4+ messages in thread
* closing stdin (Re: _make suppress error on OpenBSD.)
2000-05-09 12:08 _make suppress error on OpenBSD Tanaka Akira
@ 2000-05-09 19:34 ` Tanaka Akira
2000-05-10 4:48 ` Bart Schaefer
0 siblings, 1 reply; 4+ messages in thread
From: Tanaka Akira @ 2000-05-09 19:34 UTC (permalink / raw)
To: zsh-workers
In article <hvoog6ggc41.fsf@serein.m17n.org>,
Tanaka Akira <akr@m17n.org> writes:
> Z:akr@coulee% Src/zsh -f
> coulee% bindkey -e; autoload -U compinit; compinit -D
> coulee% make awk: i/o error occurred while closing /dev/stdin
> input record number 366, file Makefile
> source line number 1
I found same problem in zfcd_match. It can easily fixed but I like
more fundamental fix.
This problem is caused by the one true awk behavior. (OpenBSD comes
with the one true awk.) The one true awk closes all file descriptors
which should be opened when exit and complain if it causes an error.
Of course, it assumes that stdin is opened.
http://cm.bell-labs.com/who/bwk/awk.tar.gz
However, we can suppress the error by modifying each awk invocation,
but I think that completion system should redirect stdin from
/dev/null instead of closing it.
--
Tanaka Akira
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: closing stdin (Re: _make suppress error on OpenBSD.)
2000-05-09 19:34 ` closing stdin (Re: _make suppress error on OpenBSD.) Tanaka Akira
@ 2000-05-10 4:48 ` Bart Schaefer
2000-05-10 7:22 ` Tanaka Akira
0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2000-05-10 4:48 UTC (permalink / raw)
To: Tanaka Akira, zsh-workers
On May 10, 4:34am, Tanaka Akira wrote:
} Subject: closing stdin (Re: _make suppress error on OpenBSD.)
}
} > coulee% make awk: i/o error occurred while closing /dev/stdin
}
} This problem is caused by the one true awk behavior. (OpenBSD comes
} with the one true awk.) The one true awk closes all file descriptors
} which should be opened when exit and complain if it causes an error.
}
[...]
}
} However, we can suppress the error by modifying each awk invocation,
} but I think that completion system should redirect stdin from
} /dev/null instead of closing it.
It's a little more complex than this.
Descriptor 0 is being closed by movefd(0) which is called from zle_main()
before executing any user-defined widget, completion or otherwise. This
explains why it doesn't work to invoke e.g. vim from a widget function.
This has some odd side effects, including that assorted opens for things
like shared library loading and directory scans for path searching can end
up using FD 0 temporarily (look at strace output). (Memory mapping of
autoloaded functions also sometimes gets FD 0 but immediately movefd()s it
elsewhere.)
It makes more sense to me from the standpoint of the shell's internals to
simply close FD 0 rather than reopen it on /dev/null. On the other hand,
I've long forgotten (if I ever knew) why the stdin of ZLE functions is
closed. (Zefram?) It's trivial to reopen it again:
function vi-vi-buffer() {
local tmp=${TMPPREFIX}${$}vi
print -R - $BUFFER >| $tmp
vi $tmp </dev/tty # Reopen stdin closed by ZLE
BUFFER="$(<$tmp)"
}
zle -N vi-vi-buffer
bindkey -v ; bindkey -a v vi-vi-buffer
On the other hand, it's probably a good idea that `exec < file' in a widget
doesn't change the whole shell's standard input, so duping and restoring FD
0 is good even if closing it may not be.
In any case, that latter suggests what I think is the best solution for the
completion system.
Index: Completion/Commands/_complete_help
===================================================================
@@ -3,6 +3,7 @@
_complete_help() {
setopt localoptions nullglob rcexpandparam extendedglob
unsetopt markdirs globsubst shwordsplit nounset ksharrays
+ exec </dev/null # ZLE closes stdin, which can cause errors
local _sort_tags=_help_sort_tags text i j k
typeset -A help_funcs help_tags help_sfuncs help_styles
Index: Completion/Core/_main_complete
===================================================================
@@ -18,6 +18,7 @@
setopt localoptions nullglob rcexpandparam extendedglob
unsetopt markdirs globsubst shwordsplit nounset ksharrays
+exec </dev/null # ZLE closes stdin, which can cause errors
local func funcs ret=1 tmp _compskip format nm \
_completers _completer _completer_num curtag _comp_force_list \
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: closing stdin (Re: _make suppress error on OpenBSD.)
2000-05-10 4:48 ` Bart Schaefer
@ 2000-05-10 7:22 ` Tanaka Akira
0 siblings, 0 replies; 4+ messages in thread
From: Tanaka Akira @ 2000-05-10 7:22 UTC (permalink / raw)
To: zsh-workers
In article <1000510044838.ZM2434@candle.brasslantern.com>,
"Bart Schaefer" <schaefer@candle.brasslantern.com> writes:
> In any case, that latter suggests what I think is the best solution for the
> completion system.
Thanks. I reverted 11280.
--
Tanaka Akira
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2000-05-10 7:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-09 12:08 _make suppress error on OpenBSD Tanaka Akira
2000-05-09 19:34 ` closing stdin (Re: _make suppress error on OpenBSD.) Tanaka Akira
2000-05-10 4:48 ` Bart Schaefer
2000-05-10 7:22 ` Tanaka Akira
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).