Re: Little correction on fdmove doc

2018-07-29 Thread Laurent Bercot

I've found the command intuitive but the documentation confused me a
little bit.

So here's a patch.


 ISTR you actually submitted the same thing a few months ago and I did
not react. Sorry, I should have replied sooner.

 The documentation is correct and I won't apply the patch. But it's
not your fault : you are right that it is a confusing matter.

 The confusion comes from a commonly wrong intuition of what a file
descriptor is. When you "move file descriptors" (typically via dup2(),
which fdmove is implemented over), the move goes in the opposite
direction from what we intuitively think, because we tend to see
the numbers as fixed and the data flows as changing - but the
opposite is happening: the data flow does not change, the numbering
does.

 If you send a mail to "Alice" and it ultimately arrives to "Bob",
then you get the impression that "Alice" and "Bob" are two separate
entities and that your mail went *from Alice to Bob*. But that's
not what's happening with file descriptors. What really happened
is that Bob changed their name *from Bob to Alice*, and when you
send mail to Alice, it reaches the correct recipient that your mind
still identifies as Bob.
 (Please don't deadname file descriptors, or people. It's rude.)

 So when you do "fdmove 2 1", the data you send as what you still
perceive as stderr will now be sent to what you still perceive as
stdout, so you think fdfrom is 2 and fdto is 1. But the reality is
that your perception is wrong - what happened is that stdout just
changed its numbering *from 1 to 2*, so it's now called stderr.

 You now have the responsibility to untangle the confusion among your
friends and co-workers when it arises. :)

--
 Laurent



Little correction on fdmove doc

2018-07-29 Thread Joshua Haase

I've found the command intuitive but the documentation confused me a
little bit.

So here's a patch.

>From bb4dbf267857737ad88240d2ad9cead9b3c3481f Mon Sep 17 00:00:00 2001
From: Joshua Haase 
Date: Sun, 29 Jul 2018 04:44:57 -0500
Subject: [PATCH] fdmove documentation have fd backwards.

---
 doc/fdmove.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/fdmove.html b/doc/fdmove.html
index 39bdb2b..c56787a 100644
--- a/doc/fdmove.html
+++ b/doc/fdmove.html
@@ -26,7 +26,7 @@ executes a program.
  Interface 
 
 
- fdmove [ -c ] fdto fdfrom prog...
+ fdmove [ -c ] fdfrom fdto prog...
 
 
 
-- 
2.17.1