Error in bash manual?

2012-04-22 Thread Jan Carreras Prat
>From my point of view in the section REDIRECTION of the man manual there
is something technically incorrect:

/dev/tcp/host/port
    If host is a valid hostname or Internet address, and port
    is  an integer port number or service name, bash attempts
    to open a TCP connection to the corresponding socket
/dev/udp/host/port
    If host is a valid hostname or Internet address, and port
    is  an integer port number or service name, bash attempts
    to open a UDP connection to the corresponding socket.


The sentence I disagree with is:
    "bash attempts to open a UDP connection"

The term 'UDP connection' is incorrect since in UDP there aren't any connections
The definition of UDP (man udp) is:
    This  is  an  implementation  of  the User Datagram Protocol described
    in RFC 768. It implements a *connectionless*, unreliable datagram packet
    service.  Packets may be reordered or duplicated before they arrive.

"Conectionless" is the key.  If we search the term "connection" in RFC768 any
results will appear.  Thus, "UDP connection" seems wrong to me, at least in
this context.

Moreover, "attempts to open" seems incorrect to me, because bash does not attemp
to open anything.  Maybe bash "tries to send" or "attempts to send" a UDP
datagram, but does not try to open anything, nor a connection.

To me, it looks like someone has done copy-paste from the block of TCP
(block that is correct, because TCP is connection-oriented) and just changed TCP
word for UDP.  However, UDP is not the same as TCP and one of the differences is
that UDP *does not establish any type of connections*.

So, I propose to change the sentence:
    "bash attemps to open a UDP connection to the corresponding socket"
to:
    "bash attemps to send a UDP datagram to the corresponding socket"

It's seems to me reasonably accurate

Please, feel free to make any suggestions, variations or whatever. Thanks.

Jan Carreras

Note: I sent this mail to chet.ra...@case.edu twelve days ago and I
don't have a response yet. I guess that the next logic step is sending
the mail to bug-bash@gnu.org. If I'm wrong please point me to the
right place. Thanks.



Re: string replace with multibyte chars and extglob fails with bash-4.2

2012-04-22 Thread Chet Ramey
On 4/21/12 3:27 PM, Andreas Schwab wrote:
> Mike Frysinger  writes:
> 
>> first set your locale to something unicode based:
>> export LC_ALL=en_US.UTF-8
>>
>> then try the simple script (from Ulrich Müller):
>> $ cat test.sh
>> shopt -s extglob
>> text="aaaäöü"
>> echo "${text} ${text//?aa} ${text//\aaa}"
>>
>> with bash-4.1_p2, i get:
>> aaaäöü äöü äöü
>>
>> but with bash-4.2_p8 ... 4.2_p24 (just what i have locally):
>> aaaäöü aaaäöü aaaäöü
> 
> diff --git a/subst.c b/subst.c
> index 9feaa9c..ebd5138 100644
> --- a/subst.c
> +++ b/subst.c
> @@ -4161,7 +4161,7 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, 
> sp, ep)
>simple = (wpat[0] != L'\\' && wpat[0] != L'*' && wpat[0] != L'?' && 
> wpat[0] != L'[');
>  #if defined (EXTENDED_GLOB)
>if (extended_glob)
> -simple |= (wpat[1] != L'(' || (wpat[0] != L'*' && wpat[0] != L'?' && 
> wpat[0] != L'+' && wpat[0] != L'!' && wpat[0] != L'@')); /*)*/
> +simple &= (wpat[1] != L'(' || (wpat[0] != L'*' && wpat[0] != L'?' && 
> wpat[0] != L'+' && wpat[0] != L'!' && wpat[0] != L'@')); /*)*/
>  #endif

Thanks; this is the right fix.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Re: Directory completion problems

2012-04-22 Thread Chet Ramey
On 4/19/12 9:03 AM, Artur Rataj wrote:
> I want the logical view, and I think there is one by now. But there is a
> file missing in the logical directory, when cd ../ is completed from a 
> symlink.
> 
> ~/projects/art/dev$ ls -la
> drwxr-xr-x  6 art art 4096 2012-02-24 16:21 .bzr
> lrwxrwxrwx  1 art art   18 2012-04-16 14:48 lib -> ../../hth/dev/lib/
> drwxr-xr-x  2 art art 4096 2012-02-24 16:21 src
> ~/projects/art/dev$ cd lib/../
> .bzr/ lib/ 
> 
> I have made a test directory, to analyse the problem:
> 
> ~/a$ ls -la
> drwxr-xr-x  5 art art 4096 2012-04-19 14:50 .
> drwxr-xr-x 80 art art 4096 2012-04-19 14:48 ..
> drwxr-xr-x  2 art art 4096 2012-04-19 14:48 .hidden
> drwxr-xr-x  2 art art 4096 2012-04-19 14:50 .java
> lrwxrwxrwx  1 art art7 2012-04-19 14:48 symlink -> ../test
> ~/a$ cd symlink/../
> 
> hitting Tab gives:
> 
> ~/a$ cd symlink/../.java/

I'm wondering if you're using a completion for cd.  Using both bash-4.2.24
and the current development source, I get a completion of "symlink " (with
a space instead of a slash appended, since readline needs some more work
to do the same kind of logical directory traversal that bash does).

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Re: Directory completion problems

2012-04-22 Thread Chet Ramey
On 4/20/12 4:41 AM, Artur Rataj wrote:
> ~/a$ mkdir .java
> ~/a$ cd symlink
> ~/a/symlink$ cd ../.java/
> ~/a/.java$
> ~/a/.java$ cd ../
> ~/a$ rm -r .java && touch .java
> ~/a$ cd symlink
> ~/a/symlink$ cd ../.java/
> ~/.java$
> 
> Should it really be like that?

I can't reproduce it.  Is the following an accurate reproduction of what
you did?

z4.local(2)$ cd test
z4.local(2)$ ls -al
total 4
drwxrwxr-x   5 chet  admin   170 Apr 22 16:36 ./
drwxrwxr-x  88 chet  admin  2992 Apr 22 16:34 ../
drwxrwxr-x   2 chet  admin68 Apr 22 16:36 .hidden/
drwxrwxr-x   2 chet  admin68 Apr 22 16:36 .java/
lrwxrwxr-x   1 chet  admin 7 Apr 22 16:36 symlink@ -> ../test
z4.local(2)$ echo $PWD
/usr/local/build/bash/bash-20120420/test
z4.local(2)$ cd symlink
z4.local(2)$ echo $PWD
/usr/local/build/bash/bash-20120420/test/symlink
z4.local(2)$ cd ../.java
z4.local(2)$ echo $PWD
/usr/local/build/bash/bash-20120420/test/.java
z4.local(2)$ cd ..
z4.local(2)$ echo $PWD
/usr/local/build/bash/bash-20120420/test
z4.local(2)$ rm -r .java && touch .java
z4.local(2)$ ls -al
total 4
drwxrwxr-x   5 chet  admin   170 Apr 22 16:50 ./
drwxrwxr-x  88 chet  admin  2992 Apr 22 16:34 ../
drwxrwxr-x   2 chet  admin68 Apr 22 16:36 .hidden/
-rw-rw-r--   1 chet  admin 0 Apr 22 16:50 .java
lrwxrwxr-x   1 chet  admin 7 Apr 22 16:36 symlink@ -> ../test
z4.local(2)$ cd symlink
z4.local(2)$ echo $PWD
/usr/local/build/bash/bash-20120420/test/symlink
z4.local(2)$ cd ../.java
bash: cd: ../.java: No such file or directory
z4.local(2)$ echo $PWD
/usr/local/build/bash/bash-20120420/test/symlink

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



[patch] fix building when readline is disabled

2012-04-22 Thread Mike Frysinger
if you disable readline, the complete.def code fails to build.  simple patch 
below (not sure if it's correct, but at least gets the conversation going).
-mike

--- a/builtins/complete.def
+++ b/builtins/complete.def
@@ -49,6 +49,8 @@ $END
 
 #include 
 
+#ifdef READLINE
+
 #include 
 
 #include "../bashtypes.h"
@@ -867,3 +869,5 @@ compopt_builtin (list)
 
   return (ret);
 }
+
+#endif


signature.asc
Description: This is a digitally signed message part.