<(cat) doesn't work but =(cat) does ?

Hi,

when trying this:

	% ssh remotehost "transmission-remote -a <(cat)" < ~/torrent.file

I get this error:

	Couldn't read "/proc/self/fd/11": Not a regular file
	Couldn't add file: /proc/self/fd/11

However when using:

	% ssh remotehost "transmission-remote -a =(cat)" < ~/torrent.file

all is well.

Why doesn't the first form work?

Thanks,

Mikael Magnusson | 26 Sep 20:07
Gravatar

Re: <(cat) doesn't work but =(cat) does ?

2008/9/26 Louis-David Mitterrand <vindex+lists-zsh-users <at> apartia.org>:
> Hi,
>
> when trying this:
>
>        % ssh remotehost "transmission-remote -a <(cat)" < ~/torrent.file
>
> I get this error:
>
>        Couldn't read "/proc/self/fd/11": Not a regular file
>        Couldn't add file: /proc/self/fd/11
>
> However when using:
>
>        % ssh remotehost "transmission-remote -a =(cat)" < ~/torrent.file
>
> all is well.
>
> Why doesn't the first form work?

Presumably for the reasons stated by the program. <() gives you a symlink
to an fd, while =() gives you a temporary file in /tmp which is seekable
and all that.

--

-- 
Mikael Magnusson

Stephane Chazelas | 26 Sep 20:08

Re: <(cat) doesn't work but =(cat) does ?

On Fri, Sep 26, 2008 at 07:30:52PM +0200, Louis-David Mitterrand wrote:
> Hi,
> 
> when trying this:
> 
> 	% ssh remotehost "transmission-remote -a <(cat)" < ~/torrent.file
> 
> I get this error:
> 
> 	Couldn't read "/proc/self/fd/11": Not a regular file
> 	Couldn't add file: /proc/self/fd/11

That's a problem with "transmission-remote". It expects a
regular file and <(cat) is a pipe (transmission-remote and cat
run concurrently). It's the same as:

ssh remotehost "cat | transmission-remote -a /dev/stdin" < ~/torrent.file

You could have done 

ssh remotehost "transmission-remote -a /dev/stdin" < ~/torrent.file

In which case it would probably have been a pipe as well.

$ ssh localhost lsof -ac lsof -d0
Password:
COMMAND   PID     USER   FD   TYPE DEVICE SIZE  NODE NAME
lsof    13428 chazelas    0r  FIFO    0,6      66743 pipe

> However when using:
(Continue reading)

Re: <(cat) doesn't work but =(cat) does ?

On Fri, Sep 26, 2008 at 07:08:16PM +0100, Stephane Chazelas wrote:
> On Fri, Sep 26, 2008 at 07:30:52PM +0200, Louis-David Mitterrand wrote:

 [SNIP]

> Here, zsh creates a temp file. cat and transmission-remote are
> run sequencially (zsh waits for cat to finish fill up the temp
> file and then runs transmission-remote with that temp file name
> as argument), it's the same as
> 
> ssh remotehost "cat > tempfile; transmission -a tempfile" < ~/torrent.file

Stéphane and Mikael: thanks for your answers. It's clear now.


Gmane