Skip to contentSkip to conversation

Bug#501566: [MAN] Clarify two redirection mechanisms

DISCUSSION Stéphane Aulery 4 participants 10 messages Dec 8, 2014 – Dec 26, 2014

lore
Share & tools
lore
#0 lore raw

Hello,

Quoted 4 lines · Stéphane Chazelas
Quoted 2 lines · Herbert Xu

"Resource" is rather unwieldy, how about simply "file"?

Quoted 8 lines

"file" could be misleading

[...]

IMO, "resource" is vague enough so as not to give the wrong idea and I like that wording because it conveys the intended mechanism clearly ("redirect to same thing as"). But I agree it's not ideal.

It is true that "resource" is dissonant as "file" is too restrictive. The term "file descriptor" is used above. Why not use it again?

Regards,

Signature · 6 lines
Stéphane Aulery


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
#1 lore raw
2014-12-08 19:50:05 +0100, Stéphane Aulery:
Quoted 14 lines
Quoted 14 lines
Quoted 9 lines
Quoted 7 lines

[n1]>&n2 Redirect standard output (or fd n1) to the same "open
file description" as on fd n2.

[n1]>&n2 Copy fd n2 as stdout (or fd n1)

[n1]>&n2 Redirect standard output (or fd n1) to the same
resource as currently open on fd n2.

"Resource" is rather unwieldy, how about simply "file"?

"file" could be misleading

[...]

Quoted 7 lines
Quoted 4 lines

IMO, "resource" is vague enough so as not to give the wrong idea and I like that wording because it conveys the intended mechanism clearly ("redirect to same thing as"). But I agree it's not ideal.

It is true that "resource" is dissonant as "file" is too restrictive. The term "file descriptor" is used above. Why not use it again?

[...]

If you say redirect fd n1 to fd n2, you confuse people (and I've seen a lot of people being confused in such a way) as they start thinking the fds become somehow linked (for instance that in 2>&1 > file, stderr goes to stdout and then both to "file" which is not the case). When you start thinking of "&" as "/address/ of" (yet another improper wording) or "resource currently open on", that clears that confusion.

If you don't like the "resource" wording, you can always got for the "copy" one above or the POSIX wording:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_07_05

I've seen "resource" used in the past, I've used it myself a few times in usenet articles:

https://groups.google.com/d/msg/comp.unix.shell/48beJpLdjNE/jUak98HUekUJ
https://groups.google.com/d/msg/comp.unix.questions/EQL477tzYKk/J9ysMfqc5YIJ
https://groups.google.com/d/msg/comp.unix.aix/WcWsocnEHS0/hgSDWt19SaYJ

(see the aforementioned confusion in some of the messages that those were replying to).

Signature · 1 line
Stephane
#2 lore raw
Quoted 32 lines · Stephane CHAZELAS
2014-12-08 19:50:05 +0100, Stéphane Aulery:
Quoted 14 lines
Quoted 14 lines
Quoted 9 lines
Quoted 7 lines

[n1]>&n2 Redirect standard output (or fd n1) to the same "open
file description" as on fd n2.

[n1]>&n2 Copy fd n2 as stdout (or fd n1)

[n1]>&n2 Redirect standard output (or fd n1) to the same
resource as currently open on fd n2.

"Resource" is rather unwieldy, how about simply "file"?

"file" could be misleading

[...]

Quoted 7 lines
Quoted 4 lines

IMO, "resource" is vague enough so as not to give the wrong idea and I like that wording because it conveys the intended mechanism clearly ("redirect to same thing as"). But I agree it's not ideal.

It is true that "resource" is dissonant as "file" is too restrictive. The term "file descriptor" is used above. Why not use it again?

[...]

If you say redirect fd n1 to fd n2, you confuse people (and I've seen a lot of people being confused in such a way) as they start thinking the fds become somehow linked (for instance that in 2>&1 > file, stderr goes to stdout and then both to "file" which is not the case). When you start thinking of "&" as "/address/ of" (yet another improper wording) or "resource currently open on", that clears that confusion.

Quoted 3 lines

If you don't like the "resource" wording, you can always got for the "copy" one above or the POSIX wording:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_07_05

As for me, I'm not bothered by the word "resource". It's ok for me as "copy". But Herbert does not agree, so I can not force him:-)).

I wonder more and more if Herbert is willing to accept this tiny patch or another. I would not be wasting his time if he does not want or can not take care of that. This is free software, there is no obligation.

This is my last attempt, if there is no consensus I close the bug regarding Debian.

Have a nice day.

Signature · 1 line
Stéphane Aulery
#3 lore raw

Re: [MAN] Clarify two redirection mechanisms

Hi Stéphane,

Quoted 2 lines · Stéphane Aulery

As for me, I'm not bothered by the word "resource". It's ok for me as "copy". But Herbert does not agree, so I can not force him:-)).

[...]

Quoted 2 lines

This is my last attempt, if there is no consensus I close the bug regarding Debian.

Please don't. I can handle the bug if no one is able to come up with a good wording.

Thanks,
Jonathan

#4 lore raw

Re: [MAN] Clarify two redirection mechanisms

Hi Jonathan,

Quoted 11 lines · Jonathan Nieder
Quoted 2 lines · Stéphane Aulery

As for me, I'm not bothered by the word "resource". It's ok for me as "copy". But Herbert does not agree, so I can not force him:-)).

[...]

Quoted 2 lines

This is my last attempt, if there is no consensus I close the bug regarding Debian.

Please don't. I can handle the bug if no one is able to come up with a good wording.

And how will you do if no one has a good wording?

I am willing to wait.

Regards,

Signature · 1 line
Stéphane Aulery
#5 lore raw
In reply to Stéphane Aulery
2014-12-08 22:22:03 +0100, Stéphane Aulery:
Quoted 6 lines · Stephane CHAZELAS
Quoted 5 lines
2014-12-08 19:50:05 +0100, Stéphane Aulery:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

[n1]>&n2 Redirect standard output (or fd n1) to the same "open
file description" as on fd n2.

[n1]>&n2 Copy fd n2 as stdout (or fd n1)

[...]

Quoted 3 lines

I wonder more and more if Herbert is willing to accept this tiny patch or another. I would not be wasting his time if he does not want or can not take care of that. This is free software, there is no obligation.

[...]

What matters here is the mistake fixed in the manual. n>&p has been around since the end of the 70s. It's unlikely anyone will learn anything about it from the dash man page.

Let's make it:

[n1]>&n2 Copy file descriptor n2 as stdout (or fd n1)
[n1]<&n2 Copy file descriptor n2 as stdin (or fd n1)

That's more or less the POSIX wording. It may not be as descriptive as other ones, but I can't imagine anyone complaining about the correctness or accuracy of it.

Signature · 1 line
Stephane
#6 lore raw
Quoted 9 lines · Stephane CHAZELAS

Let's make it:

[n1]>&n2 Copy file descriptor n2 as stdout (or fd n1)
[n1]<&n2 Copy file descriptor n2 as stdin (or fd n1)

That's more or less the POSIX wording. It may not be as descriptive as other ones, but I can't imagine anyone complaining about the correctness or accuracy of it.

Yes this sounds good to me. Someone please create a patch for it.

BTW, one of you guys dropped me from the CC list again. Please don't do that.

Thanks,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#7 lore raw

[MAN] Clarify two redirection mechanisms

In reply to Stephane CHAZELAS

From: Stéphane Aulery <[email protected]>

Close Debian Bug #501566

---
 src/dash.1 | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
src/dash.1 +4 -2
index d782882..429657a 100644
@@ -402,11 +402,13 @@ Append standard output (or n) to file.
 .It [n] Ns \*[Lt] file
 Redirect standard input (or n) from file.
 .It [n1] Ns \*[Lt]& Ns n2
-Duplicate standard input (or n1) from file descriptor n2.
+Copy file descriptor n2 as stdout (or fd n1).
+fd n2.
 .It [n] Ns \*[Lt]&-
 Close standard input (or n).
 .It [n1] Ns \*[Gt]& Ns n2
-Duplicate standard output (or n1) to n2.
+Copy file descriptor n2 as stdin (or fd n1).
+fd n2.
 .It [n] Ns \*[Gt]&-
 Close standard output (or n).
 .It [n] Ns \*[Lt]\*[Gt] file
Signature · 1 line
2.1.3
#8 lore raw

Re: [MAN] Clarify two redirection mechanisms

Quoted 3 lines · On Thu, Dec 11, 2014 at 10:03:06AM +0100, [email protected] wrote:

From: Stéphane Aulery <[email protected]>

Close Debian Bug #501566

Patch applied.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#9 lore raw

Re: [MAN] Clarify two redirection mechanisms

Quoted 6 lines · Herbert Xu
Quoted 3 lines · On Thu, Dec 11, 2014 at 10:03:06AM +0100, [email protected] wrote:

From: Stéphane Aulery <[email protected]>

Close Debian Bug #501566

Patch applied.

Thanks a lot, Herbert, and a merry Christmas to you !

Signature · 1 line
Stéphane Aulery