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 125 126 127 128 129 130 131 132 133 134 135
|
#! /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 bash30-010
BASH PATCH REPORT
=================
Bash-Release: 3.0
Patch-ID: bash30-010
Bug-Reported-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Bug-Reference-ID: <E1Bo8Sq-0004u5-00@bouh>
Bug-Reference-URL: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=261142
Bug-Description:
When trying to auto-complete ~/../``/, I just get:
malloc: bashline.c:1340: assertion botched
free: start and end chunk sizes differ
last command: kill -9 %2
Stopping myself...
Patch:
*** ../bash-3.0/bashline.c Mon Jul 5 23:22:12 2004
--- bashline.c Thu Sep 2 16:00:12 2004
***************
*** 101,104 ****
--- 101,105 ----
/* Helper functions for Readline. */
+ static int bash_directory_expansion __P((char **));
static int bash_directory_completion_hook __P((char **));
static int filename_completion_ignore __P((char **));
***************
*** 293,297 ****
at = strchr (rl_completer_word_break_characters, '@');
if ((at == 0 && on_or_off == 0) || (at != 0 && on_or_off != 0))
! return;
/* We have something to do. Do it. */
--- 294,298 ----
at = strchr (rl_completer_word_break_characters, '@');
if ((at == 0 && on_or_off == 0) || (at != 0 && on_or_off != 0))
! return old_value;
/* We have something to do. Do it. */
***************
*** 1407,1414 ****
if (*hint_text == '~')
{
! int l, tl, vl;
vl = strlen (val);
tl = strlen (hint_text);
l = vl - hint_len; /* # of chars added */
temp = (char *)xmalloc (l + 2 + tl);
strcpy (temp, hint_text);
--- 1408,1424 ----
if (*hint_text == '~')
{
! int l, tl, vl, dl;
! char *rd;
vl = strlen (val);
tl = strlen (hint_text);
+ #if 0
l = vl - hint_len; /* # of chars added */
+ #else
+ rd = savestring (filename_hint);
+ bash_directory_expansion (&rd);
+ dl = strlen (rd);
+ l = vl - dl; /* # of chars added */
+ free (rd);
+ #endif
temp = (char *)xmalloc (l + 2 + tl);
strcpy (temp, hint_text);
***************
*** 2188,2191 ****
--- 2198,2222 ----
}
+ /* Simulate the expansions that will be performed by
+ rl_filename_completion_function. This must be called with the address of
+ a pointer to malloc'd memory. */
+ static int
+ bash_directory_expansion (dirname)
+ char **dirname;
+ {
+ char *d;
+
+ d = savestring (*dirname);
+
+ if (rl_directory_rewrite_hook)
+ (*rl_directory_rewrite_hook) (&d);
+
+ if (rl_directory_completion_hook && (*rl_directory_completion_hook) (&d))
+ {
+ free (*dirname);
+ *dirname = d;
+ }
+ }
+
/* Handle symbolic link references and other directory name
expansions while hacking completion. */
*** ../bash-3.0/patchlevel.h Wed Aug 22 08:05:39 2001
--- patchlevel.h Thu Sep 2 15:04:32 2004
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 9
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 10
#endif /* _PATCHLEVEL_H_ */
|