* FreeBSD process substitution bug
@ 2005-10-29 7:06 Steve Atwell
2005-10-29 10:02 ` Peter Stephenson
0 siblings, 1 reply; 7+ messages in thread
From: Steve Atwell @ 2005-10-29 7:06 UTC (permalink / raw)
To: zsh-workers
It seems that zsh process substitution doesn't work properly on recent
versions of FreeBSD. Here's what happens:
% cat <(date)
cat: /dev/fd/11: No such file or directory
This happens to me on FreeBSD 5.4 with zsh 4.2.5 built with default
configure options.
I'm not on the list, so please Cc responses to me.
--
Steve Atwell <satwell@disjoint.net>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: FreeBSD process substitution bug
2005-10-29 7:06 FreeBSD process substitution bug Steve Atwell
@ 2005-10-29 10:02 ` Peter Stephenson
2005-10-29 21:21 ` Steve Atwell
0 siblings, 1 reply; 7+ messages in thread
From: Peter Stephenson @ 2005-10-29 10:02 UTC (permalink / raw)
To: Steve Atwell; +Cc: zsh-workers
Steve Atwell wrote:
> It seems that zsh process substitution doesn't work properly on recent
> versions of FreeBSD. Here's what happens:
>
> % cat <(date)
> cat: /dev/fd/11: No such file or directory
>
> This happens to me on FreeBSD 5.4 with zsh 4.2.5 built with default
> configure options.
That suggests there's something wrong with the following configure test:
any idea what? You should find it works if you #undef PATH_DEV_FD in
config.h.
dnl ----------------------------
dnl CHECK FOR /dev/fd FILESYSTEM
dnl ----------------------------
AH_TEMPLATE([PATH_DEV_FD],
[Define to the path of the /dev/fd filesystem.])
AC_CACHE_CHECK(for /dev/fd filesystem, zsh_cv_sys_path_dev_fd,
[for zsh_cv_sys_path_dev_fd in /proc/self/fd /dev/fd no; do
test x`echo ok|cat $zsh_cv_sys_path_dev_fd/0 2>/dev/null` = xok && break
done])
if test $zsh_cv_sys_path_dev_fd != no; then
AC_DEFINE_UNQUOTED(PATH_DEV_FD, "$zsh_cv_sys_path_dev_fd")
fi
--
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page still at http://www.pwstephenson.fsnet.co.uk/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: FreeBSD process substitution bug
2005-10-29 10:02 ` Peter Stephenson
@ 2005-10-29 21:21 ` Steve Atwell
2005-10-30 16:33 ` Peter Stephenson
0 siblings, 1 reply; 7+ messages in thread
From: Steve Atwell @ 2005-10-29 21:21 UTC (permalink / raw)
To: Peter Stephenson; +Cc: Steve Atwell, zsh-workers
On Sat, Oct 29, 2005 at 11:02:26AM +0100, Peter Stephenson wrote:
>Steve Atwell wrote:
>> % cat <(date)
>> cat: /dev/fd/11: No such file or directory
>>
>> This happens to me on FreeBSD 5.4 with zsh 4.2.5 built with default
>> configure options.
>
>That suggests there's something wrong with the following configure test:
>any idea what? You should find it works if you #undef PATH_DEV_FD in
>config.h.
I did a little more investigation and found the problem. FreeBSD 5.x by
default only provides file descriptors 0, 1, and 2 for the current
process in /dev/fd. If you want to be able to access other file
descriptors, you have to mount the special fdescfs filesystem on
/dev/fd. The configure test to see if zsh can use /dev/fd succeeds
because it only tests /dev/fd/0.
--
Steve Atwell <satwell@disjoint.net>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: FreeBSD process substitution bug
2005-10-29 21:21 ` Steve Atwell
@ 2005-10-30 16:33 ` Peter Stephenson
2005-10-30 17:31 ` Bart Schaefer
2005-10-31 1:33 ` Steve Atwell
0 siblings, 2 replies; 7+ messages in thread
From: Peter Stephenson @ 2005-10-30 16:33 UTC (permalink / raw)
To: Steve Atwell, zsh-workers
> I did a little more investigation and found the problem. FreeBSD 5.x by
> default only provides file descriptors 0, 1, and 2 for the current
> process in /dev/fd. If you want to be able to access other file
> descriptors, you have to mount the special fdescfs filesystem on
> /dev/fd. The configure test to see if zsh can use /dev/fd succeeds
> because it only tests /dev/fd/0.
Thanks for the research. Can you see if the following gives you a
working command substitution in this case?
Index: configure.ac
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.ac,v
retrieving revision 1.41
diff -u -r1.41 configure.ac
--- configure.ac 28 Oct 2005 17:34:33 -0000 1.41
+++ configure.ac 30 Oct 2005 16:31:06 -0000
@@ -1603,7 +1603,7 @@
[Define to the path of the /dev/fd filesystem.])
AC_CACHE_CHECK(for /dev/fd filesystem, zsh_cv_sys_path_dev_fd,
[for zsh_cv_sys_path_dev_fd in /proc/self/fd /dev/fd no; do
- test x`echo ok|cat $zsh_cv_sys_path_dev_fd/0 2>/dev/null` = xok && break
+ test x`echo ok|(exec 3<&0; cat $zsh_cv_sys_path_dev_fd/3 2>/dev/null;)` = xok && break
done])
if test $zsh_cv_sys_path_dev_fd != no; then
AC_DEFINE_UNQUOTED(PATH_DEV_FD, "$zsh_cv_sys_path_dev_fd")
--
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page still at http://www.pwstephenson.fsnet.co.uk/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: FreeBSD process substitution bug
2005-10-30 16:33 ` Peter Stephenson
@ 2005-10-30 17:31 ` Bart Schaefer
2005-10-30 17:39 ` Peter Stephenson
2005-10-31 1:33 ` Steve Atwell
1 sibling, 1 reply; 7+ messages in thread
From: Bart Schaefer @ 2005-10-30 17:31 UTC (permalink / raw)
To: zsh-workers
On Oct 30, 4:33pm, Peter Stephenson wrote:
} Subject: Re: FreeBSD process substitution bug
}
} + test x`echo ok|(exec 3<&0; cat $zsh_cv_sys_path_dev_fd/3 2>/dev/null;)` = xok && break
I was going to suggest something like that, but I wonder if we should
deliberately choose a higher-numbered descriptor than 3.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: FreeBSD process substitution bug
2005-10-30 17:31 ` Bart Schaefer
@ 2005-10-30 17:39 ` Peter Stephenson
0 siblings, 0 replies; 7+ messages in thread
From: Peter Stephenson @ 2005-10-30 17:39 UTC (permalink / raw)
To: Zsh hackers list
Bart Schaefer wrote:
> On Oct 30, 4:33pm, Peter Stephenson wrote:
> } Subject: Re: FreeBSD process substitution bug
> }
> } + test x`echo ok|(exec 3<&0; cat $zsh_cv_sys_path_dev_fd/3 2>/dev/null;)`
> = xok && break
>
> I was going to suggest something like that, but I wonder if we should
> deliberately choose a higher-numbered descriptor than 3.
I thought about that. We can't use 10 or higher as we'd like (that's
where the shell will put the fd's it uses) since the shell syntax
doesn't support it. I couldn't think of any really good reason to pick
9 rather than 3, but it's an easy change that's at worst harmless if you
want to change it. I've now committed the patch with an extra comment.
--
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page still at http://www.pwstephenson.fsnet.co.uk/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: FreeBSD process substitution bug
2005-10-30 16:33 ` Peter Stephenson
2005-10-30 17:31 ` Bart Schaefer
@ 2005-10-31 1:33 ` Steve Atwell
1 sibling, 0 replies; 7+ messages in thread
From: Steve Atwell @ 2005-10-31 1:33 UTC (permalink / raw)
To: Peter Stephenson; +Cc: Steve Atwell, zsh-workers
On Sun, Oct 30, 2005 at 04:33:05PM +0000, Peter Stephenson wrote:
>Thanks for the research. Can you see if the following gives you a
>working command substitution in this case?
Yes, it's detected properly with that patch. Thanks.
--
Steve Atwell <satwell@disjoint.net>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2005-10-31 1:33 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-29 7:06 FreeBSD process substitution bug Steve Atwell
2005-10-29 10:02 ` Peter Stephenson
2005-10-29 21:21 ` Steve Atwell
2005-10-30 16:33 ` Peter Stephenson
2005-10-30 17:31 ` Bart Schaefer
2005-10-30 17:39 ` Peter Stephenson
2005-10-31 1:33 ` Steve Atwell
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).