Re: cd --help should output the complete man page

2011-04-11 Thread Jonathan Nieder
Hi Faheem,

Faheem Mitha wrote:

>   $ cd --help
>   bash: cd: --: invalid option
>   cd: usage: cd [-L|-P] [dir]
>
> I'm don't even know how to get the usage output without
> inducing an error.

Does "help cd" do the trick?

> I think a man page might also be a good idea. You may
> also be aware that in current Debian, the bash manual is not
> packaged

"man builtins" works for me.  It might be worth a wishlist bug to
install cd.1.gz as a symlink to ../man7/builtins.7.gz.

By the way, at least on Debian, we are not quite POSIX conformant with
respect to "cd" and similar non-special builtins.  There should be a
wrapper script on the $PATH so programs using the exec family of
functions can use them (see XCU 1.6 "Built-in utilities").



Re: UTF8 conversion issues in bash-4.2

2011-04-11 Thread Chet Ramey
On 4/11/11 1:10 AM, Allan McRae wrote:
> I am seeing what appears to be some sort of UTF-8 conversion issue in
> bash-4.2.  I do not see this in bash 4.1.   I think the easiest way to
> describe this is:
> 
> 
>> bash41 --version
> GNU bash, version 4.1.9(2)-release (i686-pc-linux-gnu)
> 
>> LC_ALL=ru_RU.UTF-8 bash41 -c привет
> bash: привет: command not found
> 
> 
>> bash42 --version
> GNU bash, version 4.2.8(2)-release (i686-pc-linux-gnu)
> 
>> LC_ALL=ru_RU.UTF-8 bash42 -c привет
> bash: $'\320\277\321\200\320\270\320\262\320\265\321\202': команда не найдена
> 
>> LC_ALL=ru_RU.KOI8-R bash42 -c привет
> bash: привет: ��� �� ��
> 
> 
> I'm not sure what further information is needed here, so let me know if you
> need anything else to replicate this.

There is a change in bash-4.2 that prints characters in error messages
using ANSI-C escapes if isprint() fails for any character in the string.
It's intended to make things like \r in filenames visible.  It came in
from cygwin, but is generally useful.

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: Document what's allowed in function names

2011-04-11 Thread Chet Ramey
> Machine Type: i686-pc-linux-gnu
> 
> Bash Version: 4.2
> Patch Level: 8
> Release Status: release
> 
> Description:
>   man bash is currently lacking information on what is allowed for 
> function
>   names. It implies name with name () compound-command [redirection] and
>   at the start of the manual there is:
> 
>   name   A word consisting only of alphanumeric characters and 
> underscores,
>   and beginning with an alphabetic character or an underscore.  Also 
> referred
>   to as an identifier.
> 
>   In reality the rules for function names are much more loose. For example
>   hyphen and forward slash are allowed. But there are still some 
> restrictions:
>   bash: `aa\'foo': not a valid identifier

It was a mistake to allow such characters in function names (`unset' doesn't
work to unset them without forcing -f, for instance).  We're stuck with them
for backwards compatibility, but I don't have to encourage their use.

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/



coprocess questions (manpage doesn't seem clear)

2011-04-11 Thread Linda Walsh

I was looking @ coprocess section in the manpage where it says that:

 NAME must not be supplied if command is a simple command.
 For the coproc:
   FH1(stdout) is put in NAME[0]
   FH0(stdin)  is put in NAME[1]
   PID is put in NAME_PID

Questions (Seems like these should be in manpage, in this section, or
has this already been revised?):

 1) If Name isn't supplied, where does it put the handles & Pid?

 2) Where does it put FH2 (stderr)?










Re: Document what's allowed in function names

2011-04-11 Thread Linda Walsh



Chet Ramey wrote:

It was a mistake to allow such characters in function names (`unset' doesn't
work to unset them without forcing -f, for instance).  We're stuck with them
for backwards compatibility, but I don't have to encourage their use.

---

Why doesn't bash create some sort of "deprecated' logic like the kernel
or perl use  features that shouldn't be used and are scheduled for deletion?

Then after a well-defined period (N Versions), make the change?

It allows bash to move forward without carrying an increasingly 
larger baggage load into the future.


An example of something that didn't do this for a long time:  Windows.

Then, even MS, realized it couldn't move forward without breaking compat.  
They took alot of heat from this decision -- but much of that was because of 
what replaced it (a stripped down feature set that was considerably slower)

and *why* it was done (to implement DRM).

If it had been a +++ move (more features, faster more reliable), I'm sure
it wouldn't have gotten the heat it did  and might not have required
rebranding to Win7.








Re: cd --help should output the complete man page

2011-04-11 Thread Matias A. Fonzo
>
> Faheem Mitha wrote:
>
>>  $ cd --help
>>  bash: cd: --: invalid option
>>  cd: usage: cd [-L|-P] [dir]
>>
>> I'm don't even know how to get the usage output without
>> inducing an error.
>
> Does "help cd" do the trick?
>

No. ''help cd'' does the trick.

Regards,
Matias.