Help on Bash - Windows, Setting directories for cygwin

2007-01-19 Thread Weasel F. Subs
I've recently reinstalled cygwin (downloaded the packages on December 
19), with bash as one of the packages, but I'm no longer able to read 
the directories such has "/home", "/usr", "/bin" and the like.

Example:

   bash-3.2$ cd /home
   bash: cd: /home: No such file or directory

Is there a way that I can change this? Could you reference to part in 
the manual that tells how this can be done?


Windows XP Professional, Sp2

Cygwin installed on "c:\cygwin". "/cygdrive/c" does work.
bash is located in /cygwin/bin.


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Solaris getcwd() implementation vs BASH

2007-01-19 Thread Petr Sumbera

Hi All,

Solaris doesn't implement getcwd() with support for dynamic allocation 
of memory. This BASH consider as broken so that configure defines 
GETCWD_BROKEN.


Later in bash-3.2/config-bot.h it disables HAVE_GETCWD completely:

/* If we have a getcwd(3), but it calls popen(), #undef HAVE_GETCWD so
   the replacement in getcwd.c will be built. */
#if defined (HAVE_GETCWD) && defined (GETCWD_BROKEN)
#  undef HAVE_GETCWD
#endif

This forces BASH on Solaris to use internal implementation of getcwd() 
from bash-3.2/lib/sh/getcwd.c. Unfortunately this implementation has 
some problems and fails (returns NULL) at very specific situation of 
loop back mounting. It can be fixed but it would bring to this source 
code not very nice platform specific code.


Much more easier is to use Solaris native implementation of getcwd() 
which works at all cases corectly. Please consider following patch for 
bash 3.0 (where I did the testing) as something for beginning of discussion:


--- bash-3.0/builtins/common.c.orig Tue Jan 16 07:23:51 2007
+++ bash-3.0/builtins/common.c  Tue Jan 16 07:25:08 2007
@@ -472,7 +472,11 @@

   if (the_current_working_directory == 0)
 {
+#if defined(GETCWD_BROKEN)
+  the_current_working_directory = getcwd (0, PATH_MAX);
+#else
   the_current_working_directory = getcwd (0, 0);
+#endif
   if (the_current_working_directory == 0)
{
  fprintf (stderr, _("%s: error retrieving current directory: 
%s: %s\n"),

--- bash-3.0/config-bot.h.orig  Tue Jan 16 07:23:35 2007
+++ bash-3.0/config-bot.h   Tue Jan 16 07:24:52 2007
@@ -70,11 +70,13 @@
 #  define TERMIOS_MISSING
 #endif

+#if 0
 /* If we have a getcwd(3), but it calls popen(), #undef HAVE_GETCWD so
the replacement in getcwd.c will be built. */
 #if defined (HAVE_GETCWD) && defined (GETCWD_BROKEN)
 #  undef HAVE_GETCWD
 #endif
+#endif

 #if !defined (HAVE_DEV_FD) && defined (NAMED_PIPES_MISSING)
 #  undef PROCESS_SUBSTITUTION


---

Any comments are welcomed. Please leave me always on copy since I'm not 
on the list.


Thanks,

Petr



___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Extrange behavior

2007-01-19 Thread Jordi Prats
Hi all,
I found a extrange behavior on bash in several machines:

[EMAIL PROTECTED] ~ $
[EMAIL PROTECTED] ~ $ cd //
[EMAIL PROTECTED] // $ pwd
//
[EMAIL PROTECTED] // $ echo $PWD
//
[EMAIL PROTECTED] // $ /bin/pwd
/
[EMAIL PROTECTED] // $ bash --version
GNU bash, version 3.00.16(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2004 Free Software Foundation, Inc.

This also happens on a 3.00.15, 3.1.14, 2.05b.0 on Linux and on 2.05b.0
on MacOSX.

I supose pwd it's a builtin command (as it's cd), so it just prints
$PWD. Is this a bug or a feature? I just found this because of a
misstyping, I'm asking this just for curiosity.

Thank you!
-- 
..
__
   / /  Jordi Prats Català
 C E / S / C A  Systems Department
 /_/Centre de Supercomputació de Catalunya

 Gran Capità, 2-4 (Edifici Nexus) · 08034 Barcelona
 T. 93 205 6464 · F.  93 205 6979 · [EMAIL PROTECTED]
..
pgp:0x5D0D1321
..


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


[Fwd: Extrange behavior]

2007-01-19 Thread Jordi Prats
Sorry, I didn't include the configuration information:

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: x86_64-pc-linux-gnu-gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H  -I.  -I. -I./include -I./lib   -march=k8 -pipe -O2
uname output: Linux a64 2.6.13-gentoo-r5 #2 Wed Feb 8 14:02:44 CET 2006
x86_64 AMD Athlon(tm) 64 Processor 3000+ AuthenticAMD GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 3.0
Patch Level: 16
Release Status: release

This is one bash, do you need all of them?

-- 
..
__
   / /  Jordi Prats Català
 C E / S / C A  Departament de Sistemes
 /_/Centre de Supercomputació de Catalunya

 Gran Capità, 2-4 (Edifici Nexus) · 08034 Barcelona
 T. 93 205 6464 · F.  93 205 6979 · [EMAIL PROTECTED]
..
pgp:0x5D0D1321
..
--- Begin Message ---
Hi all,
I found a extrange behavior on bash in several machines:

[EMAIL PROTECTED] ~ $
[EMAIL PROTECTED] ~ $ cd //
[EMAIL PROTECTED] // $ pwd
//
[EMAIL PROTECTED] // $ echo $PWD
//
[EMAIL PROTECTED] // $ /bin/pwd
/
[EMAIL PROTECTED] // $ bash --version
GNU bash, version 3.00.16(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2004 Free Software Foundation, Inc.

This also happens on a 3.00.15, 3.1.14, 2.05b.0 on Linux and on 2.05b.0
on MacOSX.

I supose pwd it's a builtin command (as it's cd), so it just prints
$PWD. Is this a bug or a feature? I just found this because of a
misstyping, I'm asking this just for curiosity.

Thank you!
-- 
..
__
   / /  Jordi Prats Català
 C E / S / C A  Systems Department
 /_/Centre de Supercomputació de Catalunya

 Gran Capità, 2-4 (Edifici Nexus) · 08034 Barcelona
 T. 93 205 6464 · F.  93 205 6979 · [EMAIL PROTECTED]
..
pgp:0x5D0D1321
..

--- End Message ---
___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


`builtin test -a foo` VS `builtin test ! -a foo`

2007-01-19 Thread Name withheld by request
In article <[EMAIL PROTECTED]>,
Name withheld by request <[EMAIL PROTECTED]> wrote:
>In bash the built-in 'test' command can act either as "and",
>or as a test for file existence:
>
>  ~ $ help test|grep -e -a
>  -a FILETrue if file exists.
>  EXPR1 -a EXPR2 True if both expr1 AND expr2 are true.
>
>I'm pretty sure this is not a bug, but please explain why:
>
>  ~ $ cd /tmp
>  /tmp $ date;uname -a
>  Sat Jan  6 09:09:19 CST 2007
>  Linux alex 2.6.5-1.358 #1 Sat May 8 09:04:50 EDT 2004 i686 athlon i386 
> GNU/Linux
>  /tmp $ touch foo
>  /tmp $ builtin test -a foo && echo hi
>  hi
>  /tmp $ builtin test ! -a foo && echo hi
>  hi
>  /tmp $

A bit more:
 
  /tmp $ rm -f foo; ls foo
  ls: foo: No such file or directory
  /tmp $ builtin test -a foo || echo ho
  ho
  /tmp $ builtin test ! -a foo || echo ho
  /tmp $
   
So 
  builtin test ! -a foo
is equivalent to
  true
ie it's not very useful, what is it I'm missing, why is this not a bug?

--
thanks
Tom

--
/tmp $ help test|egrep -A6 'Other operators'
Other operators:

-o OPTION  True if the shell option OPTION is enabled.
! EXPR True if expr is false.
EXPR1 -a EXPR2 True if both expr1 AND expr2 are true.
EXPR1 -o EXPR2 True if either expr1 OR expr2 is true.
--snip
/tmp $ touch foo;ls foo
foo
/tmp $ test -e foo;echo $?
0
/tmp $ test ! -e foo;echo $?
1
/tmp $ rm foo; ls foo
ls: foo: No such file or directory
/tmp $ test -e foo;echo $?
1
/tmp $ test ! -e foo;echo $?
0
/tmp $




___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Conditional Regexp matching problem in 3.2

2007-01-19 Thread rew
Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash' 
-DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -g -O2
uname output: Linux kansas 2.4.18-26.7.x #1 Mon Feb 24 10:15:02 EST 2003 i686 
unknown
Machine Type: i686-pc-linux-gnu

Bash Version: 3.2
Patch Level: 0
Release Status: release

Description:
A simple regexp match using =~ inside [[ ]] works on 3.0.16
and 3.1 versions of bash, but doesn't in 3.2.

In pre-3.2 versions, the script in "Repeat-By" (below)
produces one line of output: "Dog 01 is Wiggles".  In 3.2, the
regexp no longer matches, so it produces nothing.

Repeat-By:
# run this, eh?
DOG="Dog name - 01 - Wiggles"
if [[ $DOG =~ "([[:alpha:][:blank:]]*)- ([[:digit:]]*) - (.*)$" ]]
then
   echo Dog ${BASH_REMATCH[2]} is ${BASH_REMATCH[3]}
fi

Fix:
[Description of how to fix the problem.  If you don't know a
fix for the problem, don't include this section.]


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Re: `builtin test -a foo` VS `builtin test ! -a foo`

2007-01-19 Thread Chet Ramey
Name withheld by request wrote:

> So 
>   builtin test ! -a foo
> is equivalent to
>   true
> ie it's not very useful, what is it I'm missing, why is this not a bug?

Read the Bash FAQ, question E1.  The operation of test is based on the
number of arguments supplied.

The precedence levels are explained in slightly greater detail in the
bash reference manual and man page.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
   Live Strong.  No day but today.
Chet Ramey, ITS, CWRU[EMAIL PROTECTED]http://cnswww.cns.cwru.edu/~chet/


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Re: Help on Bash - Windows, Setting directories for cygwin

2007-01-19 Thread Chet Ramey
Weasel F. Subs wrote:
> I've recently reinstalled cygwin (downloaded the packages on December
> 19), with bash as one of the packages, but I'm no longer able to read
> the directories such has "/home", "/usr", "/bin" and the like.
> Example:
> 
>bash-3.2$ cd /home
>bash: cd: /home: No such file or directory
> 
> Is there a way that I can change this? Could you reference to part in
> the manual that tells how this can be done?

This is not a bash issue.  I suggest you contact the cygwin lists with
this question.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
   Live Strong.  No day but today.
Chet Ramey, ITS, CWRU[EMAIL PROTECTED]http://cnswww.cns.cwru.edu/~chet/


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Re: Conditional Regexp matching problem in 3.2

2007-01-19 Thread Kevin F. Quinn
On Fri, 19 Jan 2007 00:56:03 -0600 (CST)
[EMAIL PROTECTED] wrote:

>   # run this, eh?
>   DOG="Dog name - 01 - Wiggles"
>   if [[ $DOG =~ "([[:alpha:][:blank:]]*)- ([[:digit:]]*) -
> (.*)$" ]] then
>  echo Dog ${BASH_REMATCH[2]} is ${BASH_REMATCH[3]}
>   fi

You can actually get it to work in bash 3.2, by writing:

if [[ $DOG =~ ([[:alpha:][:blank:]]*)-\ ([[:digit:]]*)\ -\ (.*)$ ]]
then
  echo Unquoted Dog ${BASH_REMATCH[2]} is ${BASH_REMATCH[3]}
fi

however this fails in 3.1 - it'll work in 3.1 if you also escape the
brackets, but that then fails in 3.2.  Which means the only way to
guarantee it is to write both, and check the bash version :/


Chet,
any comment on this issue? (see also my earlier mail from Sunday 14th,
http://lists.gnu.org/archive/html/bug-bash/2007-01/msg00035.html, and
Tim's bug at
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=220087)
At least to confirm/deny that it may be a real problem?


Thanks,
-- 
Kevin F. Quinn


signature.asc
Description: PGP signature
___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash