diff mbox

dash: details of redirection/duplication in manpage are reversed

Message ID 20141110111951.GA4185@free.fr (mailing list archive)
State Rejected
Delegated to: Herbert Xu
Headers show

Commit Message

Stéphane Aulery Nov. 10, 2014, 11:19 a.m. UTC
forwarded 501566 dash@vger.kernel.org
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,

Comments

Herbert Xu Nov. 10, 2014, 1:24 p.m. UTC | #1
Stéphane Aulery <saulery@free.fr> wrote:
> 
> --IS0zKkzwUGydFO0o
> Content-Type: text/plain; charset=utf-8
> Content-Disposition: inline
> Content-Transfer-Encoding: 8bit
> 
> forwarded 501566 dash@vger.kernel.org
> 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,
> 
> -- 
> Stéphane Aulery
> 
> --IS0zKkzwUGydFO0o
> Content-Type: text/x-diff; charset=utf-8
> Content-Disposition: attachment; filename="dash.1.fix-redirection-docs.diff"
> 
> --- dash.1.old	2014-11-10 12:15:29.809398575 +0100
> +++ dash.1.new	2014-11-10 12:17:03.401856125 +0100
> @@ -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

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

Cheers,
Stéphane Aulery Nov. 10, 2014, 1:49 p.m. UTC | #2
Le lundi 10 novembre 2014 à 09:24:09, Herbert Xu a écrit :
> Stéphane Aulery <saulery@free.fr> wrote:
> > 
> > [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.
Stephen Shirley Nov. 11, 2014, 1:23 p.m. UTC | #3
Hi,

On 10 November 2014 14:49, Stéphane Aulery <saulery@free.fr> wrote:
> Le lundi 10 novembre 2014 à 09:24:09, Herbert Xu a écrit :
>> Stéphane Aulery <saulery@free.fr> wrote:
>> >
>> > [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
Stephane Chazelas Nov. 11, 2014, 2:19 p.m. UTC | #4
2014-11-11 14:23:21 +0100, 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.
[...]

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)

?
Herbert Xu Nov. 11, 2014, 3:08 p.m. UTC | #5
On Tue, Nov 11, 2014 at 02:23:21PM +0100, Stephen Shirley wrote:
>
> "[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,
Stéphane Aulery Nov. 11, 2014, 8:46 p.m. UTC | #6
Hello,

Le mardi 11 novembre 2014 à 11:08:05, Herbert Xu a écrit :
> On Tue, Nov 11, 2014 at 02:23:21PM +0100, Stephen Shirley wrote:
> >
> > "[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,
Herbert Xu Nov. 12, 2014, 2:13 a.m. UTC | #7
Stephane Chazelas <stephane.chazelas@gmail.com> wrote:
> 2014-11-11 14:23:21 +0100, 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.
> [...]
> 
> 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)
> 
> ?

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,
Stéphane Aulery Nov. 18, 2014, 11:27 p.m. UTC | #8
Hello Stephen,

Le mardi 11 novembre 2014 à 02:23:21, Stephen Shirley a écrit :
> On 10 November 2014 14:49, Stéphane Aulery <saulery@free.fr> wrote:
> > Le lundi 10 novembre 2014 à 09:24:09, Herbert Xu a écrit :
> >> Stéphane Aulery <saulery@free.fr> wrote:
> >> >
> >> > [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."


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,
Stéphane Aulery Nov. 18, 2014, 11:46 p.m. UTC | #9
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,
Stephane Chazelas Nov. 19, 2014, midnight UTC | #10
2014-11-19 00:46:03 +0100, Stéphane Aulery:
> 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?
[...]

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.
diff mbox

Patch

--- dash.1.old	2014-11-10 12:15:29.809398575 +0100
+++ dash.1.new	2014-11-10 12:17:03.401856125 +0100
@@ -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