9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Charles Forsyth <charles.forsyth@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] on cp /fd/1 /fd/0
Date: Tue, 12 May 2015 16:52:35 +0100	[thread overview]
Message-ID: <CAOw7k5jJirWOt=YFqLjshWLJZetB1sA7L-7NB3O4-8cm6oM9Kg@mail.gmail.com> (raw)
In-Reply-To: <CAB08-qoDwuhCB2-uqPEGgHVziEdzpedhugMsvXH0mGhVM8ESbQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 810 bytes --]

On 12 May 2015 at 12:56, Daniel Bastos <dbastos@toledo.com> wrote:

> % cp /fd/1 /fd/0
> cp: can't open /fd/1: '/fd/1' inappropriate use of fd
>
> I can't open it for reading, but I could open it for writing. Why can't I
> open it for reading?
>

The file open on file descriptor 1 wasn't itself opened for reading, only
writing. Check with ls -l /fd/1:

h% ls -l /fd/0 /fd/1
--r-------- d 0 bootes bootes 0 Jul  2  2014 /fd/0
---w------- d 0 bootes bootes 0 Jul  2  2014 /fd/1

The "bootes" is wrong, though: the driver should use up->user (not
hostowner, or even the owner of the underlying file).
You'll notice that someone else had /fd/1 with both r and w, in which case
cp /fd/1 /fd/0 would instead have complained about /fd/0
since /fd/1 could be opened, but /fd/0 can't be written.

[-- Attachment #2: Type: text/html, Size: 1723 bytes --]

      parent reply	other threads:[~2015-05-12 15:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-12 11:56 Daniel Bastos
2015-05-12 12:24 ` Iruatã Souza
2015-05-12 12:39   ` lucio
2015-05-12 13:20     ` erik quanstrom
2015-05-12 14:17   ` Daniel Bastos
2015-05-12 16:15     ` Charles Forsyth
2015-05-12 17:10       ` Daniel Bastos
2015-05-12 18:54         ` Charles Forsyth
2015-05-12 15:52 ` Charles Forsyth [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOw7k5jJirWOt=YFqLjshWLJZetB1sA7L-7NB3O4-8cm6oM9Kg@mail.gmail.com' \
    --to=charles.forsyth@gmail.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).