Re: Problems with command line scratch files in zsh

2005-06-12 Thread Christopher Black
Why not just 'cat /etc/motd | wc' ?

On Sun, 2005-06-12 at 03:31 -0500, Mike Meyer wrote:
 Since going to 5.x with devfd, I've noticed that some of the shell
 constructs used by zsh (and other shells - I know zsh didn't invent
 this) quit working. To wit:
 
 guru% wc (cat /etc/motd)
 wc: /dev/fd/11: open: No such file or directory
 
 The (...) construct runs the pipe in (), and replaces the (...) with
 the name of the /dev/fd/ entry for the output of that pipe. The file
 exists for the shell process doing all this. But when the comm process
 tries to open the file to read the data, the file doesn't exist. This
 is pretty nasty.
 
 Anyone got any suggestions on how to fix this? A bug report with a
 patch, maybe (I couldn't find any such bug report)? Workarounds? Maybe
 this should go to [EMAIL PROTECTED]
 
   Thanks,
   mike
-- 
Christopher Black
Chief Security Engineer
Secure Crossing
22750 Woodward Suite 304 - Ferndale, MI 48220
Tel (800) 761-4299 | Direct (248) 658-6120
[EMAIL PROTECTED] | www.securecrossing.com


signature.asc
Description: This is a digitally signed message part


Re: Problems with command line scratch files in zsh

2005-06-12 Thread Svein Halvor Halvorsen

* Mike Meyer wrote [2005-06-12 03:31 -0500]
   guru% wc (cat /etc/motd)
   wc: /dev/fd/11: open: No such file or directory


Did you mount the fdescfs filesystem? I have this in my /etc/fstab:

fdesc/dev/fd  fdescfs  rw  0   0

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Problems with command line scratch files in zsh

2005-06-12 Thread Juha Saarinen
On 6/13/05, Svein Halvor Halvorsen
[EMAIL PROTECTED] wrote:
 * Mike Meyer wrote [2005-06-12 03:31 -0500]
guru% wc (cat /etc/motd)
wc: /dev/fd/11: open: No such file or directory
 
 Did you mount the fdescfs filesystem? I have this in my /etc/fstab:
 
 fdesc/dev/fd  fdescfs  rw  0   0

With Bash 3.0.0.16_1, fdescfs not mounted:

#wc (cat /etc/motd)
  24 1611122 /var/tmp//sh-np-3354758488

zsh, fdescfs mounted:

%sudo mount_fdescfs fdescfs /dev/fd
% mount
/dev/ad0s1a on / (ufs, local)
devfs on /dev (devfs, local)
/dev/ad0s1e on /tmp (ufs, local, soft-updates)
/dev/ad0s1f on /usr (ufs, local, soft-updates)
/dev/ad0s1d on /var (ufs, local, soft-updates)
/dev/ad0s1g on /home (ufs, local, soft-updates)
devfs on /var/named/dev (devfs, local)
fdescfs on /dev/fd (fdescfs)

% wc (cat /etc/motd)
  24 1611122 /dev/fd/11


-- 

Juha
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Problems with command line scratch files in zsh

2005-06-12 Thread Mike Meyer
[Format recovered from top posting.]

In [EMAIL PROTECTED], Christopher Black [EMAIL PROTECTED] typed:

 On Sun, 2005-06-12 at 03:31 -0500, Mike Meyer wrote:
  Since going to 5.x with devfd, I've noticed that some of the shell
  constructs used by zsh (and other shells - I know zsh didn't invent
  this) quit working. To wit:
  
  guru% wc (cat /etc/motd)
  wc: /dev/fd/11: open: No such file or directory
  
  The (...) construct runs the pipe in (), and replaces the (...) with
  the name of the /dev/fd/ entry for the output of that pipe. The file
  exists for the shell process doing all this. But when the comm process
  tries to open the file to read the data, the file doesn't exist. This
  is pretty nasty.
  
  Anyone got any suggestions on how to fix this? A bug report with a
  patch, maybe (I couldn't find any such bug report)? Workarounds? Maybe
  this should go to [EMAIL PROTECTED]
 Why not just 'cat /etc/motd | wc' ?

Because I used a trivial example designed to illustrate the problem. A
less trivial example would be:

comm -12 (sort file_one) (sort file_two)

Of course, this can also be rewritten using temp files instead of
pipes. But that will be longer, slower, and uglier.

This worked on 4.X. It ought to work on 5.X.

mike
-- 
Mike Meyer [EMAIL PROTECTED]  http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Problems with command line scratch files in zsh

2005-06-12 Thread Mike Meyer
In [EMAIL PROTECTED], Svein Halvor Halvorsen [EMAIL PROTECTED] typed:
 
 * Mike Meyer wrote [2005-06-12 03:31 -0500]
guru% wc (cat /etc/motd)
wc: /dev/fd/11: open: No such file or directory
 
 Did you mount the fdescfs filesystem? I have this in my /etc/fstab:
 
 fdesc/dev/fd  fdescfs  rw  0   0

That indeed was the problem. Such wasn't required for 4.X. I couldn't
find anything about this searching the FreeBSD web site, or checking
/usr/src/UPDATING. Maybe there's somewhere else I should have looked?

If not, this change should be mentioned in one of those places.

thanks,
mike
-- 
Mike Meyer [EMAIL PROTECTED]  http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Problems with command line scratch files in zsh

2005-06-12 Thread Dan Nelson
In the last episode (Jun 12), Mike Meyer said:
 [Format recovered from top posting.]
 In [EMAIL PROTECTED], Christopher Black [EMAIL PROTECTED] typed:
  On Sun, 2005-06-12 at 03:31 -0500, Mike Meyer wrote:
   Since going to 5.x with devfd, I've noticed that some of the
   shell constructs used by zsh (and other shells - I know zsh
   didn't invent this) quit working. To wit:
   
   guru% wc (cat /etc/motd)
   wc: /dev/fd/11: open: No such file or directory
   
   The (...) construct runs the pipe in (), and replaces the (...)
   with the name of the /dev/fd/ entry for the output of that pipe.
   The file exists for the shell process doing all this. But when
   the comm process tries to open the file to read the data, the
   file doesn't exist. This is pretty nasty.
   
   Anyone got any suggestions on how to fix this? A bug report with
   a patch, maybe (I couldn't find any such bug report)?
   Workarounds? Maybe this should go to [EMAIL PROTECTED]
  Why not just 'cat /etc/motd | wc' ?
 
 Because I used a trivial example designed to illustrate the problem. A
 less trivial example would be:
 
   comm -12 (sort file_one) (sort file_two)
 
 Of course, this can also be rewritten using temp files instead of
 pipes. But that will be longer, slower, and uglier.
 
 This worked on 4.X. It ought to work on 5.X.

If you want a tempfile, you should probably use the =() syntax, which
will always use a tempfile.  () and () will attempt to use /dev/fd. 
It probably worked on 4.* because 4.* creates 64 /dev/fd/* device nodes
on install.  If for some reason zsh had more than 64 files open
already, it would have failed even on 4.*.

-- 
Dan Nelson
[EMAIL PROTECTED]
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Problems with command line scratch files in zsh

2005-06-12 Thread Mike Meyer
In [EMAIL PROTECTED], Dan Nelson [EMAIL PROTECTED] typed:
 In the last episode (Jun 12), Mike Meyer said:
  [Format recovered from top posting.]
  In [EMAIL PROTECTED], Christopher Black [EMAIL PROTECTED] typed:
   On Sun, 2005-06-12 at 03:31 -0500, Mike Meyer wrote:
Since going to 5.x with devfd, I've noticed that some of the
shell constructs used by zsh (and other shells - I know zsh
didn't invent this) quit working. To wit:

guru% wc (cat /etc/motd)
wc: /dev/fd/11: open: No such file or directory

The (...) construct runs the pipe in (), and replaces the (...)
with the name of the /dev/fd/ entry for the output of that pipe.
The file exists for the shell process doing all this. But when
the comm process tries to open the file to read the data, the
file doesn't exist. This is pretty nasty.

Anyone got any suggestions on how to fix this? A bug report with
a patch, maybe (I couldn't find any such bug report)?
Workarounds? Maybe this should go to [EMAIL PROTECTED]
   Why not just 'cat /etc/motd | wc' ?
  
  Because I used a trivial example designed to illustrate the problem. A
  less trivial example would be:
  
  comm -12 (sort file_one) (sort file_two)
  
  Of course, this can also be rewritten using temp files instead of
  pipes. But that will be longer, slower, and uglier.
  
  This worked on 4.X. It ought to work on 5.X.
 
 If you want a tempfile, you should probably use the =() syntax, which
 will always use a tempfile.  () and () will attempt to use /dev/fd. 
 It probably worked on 4.* because 4.* creates 64 /dev/fd/* device nodes
 on install.  If for some reason zsh had more than 64 files open
 already, it would have failed even on 4.*.

But I don't want temp files, I want pipes. That's why I used ().

mike

-- 
Mike Meyer [EMAIL PROTECTED]  http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]