mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-22 05:17:59 +02:00
commit bash-20190405 snapshot
This commit is contained in:
@@ -5704,3 +5704,10 @@ builtins/common.c,builtins/printf.def
|
||||
|
||||
builtins/read.def
|
||||
- bind_read_variable: now uses builtin_bind_variable
|
||||
|
||||
4/4
|
||||
---
|
||||
lib/readline/histfile.c
|
||||
- history_rename: wrapper function for rename(2) to deal with the Win32
|
||||
refusal to rename over an existing file; changed callers. Bug and fix
|
||||
from <john.david.donoghue@gmail.com>
|
||||
|
||||
+1
-1
@@ -3766,7 +3766,7 @@ completion_glob_pattern (string)
|
||||
|
||||
case '\\':
|
||||
if (*string++ == 0)
|
||||
return (0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Advance one fewer byte than an entire multibyte character to
|
||||
|
||||
@@ -397,6 +397,16 @@ search_for_command (pathname, flags)
|
||||
if (st & FS_EXECABLE)
|
||||
phash_insert ((char *)pathname, command, dot_found_in_search, 1);
|
||||
}
|
||||
#if 0 /* TAG:bash-5.1 */
|
||||
/* If we're in posix mode, don't add files without the execute bit
|
||||
to the hash table. */
|
||||
else if (posixly_correct)
|
||||
{
|
||||
st = file_status (command);
|
||||
if (st & FS_EXECABLE)
|
||||
phash_insert ((char *)pathname, command, dot_found_in_search, 1);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
phash_insert ((char *)pathname, command, dot_found_in_search, 1);
|
||||
}
|
||||
|
||||
@@ -2370,7 +2370,7 @@ character to the directory name, in case we want to append to it.
|
||||
The @option{-o bashdefault} option brings in the rest of the "Bash default"
|
||||
completions -- possible completion that Bash adds to the default Readline
|
||||
set. These include things like command name completion, variable completion
|
||||
for words beginning with @samp{@{}, completions containing pathname
|
||||
for words beginning with @samp{$} or @samp{$@{}, completions containing pathname
|
||||
expansion patterns (@pxref{Filename Expansion}), and so on.
|
||||
|
||||
Once installed using @code{complete}, @code{_comp_cd} will be called every
|
||||
|
||||
+23
-5
@@ -1,6 +1,6 @@
|
||||
/* histfile.c - functions to manipulate the history file. */
|
||||
|
||||
/* Copyright (C) 1989-2018 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1989-2019 Free Software Foundation, Inc.
|
||||
|
||||
This file contains the GNU History Library (History), a set of
|
||||
routines for managing the text of previously typed lines.
|
||||
@@ -79,6 +79,11 @@
|
||||
|
||||
#endif /* HISTORY_USE_MMAP */
|
||||
|
||||
#if defined(_WIN32)
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
/* If we're compiling for __EMX__ (OS/2) or __CYGWIN__ (cygwin32 environment
|
||||
on win 95/98/nt), we want to open files with O_BINARY mode so that there
|
||||
is no \n -> \r\n conversion performed. On other systems, we don't want to
|
||||
@@ -138,6 +143,7 @@ static char *history_backupfile PARAMS((const char *));
|
||||
static char *history_tempfile PARAMS((const char *));
|
||||
static int histfile_backup PARAMS((const char *, const char *));
|
||||
static int histfile_restore PARAMS((const char *, const char *));
|
||||
static int history_rename PARAMS((const char *, const char *));
|
||||
|
||||
/* Return the string that should be used in the place of this
|
||||
filename. This only matters when you don't specify the
|
||||
@@ -436,6 +442,18 @@ read_history_range (const char *filename, int from, int to)
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* We need a special version for WIN32 because Windows rename() refuses to
|
||||
overwrite an existing file. */
|
||||
static int
|
||||
history_rename (const char *old, const char *new)
|
||||
{
|
||||
#if defined (_WIN32)
|
||||
return (MoveFileEx (old, new, MOVEFILE_REPLACE_EXISTING) == 0 ? -1 : 0);
|
||||
#else
|
||||
return (rename (old, new));
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Save FILENAME to BACK, handling case where FILENAME is a symlink
|
||||
(e.g., ~/.bash_history -> .histfiles/.bash_history.$HOSTNAME) */
|
||||
static int
|
||||
@@ -449,10 +467,10 @@ histfile_backup (const char *filename, const char *back)
|
||||
if ((n = readlink (filename, linkbuf, sizeof (linkbuf) - 1)) > 0)
|
||||
{
|
||||
linkbuf[n] = '\0';
|
||||
return (rename (linkbuf, back));
|
||||
return (history_rename (linkbuf, back));
|
||||
}
|
||||
#endif
|
||||
return (rename (filename, back));
|
||||
return (history_rename (filename, back));
|
||||
}
|
||||
|
||||
/* Restore ORIG from BACKUP handling case where ORIG is a symlink
|
||||
@@ -468,10 +486,10 @@ histfile_restore (const char *backup, const char *orig)
|
||||
if ((n = readlink (orig, linkbuf, sizeof (linkbuf) - 1)) > 0)
|
||||
{
|
||||
linkbuf[n] = '\0';
|
||||
return (rename (backup, linkbuf));
|
||||
return (history_rename (backup, linkbuf));
|
||||
}
|
||||
#endif
|
||||
return (rename (backup, orig));
|
||||
return (history_rename (backup, orig));
|
||||
}
|
||||
|
||||
/* Truncate the history file FNAME, leaving only LINES trailing lines.
|
||||
|
||||
Reference in New Issue
Block a user