Bash-3.1 Official Patch 11

2006-03-04 Thread Chet Ramey
 BASH PATCH REPORT
 =

Bash-Release: 3.1
Patch-ID: bash31-011

Bug-Reported-by: Mike Stroyan <[EMAIL PROTECTED]>
Bug-Reference-ID: <[EMAIL PROTECTED]>
Bug-Reference-URL: 
http://lists.gnu.org/archive/html/bug-bash/2006-01/msg00033.html

Bug-Description:

A change in bash-3.1 caused the single quotes to be stripped from ANSI-C
quoting inside double-quoted command substitutions.

Patch:

*** ../bash-3.1/parse.y Fri Nov 11 23:14:18 2005
--- parse.y Wed Jan 25 14:55:18 2006
***
*** 2908,2912 
count--;
  if (ch == '(')/* ) */
!   nestret = parse_matched_pair (0, '(', ')', &nestlen, rflags);
  else if (ch == '{')   /* } */
nestret = parse_matched_pair (0, '{', '}', &nestlen, 
P_FIRSTCLOSE|rflags);
--- 2914,2918 
count--;
  if (ch == '(')/* ) */
!   nestret = parse_matched_pair (0, '(', ')', &nestlen, rflags & 
~P_DQUOTE);
  else if (ch == '{')   /* } */
nestret = parse_matched_pair (0, '{', '}', &nestlen, 
P_FIRSTCLOSE|rflags);
*** ../bash-3.1/patchlevel.hWed Jul 20 13:58:20 2005
--- patchlevel.hWed Dec  7 13:48:42 2005
***
*** 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 10
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 11
  
  #endif /* _PATCHLEVEL_H_ */

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
   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: Bash-3.1 Official patch 10

2006-03-04 Thread Chet Ramey
Greg Schafer wrote:

> It appears there might be problem with this patch. Here is a test case I
> distilled from the grep-2.5.1a testsuite:
> 
> status=`echo '-'| { ${GREP} -E -e 'a\' >/dev/null 2>&1 ; echo $?; }`
> 
> Put that line into a file called "myfile" then run like this:
> 
> # bash -n myfile   
> myfile: line 1: unexpected EOF while looking for matching `''
> myfile: line 2: syntax error: unexpected end of file
> 
> AFAICT, this used to be accepted by older Bash versions.
> 
> Do think problem lies with this Bash patch or with test case?

It looks like the patch is over-agressive allowing backslashes to
quote characters in a backquoted command substitution.  I will update
the patch, and send out the new one.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
   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


cd ${DIRSTACK[1]} fails on use of ~

2006-03-04 Thread llattanzi+bash

Configuration Information [Automatically generated, do not change]:
Machine: powerpc
OS: darwin9.0
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='powerpc' - 
DCONF_OSTYPE='darwin9.0' -DCONF_MACHTYPE='powerpc-apple-darwin9.0' - 
DCONF_VENDOR='apple' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'  
-DSHELL -DHAVE_CONFIG_H -DMACOSX   -I.  -I/SourceCache/bash/bash-61/ 
bash -I/SourceCache/bash/bash-61/bash/include -I/SourceCache/bash/ 
bash-61/bash/lib -I/SourceCache/bash/bash-61/bash/lib/intl -I/private/ 
var/tmp/bash/bash-61.obj~2/lib/intl  -arch i386 -arch ppc -g -Os - 
pipe -no-cpp-precomp -mdynamic-no-pic -DM_UNIX -arch i386 -arch ppc - 
pipe
uname output: Darwin zardoz.apple.com 9.0.0d1 Darwin Kernel Version  
9.0.0d1: Sun Feb 26 17:29:52 PST 2006; root:xnu-848.obj~3/RELEASE_PPC  
Power Macintosh

Machine Type: powerpc-apple-darwin9.0

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

Description:
PR-4458849
if ~ ends up in $DIRSTACK you can't directly cd to ${DIRSTACK[n]}

Repeat-By:
cd /var/tmp
mkdir test
HOME=/var/tmp
cd test
pushd ./
cd ..
cd ${DIRSTACK[1]}
# error from bash
bash: cd: ~/test: No such file or directory
# ktrace shows a stat("/var/tmp/~") failing


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


Re: incorrect handling of invisible characters in prompt string

2006-03-04 Thread Chet Ramey
Eric Blake wrote:
> [Please use mailing lists instead of sending private mail
> to random developers - I don't know whether you
> intended this as a question about bash proper or
> about the cygwin port of bash, so I have cross-posted
> my reply]
> 
>> Hi Eric,
>>
>> I found the following message (from July 2005) by you on the cygwin 
>> mailing list:
>>
>> http://cygwin.com/ml/cygwin/2005-07/msg00659.html
>>
>> As you probably know, that bug is still there :-)
> 
> Yes, readline 5.1 still mishandles invisible characters present
> in one-line prompts when compiled for multibyte support, at
> least on cygwin, and I still don't know a root cause.

If you come up with something I can reproduce, I will take another
look at it.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
   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


backtick expansion is truncated

2006-03-04 Thread Brian Minton
Configuration Information [Automatically generated, do not change]:
Machine: i486
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I../bash -I../bash/include -I../bash/lib   -g -O2
uname output: Linux bminton.is-a-geek.net 2.6.15.4 #0 SMP Sat Feb 18 12:04:34 
EST 2006 i686 GNU/Linux
Machine Type: i486-pc-linux-gnu

Bash Version: 3.1
Patch Level: 5
Release Status: release

Description:
If I use a long backtick expansion, it is not all evaluated in some 
circumstances (but it apparently is if only using builtins).

Repeat-By:
for f in `seq 2`; do ls /dev/null; done|wc -l
yields 4097, not 2 that it should.  However,
for f in `seq 2`; do echo /dev/null; done|wc -l
yields 2 (presumably because of using the bash builtin echo)


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


Bash-3.1 Official Patch 10 - UPDATED

2006-03-04 Thread Chet Ramey
 BASH PATCH REPORT
 =

Bash-Release: 3.1
Patch-ID: bash31-010

Bug-Reported-by: [EMAIL PROTECTED]
Bug-Reference-ID: <[EMAIL PROTECTED]>
Bug-Reference-URL: 
http://lists.gnu.org/archive/html/bug-bash/2006-01/msg00090.html

Bug-Description:

There is a difference in behavior between bash-3.0 and bash-3.1 involving
parsing of single- and double-quoted strings occurring in old-style
command substitution.  The difference has to do with how backslashes are
processed.  This patch restores a measure of backwards compatibility while
the question of POSIX conformance and ultimately correct behavior is discussed.

THIS IS AN UPDATED PATCH.  USE THIS COMMAND TO REVERSE THE EFFECTS OF
THE ORIGINAL PATCH.  THE CURRENT DIRECTORY MUST BE THE BASH-3.1 SOURCE
DIRECTORY.

patch -p0 -R < bash31-010.orig

Then apply this patch as usual.

Patch:

*** ../bash-3.1/parse.y Fri Nov 11 23:14:18 2005
--- parse.y Thu Feb 23 08:21:12 2006
***
*** 2716,2721 
--- 2723,2729 
  #define P_ALLOWESC0x02
  #define P_DQUOTE  0x04
  #define P_COMMAND 0x08/* parsing a command, so look for comments */
+ #define P_BACKQUOTE   0x10/* parsing a backquoted command substitution */
  
  static char matched_pair_error;
  static char *
***
*** 2725,2736 
   int *lenp, flags;
  {
int count, ch, was_dollar, in_comment, check_comment;
!   int pass_next_character, nestlen, ttranslen, start_lineno;
char *ret, *nestret, *ttrans;
int retind, retsize, rflags;
  
count = 1;
!   pass_next_character = was_dollar = in_comment = 0;
check_comment = (flags & P_COMMAND) && qc != '\'' && qc != '"' && (flags & 
P_DQUOTE) == 0;
  
/* RFLAGS is the set of flags we want to pass to recursive calls. */
--- 2733,2744 
   int *lenp, flags;
  {
int count, ch, was_dollar, in_comment, check_comment;
!   int pass_next_character, backq_backslash, nestlen, ttranslen, start_lineno;
char *ret, *nestret, *ttrans;
int retind, retsize, rflags;
  
count = 1;
!   pass_next_character = backq_backslash = was_dollar = in_comment = 0;
check_comment = (flags & P_COMMAND) && qc != '\'' && qc != '"' && (flags & 
P_DQUOTE) == 0;
  
/* RFLAGS is the set of flags we want to pass to recursive calls. */
***
*** 2742,2752 
start_lineno = line_number;
while (count)
  {
! #if 0
!   ch = shell_getc ((qc != '\'' || (flags & P_ALLOWESC)) && 
pass_next_character == 0);
! #else
!   ch = shell_getc (qc != '\'' && pass_next_character == 0);
! #endif
if (ch == EOF)
{
  free (ret);
--- 2750,2757 
start_lineno = line_number;
while (count)
  {
!   ch = shell_getc (qc != '\'' && pass_next_character == 0 && 
backq_backslash == 0);
! 
if (ch == EOF)
{
  free (ret);
***
*** 2771,2779 
  continue;
}
/* Not exactly right yet */
!   else if (check_comment && in_comment == 0 && ch == '#' && (retind == 0 
|| ret[retind-1] == '\n' || whitespace (ret[retind -1])))
in_comment = 1;
  
if (pass_next_character)/* last char was backslash */
{
  pass_next_character = 0;
--- 2776,2791 
  continue;
}
/* Not exactly right yet */
!   else if MBTEST(check_comment && in_comment == 0 && ch == '#' && (retind 
== 0 || ret[retind-1] == '\n' || whitespace (ret[retind - 1])))
in_comment = 1;
  
+   /* last char was backslash inside backquoted command substitution */
+   if (backq_backslash)
+   {
+ backq_backslash = 0;
+ /* Placeholder for adding special characters */
+   }
+ 
if (pass_next_character)/* last char was backslash */
{
  pass_next_character = 0;
***
*** 2814,2819 
--- 2824,2831 
{
  if MBTEST((flags & P_ALLOWESC) && ch == '\\')
pass_next_character++;
+ else if MBTEST((flags & P_BACKQUOTE) && ch == '\\')
+   backq_backslash++;
  continue;
}
  
***
*** 2898,2904 
}
else if MBTEST(qc == '`' && (ch == '"' || ch == '\'') && in_comment == 
0)
{
! nestret = parse_matched_pair (0, ch, ch, &nestlen, rflags);
  goto add_nestret;
}
else if MBTEST(was_dollar && (ch == '(' || ch == '{' || ch == '[')) 
/* ) } ] */
--- 2910,2920 
}
else if MBTEST(qc == '`' && (ch == '"' || ch == '\'') && in_comment == 
0)
{
! /* Add P_BACKQUOTE so backslash quotes the next character and
!shell_getc does the right thing with \.  We do this for
!a measure  of backwards compatibility -- it's not strictly the
!right POSIX thing. */
! nestret = parse_matched_pair (0, ch, ch, &nestlen, 
rflags|P_BACKQUOTE);
  goto add_nestret;
}

Re: BUG: ls -ld directory/

2006-03-04 Thread Paul Jarc
G C McNeil-Watson <[EMAIL PROTECTED]> wrote:
> If you do an
>
>  ls -ld directory/
>
> for some existing directory then the output contains TWO trailling
> slashes:
>
>  drwx--  2 pypgcm users 4096 Aug 16  2005 directory//
>
> The directory and the first slash appear in blue on my terminal, trailing
> slash in black.

You probably have ls aliased to 'ls -F', or some combination of
options that includes -F.  (Check with "alias ls".)  Read the
documentation for ls to see if there is a different combination of
options that gives you the behavior you want.  If you can't find it,
you can write to bug-coreutils@gnu.org to submit a feature request.


paul


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