summaryrefslogtreecommitdiff
path: root/debian/patches/bash31-014.dpatch
blob: 6bf598dd762ff6f23001ab72d4eacee6e34e2c55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#! /bin/sh -e

if [ $# -eq 3 -a "$2" = '-d' ]; then
    pdir="-d $3"
elif [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
    -patch) patch $pdir -f --no-backup-if-mismatch -p0 < $0;;
    -unpatch) patch $pdir -f --no-backup-if-mismatch -R -p0 < $0;;
    *)
	echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
	exit 1
esac
exit 0

# DP: Upstream patch bash31-014

			     BASH PATCH REPORT
			     =================

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

Bug-Reported-by: Mike Stroyan <mike.stroyan@hp.com>
Bug-Reference-ID: <20060203191607.GC27614@localhost>
Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2006-02/msg00004.html

Bug-Description:

The displayed search prompt is corrupted when using non-incremental
searches in vi and emacs mode if the prompt contains non-printing
characters or spans multiple lines.  The prompt is expanded more than
once; the second time without the escape sequences that protect non-
printing characters from the length calculations.

Patch:

*** ../bash-3.1-patched/lib/readline/display.c	Wed Nov 30 14:05:02 2005
--- lib/readline/display.c	Sat Feb 18 12:14:58 2006
***************
*** 1983,1993 ****
       int pchar;
  {
    int len;
!   char *pmt;
  
    rl_save_prompt ();
  
!   if (saved_local_prompt == 0)
      {
        len = (rl_prompt && *rl_prompt) ? strlen (rl_prompt) : 0;
        pmt = (char *)xmalloc (len + 2);
--- 1998,2012 ----
       int pchar;
  {
    int len;
!   char *pmt, *p;
  
    rl_save_prompt ();
  
!   /* We've saved the prompt, and can do anything with the various prompt
!      strings we need before they're restored.  We want the unexpanded
!      portion of the prompt string after any final newline. */
!   p = rl_prompt ? strrchr (rl_prompt, '\n') : 0;
!   if (p == 0)
      {
        len = (rl_prompt && *rl_prompt) ? strlen (rl_prompt) : 0;
        pmt = (char *)xmalloc (len + 2);
***************
*** 1998,2016 ****
      }
    else
      {
!       len = *saved_local_prompt ? strlen (saved_local_prompt) : 0;
        pmt = (char *)xmalloc (len + 2);
        if (len)
! 	strcpy (pmt, saved_local_prompt);
        pmt[len] = pchar;
        pmt[len+1] = '\0';
!       local_prompt = savestring (pmt);
!       prompt_last_invisible = saved_last_invisible;
!       prompt_visible_length = saved_visible_length + 1;
!     }
  
    prompt_physical_chars = saved_physical_chars + 1;
- 
    return pmt;
  }
  
--- 2017,2033 ----
      }
    else
      {
!       p++;
!       len = strlen (p);
        pmt = (char *)xmalloc (len + 2);
        if (len)
! 	strcpy (pmt, p);
        pmt[len] = pchar;
        pmt[len+1] = '\0';
!     }  
  
+   /* will be overwritten by expand_prompt, called from rl_message */
    prompt_physical_chars = saved_physical_chars + 1;
    return pmt;
  }
  
*** ../bash-3.1/patchlevel.h	Wed Jul 20 13:58:20 2005
--- patchlevel.h	Wed Dec  7 13:48:42 2005
***************
*** 26,30 ****
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 13
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 14
  
  #endif /* _PATCHLEVEL_H_ */