Re: can we have checkwinsize by default?

2012-03-12 Thread Marc MAURICE

Alright Chet, Thanks for the response.

Marc

Le 11/03/2012 19:48, Chet Ramey a écrit :

On 3/9/12 9:51 AM, dooble M wrote:


Fix:
 Make it the default?
 Debian have this in /etc/bash.bashrc :

 # check the window size after each command and, if necessary,
 # update the values of LINES and COLUMNS.
 shopt -s checkwinsize

 I think it should be the default.

It's easy enough to set in a startup file, but the next version of bash
will make it settable at build time using an editable default in
config-top.h.

Chet





Bash-4.2 Official Patch 21

2012-03-12 Thread Chet Ramey
 BASH PATCH REPORT
 =

Bash-Release:   4.2
Patch-ID:   bash42-021

Bug-Reported-by:Dan Douglas 
Bug-Reference-ID:   <4585554.nZWb4q7YoZ@smorgbox>
Bug-Reference-URL:  
http://lists.gnu.org/archive/html/bug-bash/2011-12/msg00084.html

Bug-Description:

Using `read -N' to assign values to an array can result in NUL values being
assigned to some array elements.  These values cause seg faults when referenced
later.

Patch (apply with `patch -p0'):

*** ../bash-4.2-patched/builtins/read.def   2011-11-21 18:03:38.0 
-0500
--- builtins/read.def   2011-12-19 19:52:12.0 -0500
***
*** 738,742 
}
  else
!   var = bind_read_variable (varname, t);
}
else
--- 775,779 
}
  else
!   var = bind_read_variable (varname, t ? t : "");
}
else
***
*** 799,803 
  }
else
! var = bind_read_variable (list->word->word, input_string);
  
if (var)
--- 836,840 
  }
else
! var = bind_read_variable (list->word->word, input_string ? input_string : 
"");
  
if (var)
*** ../bash-4.2-patched/patchlevel.hSat Jun 12 20:14:48 2010
--- patchlevel.hThu Feb 24 21:41:34 2011
***
*** 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 20
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 21
  
  #endif /* _PATCHLEVEL_H_ */

-- 
``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/



Bash-4.2 Official Patch 22

2012-03-12 Thread Chet Ramey
 BASH PATCH REPORT
 =

Bash-Release:   4.2
Patch-ID:   bash42-022

Bug-Reported-by:Gregory Margo 
Bug-Reference-ID:   <20110727174529.ga3...@pacbell.net>
Bug-Reference-URL:  
http://lists.gnu.org/archive/html/bug-bash/2011-07/msg00102.html

Bug-Description:

The return value from lseek is `off_t'.  This can cause corrupted return
values when the file offset is greater than 2**31 - 1.

Patch (apply with `patch -p0'):

*** ../bash-4.2-patched/lib/sh/zread.c  Mon Mar  2 08:54:45 2009
--- lib/sh/zread.c  Thu Jul 28 18:16:53 2011
***
*** 161,166 
   int fd;
  {
!   off_t off;
!   int r;
  
off = lused - lind;
--- 161,165 
   int fd;
  {
!   off_t off, r;
  
off = lused - lind;
***
*** 169,173 
  r = lseek (fd, -off, SEEK_CUR);
  
!   if (r >= 0)
  lused = lind = 0;
  }
--- 168,172 
  r = lseek (fd, -off, SEEK_CUR);
  
!   if (r != -1)
  lused = lind = 0;
  }
*** ../bash-4.2-patched/patchlevel.hSat Jun 12 20:14:48 2010
--- patchlevel.hThu Feb 24 21:41:34 2011
***
*** 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 21
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 22
  
  #endif /* _PATCHLEVEL_H_ */

-- 
``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/



Bash-4.2 Official Patch 23

2012-03-12 Thread Chet Ramey
 BASH PATCH REPORT
 =

Bash-Release:   4.2
Patch-ID:   bash42-023

Bug-Reported-by:Ewan Mellor 
Bug-Reference-ID:   
<6005be083bf501439a84dc3523bac82dc4b964f...@lonpmailbox01.citrite.net>
Bug-Reference-URL:  

Bug-Description:

Under some circumstances, an exit trap triggered by a bad substitution
error when errexit is enabled will cause the shell to exit with an
incorrect exit status (0).

Patch (apply with `patch -p0'):

*** ../bash-4.2-patched/subst.c 2011-11-21 12:04:38.0 -0500
--- subst.c 2012-02-08 13:36:28.0 -0500
***
*** 7275,7278 
--- 7281,7285 
  case '\0':
  bad_substitution:
+   last_command_exit_value = EXECUTION_FAILURE;
report_error (_("%s: bad substitution"), string ? string : "??");
FREE (value);
*** ../bash-4.2-patched/error.c 2009-08-21 22:31:31.0 -0400
--- error.c 2012-02-25 15:54:40.0 -0500
***
*** 201,205 
va_end (args);
if (exit_immediately_on_error)
! exit_shell (1);
  }
  
--- 201,209 
va_end (args);
if (exit_immediately_on_error)
! {
!   if (last_command_exit_value == 0)
!   last_command_exit_value = 1;
!   exit_shell (last_command_exit_value);
! }
  }
  
*** ../bash-4.2-patched/patchlevel.hSat Jun 12 20:14:48 2010
--- patchlevel.hThu Feb 24 21:41:34 2011
***
*** 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 22
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 23
  
  #endif /* _PATCHLEVEL_H_ */

-- 
``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/



Bash-4.2 Official Patch 24

2012-03-12 Thread Chet Ramey
 BASH PATCH REPORT
 =

Bash-Release:   4.2
Patch-ID:   bash42-024

Bug-Reported-by:Jim Avera 
Bug-Reference-ID:   <4f29e07a.80...@yahoo.com>
Bug-Reference-URL:  
http://lists.gnu.org/archive/html/bug-bash/2012-02/msg1.html

Bug-Description:

When `printf -v' is used to set an array element, the format string contains
`%b', and the corresponding argument is the empty string, the buffer used
to store the value to be assigned can be NULL, which results in NUL being
assigned to the array element.  This causes a seg fault when it's used later.

Patch (apply with `patch -p0'):

*** ../bash-4.2-patched/builtins/printf.def 2011-02-25 12:07:41.0 
-0500
--- builtins/printf.def 2012-02-02 08:37:12.0 -0500
***
*** 256,259 
--- 257,262 
{
  vflag = 1;
+ if (vbsize == 0)
+   vbuf = xmalloc (vbsize = 16);
  vblen = 0;
  if (vbuf)
*** ../bash-4.2-patched/patchlevel.hSat Jun 12 20:14:48 2010
--- patchlevel.hThu Feb 24 21:41:34 2011
***
*** 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 23
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 24
  
  #endif /* _PATCHLEVEL_H_ */

-- 
``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: [bug] Home dir in PS1 not abbreviated to tilde

2012-03-12 Thread Clark J. Wang
On Mon, Mar 12, 2012 at 12:22, Yongzhi Pan  wrote:

> Tested in GNU bash, version 3.00.16(1)-release and 4.1.2(1)-release.
>
> Upon login, home dir is displayed as tilde in PS1:
> pan@BJ-APN-2 ~$ echo $PS1
> \[\033[35m\]\u@\h \w$ \[\033[0m\]
> pan@BJ-APN-2 ~$ pwd
> /export/home/pan/
>
> After a cd command, which change directory to $HOME (not changed at all),
> it is displayed as the complete path:
> pan@BJ-APN-2 ~$ cd
> pan@BJ-APN-2 /export/home/pan$
>
> The reason is that my home in passwd has a trailing slash:
> pan@BJ-APN-2 /export/home/pan$ grep ^$USER: /etc/passwd
> pan:x:896:1::/export/home/pan/:/bin/bash
>

You can also reproduce this by directly setting HOME to
`/export/home/pan/'.


> This is tricky to find. I hope it will display tilde even if home dir entry
> in passwd has one or more trailing slash.
>

I personally don't think this needs to be fixed. :)

>
> PS: I read the source code and do not know where this is done, maybe in
> y.tab.c?
>