Skip to contentSkip to conversation

dash: details of redirection/duplication in manpage are reversed

PATCH Stéphane Aulery 4 participants 17 messages Nov 10, 2014 – Dec 1, 2014

lore
Share & tools
lore
#0 lore raw

forwarded 501566 [email protected]
stop
-------------------------------------------------------

Hello,

Here is a small patch reported by a user of Debian [1]. Could you please integrate? Thank you for your help.

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=501566

Regards,

Signature · 1 line
Stéphane Aulery
dash.1.new renamed from dash.1.old +2 -2
@@ -402,11 +402,11 @@
 .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.
+Duplicate standard input (or n1) to file descriptor n2.
 .It [n] Ns \*[Lt]&-
 Close standard input (or n).
 .It [n1] Ns \*[Gt]& Ns n2
-Duplicate standard output (or n1) to n2.
+Duplicate standard output (or n1) from n2.
 .It [n] Ns \*[Gt]&-
 Close standard output (or n).
 .It [n] Ns \*[Lt]\*[Gt] file
#1 lore raw
Quoted 39 lines · Stéphane Aulery

--IS0zKkzwUGydFO0o
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit

forwarded 501566 [email protected]
stop
-------------------------------------------------------

Hello,

Here is a small patch reported by a user of Debian [1]. Could you please integrate? Thank you for your help.

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=501566

Regards,

Signature · 5 lines
Stéphane Aulery

--IS0zKkzwUGydFO0o
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment; filename="dash.1.fix-redirection-docs.diff"
dash.1.new renamed from dash.1.old +0 -0
@@ -402,11 +402,11 @@

.It [n] Ns \*[Lt] file
Redirect standard input (or n) from file.
.It [n1] Ns \*[Lt]& Ns n2

dash.1.new renamed from dash.1.old +1 -1
-Duplicate standard input (or n1) from file descriptor n2.
+Duplicate standard input (or n1) to file descriptor n2.

.It [n] Ns \*[Lt]&-
Close standard input (or n).
.It [n1] Ns \*[Gt]& Ns n2

dash.1.new renamed from dash.1.old +1 -1
-Duplicate standard output (or n1) to n2.
+Duplicate standard output (or n1) from n2.
Quoted 3 lines

.It [n] Ns \*[Gt]&-
Close standard output (or n).
.It [n] Ns \*[Lt]\*[Gt] file

I'm sorry but this patch looks wrong and the text looks correct to me as is.

Cheers,

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
#2 lore raw
Quoted 7 lines · Herbert Xu
Quoted 3 lines · Stéphane Aulery

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=501566

I'm sorry but this patch looks wrong and the text looks correct to me as is.

Ok. I passed the information but I'm not really able to judge its pertinence. In this case I close this bug.

Thank you for your help.

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

Re: Bug#501566: dash: details of redirection/duplication in manpage are reversed

Hi,

Quoted 11 lines · Stéphane Aulery
Quoted 7 lines · Herbert Xu
Quoted 3 lines · Stéphane Aulery

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=501566

I'm sorry but this patch looks wrong and the text looks correct to me as is.

Ok. I passed the information but I'm not really able to judge its pertinence. In this case I close this bug.

So, i finally managed to figure out what the problem is. The wording is ambiguous (or maybe just insufficiently clear).

"[n1]>&n2 Duplicate standard output (or n1) to n2."

How i read it (6 years ago :P) was that meant dup2(n1, n2), because the only actual /duplication/ is of file descriptors. I've just realised that the intended meaning is "redirect n1 to where n2 is currently", i.e. dup2(n2, n1), as expected. Can i suggest a simple fix:

"[n1]>&n2 Redirect standard output (or n1) to n2."

It doesn't cover the case where n2 is later changed, and how n1 does not follow this, but it's the simplest fix i see.

Steve

Signature · 2 lines
"You are technically correct, the best kind of correct."
- Bureaucrat 1.0, Futurama
#4 lore raw

Re: Bug#501566: dash: details of redirection/duplication in manpage are reversed

2014-11-11 14:23:21 +0100, Stephen Shirley:

[...]

Quoted 4 lines

"[n1]>&n2 Redirect standard output (or n1) to n2."

It doesn't cover the case where n2 is later changed, and how n1 does not follow this, but it's the simplest fix i see.

[...]

That's ambiguous.

Maybe:

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

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

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

?

Signature · 1 line
Stephane
#5 lore raw

Re: Bug#501566: dash: details of redirection/duplication in manpage are reversed

Quoted 15 lines · Stephane Chazelas
2014-11-11 14:23:21 +0100, Stephen Shirley:

[...]

Quoted 4 lines

"[n1]>&n2 Redirect standard output (or n1) to n2."

It doesn't cover the case where n2 is later changed, and how n1 does not follow this, but it's the simplest fix i see.

[...]

That's ambiguous.

Maybe:

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

Quoted 6 lines

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

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

?

Stephane, please keep the cc list in future list replies as otherwise people may miss your messages since not everyone is subscribed and even those subscribed may filter out messages not addressed to them directly.

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
#6 lore raw

Re: Bug#501566: dash: details of redirection/duplication in manpage are reversed

In reply to Stephen Shirley
Quoted 5 lines · Stephen Shirley

"[n1]>&n2 Redirect standard output (or n1) to n2."

It doesn't cover the case where n2 is later changed, and how n1 does not follow this, but it's the simplest fix i see.

Yes that sounds much better. Please send a patch.

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

Hello,

Quoted 8 lines · Herbert Xu
Quoted 5 lines · Stephen Shirley

"[n1]>&n2 Redirect standard output (or n1) to n2."

It doesn't cover the case where n2 is later changed, and how n1 does not follow this, but it's the simplest fix i see.

Yes that sounds much better. Please send a patch.

Here is one. Stephen, the correction of the first line is abandoned?

[n1]<&n2 Duplicate standard input (or n1) from file descriptor n2.

Regards,

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

Hello,

Quoted 8 lines · Herbert Xu
Quoted 5 lines · Stephen Shirley

"[n1]>&n2 Redirect standard output (or n1) to n2."

It doesn't cover the case where n2 is later changed, and how n1 does not follow this, but it's the simplest fix i see.

Yes that sounds much better. Please send a patch.

Here is one. Stephen, the correction of the first line is abandoned?

[n1]<&n2 Duplicate standard input (or n1) from file descriptor n2.

Regards,

Signature · 1 line
Stéphane Aulery
dash.1.new renamed from dash.1.old +1 -1
@@ -406,7 +406,7 @@
 .It [n] Ns \*[Lt]&-
 Close standard input (or n).
 .It [n1] Ns \*[Gt]& Ns n2
-Duplicate standard output (or n1) to n2.
+Redirect standard output (or n1) to n2.
 .It [n] Ns \*[Gt]&-
 Close standard output (or n).
 .It [n] Ns \*[Lt]\*[Gt] file
#9 lore raw
Quoted 7 lines · Stéphane Aulery

Hello,

Quoted 4 lines · Herbert Xu
Quoted 3 lines · Stephen Shirley

"[n1]>&n2 Redirect standard output (or n1) to n2."

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

It doesn't cover the case where n2 is later changed, and how n1 does not follow this, but it's the simplest fix i see.

Yes that sounds much better. Please send a patch.

Here is one. Stephen, the correction of the first line is abandoned?

[n1]<&n2 Duplicate standard input (or n1) from file descriptor n2.

Please incorporate the comments by Stephane Chazelas.

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
#10 lore raw

Hello,

Quoted 4 lines · Herbert Xu
Quoted 3 lines · Stéphane Aulery
Quoted 2 lines · Herbert Xu
Quoted 1 line · Stephen Shirley
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

"[n1]>&n2 Redirect standard output (or n1) to n2."

Yes that sounds much better. Please send a patch.

Here is one. Stephen, the correction of the first line is abandoned?

Please incorporate the comments by Stephane Chazelas.

I'm not subscribed to the list, I had missed the message of Stephane Chazelas. What proposal do you want please?

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

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

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

Thanks,

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

[MAN] Clarify two redirection mechanisms

In reply to Herbert Xu

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.
+Redirect standard input (or fd n1) from the same resource as currently open on
+fd n2.
 .It [n] Ns \*[Lt]&-
 Close standard input (or n).
 .It [n1] Ns \*[Gt]& Ns n2
-Duplicate standard output (or n1) to n2.
+Redirect standard output (or fd n1) to the same resource as currently open on
+fd n2.
 .It [n] Ns \*[Gt]&-
 Close standard output (or n).
 .It [n] Ns \*[Lt]\*[Gt] file
Signature · 1 line
2.1.3
#12 lore raw

Re: [MAN] Clarify two redirection mechanisms

Quoted 15 lines · [email protected] wrote:

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

Close Debian Bug #501566
---
src/dash.1 | 6 ++++--

1 file changed, 4 insertions(+), 2 deletions(-)
src/dash.1 +0 -0
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

src/dash.1 Append standard output (or n) to file. · line 406

Quoted 3 lines
src/dash.1 +2 -1
-Duplicate standard input (or n1) from file descriptor n2.
+Redirect standard input (or fd n1) from the same resource as currently open on
+fd n2.

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

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
#13 lore raw

Re: [MAN] Clarify two redirection mechanisms

2014-12-01 18:04:56 +0800, Herbert Xu:

[...]

Quoted 11 lines

src/dash.1 Append standard output (or n) to file. · line 406

Quoted 9 lines
src/dash.1 +0 -0
@@ -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

src/dash.1 +2 -1
-Duplicate standard input (or n1) from file descriptor n2.
+Redirect standard input (or fd n1) from the same resource as currently open on
+fd n2.

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

[...]

"file" could be misleading (as actually it's dup(2)ing a file descriptor, so more like redirecting to same _open file description_ (not the same as reopening the file like "n1> /dev/fd/n2" does on Linux for instance) and "file" is understood by many as "regular file" while here, it could be (and often is) socket/pipe/devices...).

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.

The "dupliciting fd x onto y" wording may be more correct, but doesn't convey the redirection idea as clearly IMO.

Signature · 1 line
Stephane
#14 lore raw

Re: Bug#501566: dash: details of redirection/duplication in manpage are reversed

In reply to Stephen Shirley

Hello Stephen,

Quoted 9 lines · Stephen Shirley
Quoted 8 lines · Stéphane Aulery
Quoted 6 lines · Herbert Xu
Quoted 2 lines · Stéphane Aulery

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=501566

I'm sorry but this patch looks wrong and the text looks correct to me as is.

Quoted 7 lines
Quoted 2 lines

Ok. I passed the information but I'm not really able to judge its pertinence. In this case I close this bug.

So, i finally managed to figure out what the problem is. The wording is ambiguous (or maybe just insufficiently clear).

"[n1]>&n2 Duplicate standard output (or n1) to n2."

Herbert rejected both corrections. Your new proposal is better but incomplete. Stéphane Chazelas tried to complete it. Moreover you have not made a new proposal for the first correction.

As I am not dash user, I do not have a good knowledge of the matter. Can you complete your answer / choice, please?

Thank you in advance for your help.

Original version:

1) [n1]<&n2 Duplicate standard input (or n1) from file descriptor n2.

2) [n1]>&n2 Duplicate standard output (or n1) to n2.

Version on Debian bug tracker and refused by H. Xu:

1) [n1]<&n2 Duplicate standard input (or n1) to file descriptor n2.

2) [n1]>&n2 Duplicate standard output (or n1) from n2.

Second version of the patch refused by H. Xu:

2) [n1]>&n2 Redirect standard output (or n1) to n2.

Stéphane Chazelas proposals:

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

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

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

Regards,

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

Re: Bug#501566: dash: details of redirection/duplication in manpage are reversed

Hello Stephen and Herbert,

Stéphane Chazelas just made a complete proposal:

1) [n1]<&n2 Redirect standard input (or fd n1) from the same
resource as open on fd n2.

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

What do you think about?

Regards,

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

Re: Bug#501566: dash: details of redirection/duplication in manpage are reversed

2014-11-19 00:46:03 +0100, Stéphane Aulery:
Quoted 5 lines

Hello Stephen and Herbert,

Stéphane Chazelas just made a complete proposal:

Quoted 8 lines

1) [n1]<&n2 Redirect standard input (or fd n1) from the same
resource as open on fd n2.

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

What do you think about?

[...]

A final touch (add "currently").

[n1]<&n2 Redirect standard input (or fd n1) from the same
resource as currently open on fd n2.

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

Signature · 1 line
Stephane