Merge pull request #152011 from Artturin/removebash4

bash_4: remove
This commit is contained in:
Artturi 2022-01-01 08:07:09 +02:00 committed by GitHub
commit 1a66fe1035
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 0 additions and 798 deletions

View File

@ -1,140 +0,0 @@
{ lib, stdenv, buildPackages
, fetchurl, binutils ? null, bison, autoconf, util-linux
# patch for cygwin requires readline support
, interactive ? stdenv.isCygwin, readline70 ? null
, withDocs ? false, texinfo ? null
}:
with lib;
assert interactive -> readline70 != null;
assert withDocs -> texinfo != null;
assert stdenv.hostPlatform.isDarwin -> binutils != null;
# Note: this package is used for bootstrapping fetchurl, and thus
# cannot use fetchpatch! All mutable patches (generated by GitHub or
# cgit) that are needed here should be included directly in Nixpkgs as
# files.
let
upstreamPatches = import ./bash-4.4-patches.nix (nr: sha256: fetchurl {
url = "mirror://gnu/bash/bash-4.4-patches/bash44-${nr}";
inherit sha256;
});
in
stdenv.mkDerivation rec {
name = "bash-${optionalString interactive "interactive-"}${version}-p${toString (builtins.length upstreamPatches)}";
version = "4.4";
src = fetchurl {
url = "mirror://gnu/bash/bash-${version}.tar.gz";
sha256 = "1jyz6snd63xjn6skk7za6psgidsd53k05cr3lksqybi0q6936syq";
};
hardeningDisable = [ "format" ];
outputs = [ "out" "dev" "man" "doc" "info" ];
NIX_CFLAGS_COMPILE = ''
-DSYS_BASHRC="/etc/bashrc"
-DSYS_BASH_LOGOUT="/etc/bash_logout"
-DDEFAULT_PATH_VALUE="/no-such-path"
-DSTANDARD_UTILS_PATH="/no-such-path"
-DNON_INTERACTIVE_LOGIN_SHELLS
-DSSH_SOURCE_BASHRC
'';
patchFlags = [ "-p0" ];
patches = upstreamPatches
++ [ ./pgrp-pipe-4.4.patch ]
++ optional stdenv.hostPlatform.isCygwin ./cygwin-bash-4.4.11-2.src.patch
# https://lists.gnu.org/archive/html/bug-bash/2016-10/msg00006.html
++ optional stdenv.hostPlatform.isMusl (fetchurl {
url = "https://lists.gnu.org/archive/html/bug-bash/2016-10/patchJxugOXrY2y.patch";
sha256 = "1m4v9imidb1cc1h91f2na0b8y9kc5c5fgmpvy9apcyv2kbdcghg1";
});
configureFlags = [
(if interactive then "--with-installed-readline" else "--disable-readline")
] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"bash_cv_job_control_missing=nomissing"
"bash_cv_sys_named_pipes=nomissing"
"bash_cv_getcwd_malloc=yes"
] ++ optionals stdenv.hostPlatform.isCygwin [
"--without-libintl-prefix"
"--without-libiconv-prefix"
"--with-installed-readline"
"bash_cv_dev_stdin=present"
"bash_cv_dev_fd=standard"
"bash_cv_termcap_lib=libncurses"
] ++ optionals (stdenv.hostPlatform.libc == "musl") [
"--without-bash-malloc"
"--disable-nls"
];
# Note: Bison is needed because the patches above modify parse.y.
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ bison ]
++ optional withDocs texinfo
++ optional stdenv.hostPlatform.isDarwin binutils
++ optional (stdenv.hostPlatform.libc == "musl") autoconf;
buildInputs = optional interactive readline70;
# Bash randomly fails to build because of a recursive invocation to
# build `version.h'.
enableParallelBuilding = false;
makeFlags = optional stdenv.hostPlatform.isCygwin [
"LOCAL_LDFLAGS=-Wl,--export-all,--out-implib,libbash.dll.a"
"SHOBJ_LIBS=-lbash"
];
checkInputs = [ util-linux ];
doCheck = false; # dependency cycle, needs to be interactive
postInstall = ''
ln -s bash "$out/bin/sh"
rm -f $out/lib/bash/Makefile.inc
'';
postFixup = if interactive
then ''
substituteInPlace "$out/bin/bashbug" \
--replace '${stdenv.shell}' "$out/bin/bash"
''
# most space is taken by locale data
else ''
rm -rf "$out/share" "$out/bin/bashbug"
'';
meta = with lib; {
homepage = "https://www.gnu.org/software/bash/";
description =
"GNU Bourne-Again Shell, the de facto standard shell on Linux" +
(if interactive then " (for interactive use)" else "");
longDescription = ''
Bash is the shell, or command language interpreter, that will
appear in the GNU operating system. Bash is an sh-compatible
shell that incorporates useful features from the Korn shell
(ksh) and C shell (csh). It is intended to conform to the IEEE
POSIX P1003.2/ISO 9945.2 Shell and Tools standard. It offers
functional improvements over sh for both programming and
interactive use. In addition, most sh scripts can be run by
Bash without modification.
'';
license = licenses.gpl3Plus;
platforms = platforms.all;
};
passthru = {
shellPath = "/bin/bash";
};
}

View File

@ -1,27 +0,0 @@
# Automatically generated by `update-patch-set.sh'; do not edit.
patch: [
(patch "001" "03vzy7qwjdd5qvl3ydg99naazas2qmyd0yhnrflgjbbm64axja1y")
(patch "002" "0lrwq6vyqism3yqv9s7kzaf3dsl4q5w9r5svcqz279qp7qca083h")
(patch "003" "1chqww2rj6g42b8s60q5zlzy0jzp684jkpsbrbfy1vzxja8mmpsi")
(patch "004" "1cy8abf96hkrjhw921ndr0shlcnc52bg45rn6xri4v5clhq0l25d")
(patch "005" "0a8515kyk4zsgmvlqvlganjfr7pq0j6kzpr4d6xx02kpbdr4n7i2")
(patch "006" "1f24wgqngmj2mrj9yibwvc2zvlmn5xi53mnw777g3l40c4m2x3ka")
(patch "007" "1bzdsnqaf05gdbqpsixhan8vygjxpcxlz1dd8d9f5jdznw3wq76y")
(patch "008" "1firw915mjm03hbbw9a70ch3cpgrgnvqjpllgdnn6csr8q04f546")
(patch "009" "0g1l56kvw61rpw7dqa9fcl9llkl693h73g631hrhxlm030ddssqb")
(patch "010" "01lfhrkdsdkdz8ypzapr614ras23x7ckjnr60aa5bzkaqprccrc4")
(patch "011" "038p7mhnq9m65g505hi3827jkf9f35nd1cy00w8mwafpyxp44mnx")
(patch "012" "0gh6lbb1rwpk44pvbamm6vzdfi50xnwkqd9v7s8cjwk3pz973hps")
(patch "013" "1djkx0w9v62q78gz3jsvamj1jq53i6hbfrfhhsw86ihwpjnfy98v")
(patch "014" "0z5ikcq9zyxw79d0z36r5p0mspnb5piavbv03jmlan1wnknmrxx7")
(patch "015" "09n307fi1j257abhm295k6ksmnzw47ka2zhnr0i5lbdnpvn04xnk")
(patch "016" "1cgi1y6mifm8hsgv4avj5ih76535js3qba1sqwbfvp7si76927sh")
(patch "017" "0w6jpj2giakji1ir83rpkx1y7n7xqppah3j748m6dm38hywr0gvp")
(patch "018" "1k58h4wxbsg7r4rwhrvzx5hfbapba2nxjysbhh6qp6ki5ys99i2v")
(patch "019" "07n1i5610lbs672x1s8g82qn3qfj06s0ip3z80sri0g8vxp0s5r7")
(patch "020" "0b2jk5n1af1vh590qfc52hv65mafb4vl1xv26s8j5a3byb5y4h0q")
(patch "021" "1hblcd2xmqqlp0idnavw66570n7m0yv5rbbr873c2gkn982mk3xx")
(patch "022" "0yfbjzr79vzjs2hyi5m8iy2b38fq7vikdfa4zqdvjsp36q4iycs5")
(patch "023" "1dlism6qdx60nvzj0v7ndr7lfahl4a8zmzckp13hqgdx7xpj7v2g")
]

View File

@ -1,607 +0,0 @@
--- bashline.c 2017-01-23 13:28:06.955247200 -0600
+++ bashline.c 2017-01-23 13:55:07.992877600 -0600
@@ -76,6 +76,16 @@
# include "pcomplete.h"
#endif
+#if __CYGWIN__
+# ifdef __x86_64__
+# define IMP(x) __imp_##x
+# else
+# define IMP(x) _imp__##x
+# endif
+#else
+# define IMP(x) x
+#endif
+
/* These should agree with the defines for emacs_mode and vi_mode in
rldefs.h, even though that's not a public readline header file. */
#ifndef EMACS_EDITING_MODE
@@ -271,6 +281,11 @@ int no_empty_command_completion;
are the only possible matches, even if FIGNORE says to. */
int force_fignore = 1;
+#if __CYGWIN__
+/* If set, shorten "foo.exe" to "foo" when they are the same file. */
+int completion_strip_exe;
+#endif /* __CYGWIN__ */
+
/* Perform spelling correction on directory names during word completion */
int dircomplete_spelling = 0;
@@ -498,11 +513,12 @@ initialize_readline ()
kseq[0] = CTRL('J');
kseq[1] = '\0';
func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL);
- if (func == rl_vi_editing_mode)
+ extern rl_command_func_t *IMP(rl_vi_editing_mode);
+ if (func == rl_vi_editing_mode || func == IMP(rl_vi_editing_mode))
rl_unbind_key_in_map (CTRL('J'), emacs_meta_keymap);
kseq[0] = CTRL('M');
func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL);
- if (func == rl_vi_editing_mode)
+ if (func == rl_vi_editing_mode || func == IMP(rl_vi_editing_mode))
rl_unbind_key_in_map (CTRL('M'), emacs_meta_keymap);
#if defined (VI_MODE)
rl_unbind_key_in_map (CTRL('E'), vi_movement_keymap);
@@ -521,7 +537,8 @@ initialize_readline ()
kseq[0] = '~';
kseq[1] = '\0';
func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL);
- if (func == 0 || func == rl_tilde_expand)
+ extern rl_command_func_t *IMP(rl_tilde_expand);
+ if (func == 0 || func == rl_tilde_expand || func == IMP(rl_tilde_expand))
rl_bind_keyseq_in_map (kseq, bash_complete_username, emacs_meta_keymap);
rl_bind_key_if_unbound_in_map ('~', bash_possible_username_completions, emacs_ctlx_keymap);
@@ -544,7 +561,8 @@ initialize_readline ()
kseq[0] = TAB;
kseq[1] = '\0';
func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL);
- if (func == 0 || func == rl_tab_insert)
+ extern rl_command_func_t *IMP(rl_tab_insert);
+ if (func == 0 || func == rl_tab_insert || func == IMP(rl_tab_insert))
rl_bind_key_in_map (TAB, dynamic_complete_history, emacs_meta_keymap);
/* Tell the completer that we want a crack first. */
@@ -2194,6 +2212,21 @@ globword:
if (match && executable_completion ((searching_path ? val : cval), searching_path))
{
+#if __CYGWIN__
+ if (completion_strip_exe)
+ {
+ size_t val_len = strlen (val);
+ char *candidate;
+ if (val_len > 4 && !strcasecmp (&val[val_len - 4], ".exe")
+ && (candidate = strdup (val)))
+ {
+ candidate[val_len - 4] = '\0';
+ if (same_file (val, candidate, NULL, NULL))
+ temp[strlen (temp) - 4] = '\0';
+ free (candidate);
+ }
+ }
+#endif
if (cval != val)
free (cval);
free (val);
@@ -2929,6 +2962,17 @@ test_for_directory (name)
int r;
fn = bash_tilde_expand (name, 0);
+#if __CYGWIN
+ /* stat("//server") can only be successful as a directory, but can take
+ seconds to time out on failure. It is much faster to assume that
+ "//server" is a valid name than it is to wait for a stat, even if it
+ gives false positives on bad names. */
+ if (fn[0] == '/' && fn[1] == '/' && ! strchr (&fn[2], '/'))
+ {
+ free (fn);
+ return 1;
+ }
+#endif
r = file_isdir (fn);
free (fn);
--- builtins/read.def 2017-01-23 13:28:07.017686500 -0600
+++ builtins/read.def 2017-01-23 13:55:07.992877600 -0600
@@ -85,7 +85,6 @@ $END
#ifdef __CYGWIN__
# include <fcntl.h>
-# include <io.h>
#endif
#include "../bashintl.h"
@@ -530,10 +529,6 @@ read_builtin (list)
fflush (stderr);
}
-#if defined (__CYGWIN__) && defined (O_TEXT)
- setmode (0, O_TEXT);
-#endif
-
ps2 = 0;
for (print_ps2 = eof = retval = 0;;)
{
@@ -664,6 +659,14 @@ read_builtin (list)
if (c == '\0' && delim != '\0')
continue; /* skip NUL bytes in input */
+#ifdef __CYGWIN__
+ {
+ extern igncr;
+ if (igncr && c == '\r' && delim != '\r')
+ continue; /* skip carriage return */
+ }
+#endif
+
if ((skip_ctlesc == 0 && c == CTLESC) || (skip_ctlnul == 0 && c == CTLNUL))
{
saw_escape++;
--- builtins/set.def 2016-06-02 19:10:10.000000000 -0500
+++ builtins/set.def 2017-01-23 13:55:07.992877600 -0600
@@ -56,6 +56,13 @@ extern int dont_save_function_defs;
#if defined (READLINE)
extern int no_line_editing;
#endif /* READLINE */
+#ifdef __CYGWIN__
+extern int igncr;
+static int set_minus_o_option_maybe (int, const char *, int);
+# define INTERACTIVE_ONLY ,1
+#else
+# define INTERACTIVE_ONLY
+#endif
$BUILTIN set
$FUNCTION set_builtin
@@ -92,6 +99,9 @@ Options:
#if defined (HISTORY)
history enable command history
#endif
+#ifdef __CYGWIN__
+ igncr on Cygwin, ignore \r in line endings
+#endif
ignoreeof the shell will not exit upon reading EOF
interactive-comments
allow comments to appear in interactive commands
@@ -192,29 +202,39 @@ const struct {
int *variable;
setopt_set_func_t *set_func;
setopt_get_func_t *get_func;
+#ifdef __CYGWIN__
+ /* Cygwin users have taken to exporting SHELLOPTS for the cygwin-specific
+ igncr. As a result, we want to ensure SHELLOPTS parsing does not turn
+ on interactive options when exported from an interactive shell, but
+ parse in a non-interactive setting, so as not to break POSIX /bin/sh */
+ int interactive_only;
+#endif
} o_options[] = {
{ "allexport", 'a', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
#if defined (BRACE_EXPANSION)
{ "braceexpand",'B', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
#endif
#if defined (READLINE)
- { "emacs", '\0', (int *)NULL, set_edit_mode, get_edit_mode },
+ { "emacs", '\0', (int *)NULL, set_edit_mode, get_edit_mode INTERACTIVE_ONLY },
#endif
{ "errexit", 'e', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
{ "errtrace", 'E', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
{ "functrace", 'T', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
{ "hashall", 'h', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
#if defined (BANG_HISTORY)
- { "histexpand", 'H', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
+ { "histexpand", 'H', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL INTERACTIVE_ONLY },
#endif /* BANG_HISTORY */
#if defined (HISTORY)
- { "history", '\0', &enable_history_list, bash_set_history, (setopt_get_func_t *)NULL },
+ { "history", '\0', &enable_history_list, bash_set_history, (setopt_get_func_t *)NULL INTERACTIVE_ONLY },
+#endif
+#ifdef __CYGWIN__
+ { "igncr", '\0', &igncr, NULL, (setopt_get_func_t *)NULL },
#endif
{ "ignoreeof", '\0', &ignoreeof, set_ignoreeof, (setopt_get_func_t *)NULL },
{ "interactive-comments", '\0', &interactive_comments, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
{ "keyword", 'k', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
#if defined (JOB_CONTROL)
- { "monitor", 'm', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
+ { "monitor", 'm', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL INTERACTIVE_ONLY },
#endif
{ "noclobber", 'C', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
{ "noexec", 'n', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
@@ -233,7 +253,7 @@ const struct {
{ "privileged", 'p', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
{ "verbose", 'v', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
#if defined (READLINE)
- { "vi", '\0', (int *)NULL, set_edit_mode, get_edit_mode },
+ { "vi", '\0', (int *)NULL, set_edit_mode, get_edit_mode INTERACTIVE_ONLY },
#endif
{ "xtrace", 'x', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
{(char *)NULL, 0 , (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
@@ -455,6 +475,15 @@ int
set_minus_o_option (on_or_off, option_name)
int on_or_off;
char *option_name;
+#ifdef __CYGWIN__
+{
+ /* See Cygwin comments above. */
+ return set_minus_o_option_maybe (on_or_off, option_name, 0);
+}
+static int
+set_minus_o_option_maybe (int on_or_off, const char *option_name,
+ int avoid_interactive)
+#endif /* __CYGWIN__ */
{
register int i;
@@ -462,6 +491,10 @@ set_minus_o_option (on_or_off, option_na
{
if (STREQ (option_name, o_options[i].name))
{
+#ifdef __CYGWIN__
+ if (o_options[i].interactive_only && avoid_interactive)
+ return EXECUTION_SUCCESS;
+#endif
if (o_options[i].letter == 0)
{
previous_option_value = GET_BINARY_O_OPTION_VALUE (i, o_options[i].name);
@@ -588,7 +621,11 @@ parse_shellopts (value)
vptr = 0;
while (vname = extract_colon_unit (value, &vptr))
{
+#ifdef __CYGWIN__
+ set_minus_o_option_maybe (FLAG_ON, vname, !interactive_shell);
+#else
set_minus_o_option (FLAG_ON, vname);
+#endif
free (vname);
}
}
--- builtins/shopt.def 2016-05-06 14:00:02.000000000 -0500
+++ builtins/shopt.def 2017-01-23 13:55:07.992877600 -0600
@@ -92,6 +92,10 @@ extern int glob_asciirange;
extern int lastpipe_opt;
extern int inherit_errexit;
+#ifdef __CYGWIN__
+extern int completion_strip_exe;
+#endif
+
#if defined (EXTENDED_GLOB)
extern int extended_glob;
#endif
@@ -169,6 +173,9 @@ static struct {
{ "compat41", &shopt_compat41, set_compatibility_level },
{ "compat42", &shopt_compat42, set_compatibility_level },
{ "compat43", &shopt_compat43, set_compatibility_level },
+#ifdef __CYGWIN__
+ { "completion_strip_exe", &completion_strip_exe, NULL },
+#endif
#if defined (READLINE)
{ "complete_fullquote", &complete_fullquote, (shopt_set_func_t *)NULL},
{ "direxpand", &dircomplete_expand, shopt_set_complete_direxpand },
--- config-top.h 2016-05-19 13:34:02.000000000 -0500
+++ config-top.h 2017-01-23 13:55:07.992877600 -0600
@@ -87,10 +87,10 @@
#define DEFAULT_BASHRC "~/.bashrc"
/* System-wide .bashrc file for interactive shells. */
-/* #define SYS_BASHRC "/etc/bash.bashrc" */
+#define SYS_BASHRC "/etc/bash.bashrc"
/* System-wide .bash_logout for login shells. */
-/* #define SYS_BASH_LOGOUT "/etc/bash.bash_logout" */
+#define SYS_BASH_LOGOUT "/etc/bash.bash_logout"
/* Define this to make non-interactive shells begun with argv[0][0] == '-'
run the startup files when not in posix mode. */
@@ -100,7 +100,7 @@
sshd and source the .bashrc if so (like the rshd behavior). This checks
for the presence of SSH_CLIENT or SSH2_CLIENT in the initial environment,
which can be fooled under certain not-uncommon circumstances. */
-/* #define SSH_SOURCE_BASHRC */
+#define SSH_SOURCE_BASHRC
/* Define if you want the case-capitalizing operators (~[~]) and the
`capcase' variable attribute (declare -c). */
--- doc/Makefile.in 2015-12-06 18:55:56.000000000 -0600
+++ doc/Makefile.in 2017-01-23 13:55:07.992877600 -0600
@@ -189,7 +189,7 @@ bashref.html: $(BASHREF_FILES) $(HSUSER)
$(MAKEINFO) --html --no-split -I$(TEXINPUTDIR) $(srcdir)/bashref.texi
bash.info: bashref.info
- ${SHELL} ${INFOPOST} < $(srcdir)/bashref.info > $@ ; \
+ ${SHELL} ${INFOPOST} < bashref.info > $@ ; \
bash.txt: bash.1
bash.ps: bash.1
@@ -252,9 +252,9 @@ install: info installdirs
-$(INSTALL_DATA) $(srcdir)/bashbug.1 $(DESTDIR)$(man1dir)/bashbug${man1ext}
-$(INSTALL_DATA) $(OTHER_DOCS) $(DESTDIR)$(docdir)
# uncomment the next lines to install the builtins man page
-# sed 's:bash\.1:man1/&:' $(srcdir)/builtins.1 > $${TMPDIR:-/var/tmp}/builtins.1
-# -$(INSTALL_DATA) $${TMPDIR:-/var/tmp}/builtins.1 $(DESTDIR)$(man1dir)/bash_builtins${man1ext}
-# -$(RM) $${TMPDIR:-/var/tmp}/builtins.1
+ sed 's:bash\.1:man1/&:' $(srcdir)/builtins.1 > $${TMPDIR:-/var/tmp}/builtins.1
+ -$(INSTALL_DATA) $${TMPDIR:-/var/tmp}/builtins.1 $(DESTDIR)$(man1dir)/bash_builtins${man1ext}
+ -$(RM) $${TMPDIR:-/var/tmp}/builtins.1
-if test -f bash.info; then d=.; else d=$(srcdir); fi; \
$(INSTALL_DATA) $$d/bash.info $(DESTDIR)$(infodir)/bash.info
# run install-info if it is present to update the info directory
--- doc/bash.1 2016-08-26 08:45:17.000000000 -0500
+++ doc/bash.1 2017-01-23 13:55:08.008447700 -0600
@@ -9607,6 +9607,10 @@ filenames.
This variable is set by default, which is the default bash behavior in
versions through 4.2.
.TP 8
+.B completion_strip_exe
+If set, whenever bash sees \fIfoo.exe\fP during completion, it checks if
+\fIfoo\fP is the same file and strips the suffix.
+.TP 8
.B direxpand
If set,
.B bash
--- doc/bashref.texi 2016-09-07 16:13:36.000000000 -0500
+++ doc/bashref.texi 2017-01-23 13:55:08.008447700 -0600
@@ -5123,6 +5123,10 @@ filenames.
This variable is set by default, which is the default Bash behavior in
versions through 4.2.
+@item completion_strip_exe
+If set, whenever bash sees @file{foo.exe} during completion, it checks if
+@file{foo} is the same file and strips the suffix.
+
@item direxpand
If set, Bash
replaces directory names with the results of word expansion when performing
--- doc/builtins.1 2012-02-21 13:32:05.000000000 -0600
+++ doc/builtins.1 2017-01-23 13:55:08.008447700 -0600
@@ -19,6 +19,6 @@ shift, shopt, source, suspend, test, tim
ulimit, umask, unalias, unset, wait \- bash built-in commands, see \fBbash\fR(1)
.SH BASH BUILTIN COMMANDS
.nr zZ 1
-.so bash.1
+.so man1/bash.1
.SH SEE ALSO
bash(1), sh(1)
--- general.c 2016-08-11 10:16:56.000000000 -0500
+++ general.c 2017-01-23 13:55:08.008447700 -0600
@@ -48,6 +48,10 @@
#include <tilde/tilde.h>
+#ifdef __CYGWIN__
+# include <sys/cygwin.h>
+#endif
+
#if !defined (errno)
extern int errno;
#endif /* !errno */
@@ -718,7 +722,8 @@ make_absolute (string, dot_path)
{
char pathbuf[PATH_MAX + 1];
- cygwin_conv_to_full_posix_path (string, pathbuf);
+ cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_ABSOLUTE, string, pathbuf,
+ sizeof pathbuf);
result = savestring (pathbuf);
}
#else
--- input.c 2015-09-24 18:49:23.000000000 -0500
+++ input.c 2017-01-23 13:55:08.008447700 -0600
@@ -44,6 +44,10 @@
#include "quit.h"
#include "trap.h"
+#ifdef __CYGWIN__
+int igncr;
+#endif
+
#if !defined (errno)
extern int errno;
#endif /* !errno */
@@ -561,6 +565,19 @@ buffered_getchar ()
{
CHECK_TERMSIG;
+#ifdef __CYGWIN__
+ /* shopt igncr discards carriage returns from the input stream.
+ If cr is the only character left in the buffer, recurse to pick
+ up the next byte; otherwise flatten the buffer. */
+ if (igncr)
+ {
+ int ch;
+ while ((ch = bufstream_getc (buffers[bash_input.location.buffered_fd]))
+ == '\r')
+ ;
+ return ch;
+ }
+#endif
#if !defined (DJGPP)
return (bufstream_getc (buffers[bash_input.location.buffered_fd]));
#else
--- lib/sh/pathphys.c 2013-05-28 14:33:58.000000000 -0500
+++ lib/sh/pathphys.c 2017-01-23 13:55:08.008447700 -0600
@@ -35,6 +35,7 @@
#include <stdio.h>
#include <chartypes.h>
#include <errno.h>
+#include <stdlib.h>
#include "shell.h"
@@ -76,6 +77,9 @@ sh_physpath (path, flags)
char *path;
int flags;
{
+#ifdef __CYGWIN__
+ return realpath (path, NULL);
+#endif
char tbuf[PATH_MAX+1], linkbuf[PATH_MAX+1];
char *result, *p, *q, *qsave, *qbase, *workpath;
int double_slash_path, linklen, nlink;
@@ -214,11 +218,7 @@ error:
{
q = result;
/* Duplicating some code here... */
-#if defined (__CYGWIN__)
- qbase = (ISALPHA((unsigned char)workpath[0]) && workpath[1] == ':') ? workpath + 3 : workpath + 1;
-#else
qbase = workpath + 1;
-#endif
double_slash_path = DOUBLE_SLASH (workpath);
qbase += double_slash_path;
--- lib/sh/tmpfile.c 2016-08-11 10:05:58.000000000 -0500
+++ lib/sh/tmpfile.c 2017-01-23 13:55:08.008447700 -0600
@@ -101,7 +101,7 @@ get_tmpdir (flags)
if (tdir && (file_iswdir (tdir) == 0 || strlen (tdir) > PATH_MAX))
tdir = 0;
- if (tdir == 0)
+ if (tdir == 0 || !file_iswdir (tdir))
tdir = get_sys_tmpdir ();
#if defined (HAVE_PATHCONF) && defined (_PC_NAME_MAX)
--- mksyntax.c 2012-07-29 18:48:38.000000000 -0500
+++ mksyntax.c 2017-01-23 13:55:08.008447700 -0600
@@ -29,13 +29,13 @@
#ifdef HAVE_UNISTD_H
# include <unistd.h>
+#else
+extern int optind;
+extern char *optarg;
#endif
#include "syntax.h"
-extern int optind;
-extern char *optarg;
-
#ifndef errno
extern int errno;
#endif
--- parse.y 2016-09-11 10:31:46.000000000 -0500
+++ parse.y 2017-01-23 13:55:08.008447700 -0600
@@ -1539,14 +1539,20 @@ yy_string_get ()
string = bash_input.location.string;
/* If the string doesn't exist, or is empty, EOF found. */
- if (string && *string)
+ while (string && *string)
{
c = *string++;
bash_input.location.string = string;
+#ifdef __CYGWIN__
+ {
+ extern int igncr;
+ if (igncr && c == '\r')
+ continue;
+ }
+#endif
return (c);
}
- else
- return (EOF);
+ return (EOF);
}
static int
--- subst.c 2017-01-23 13:28:06.955247200 -0600
+++ subst.c 2017-01-23 13:55:08.008447700 -0600
@@ -43,6 +43,7 @@
#include "posixstat.h"
#include "bashintl.h"
+#define NEED_SH_SETLINEBUF_DECL
#include "shell.h"
#include "parser.h"
#include "flags.h"
@@ -5964,6 +5965,13 @@ read_comsub (fd, quoted, rflag)
#endif
continue;
}
+#ifdef __CYGWIN__
+ {
+ extern int igncr;
+ if (igncr && c == '\r')
+ continue;
+ }
+#endif
/* Add the character to ISTRING, possibly after resizing it. */
RESIZE_MALLOCED_BUFFER (istring, istring_index, 2, istring_size, DEFAULT_ARRAY_SIZE);
@@ -6088,6 +6096,28 @@ command_substitute (string, quoted)
goto error_exit;
}
+#ifdef __CYGWIN__
+ /* Passing a pipe through std fds can cause hangs when talking to a
+ non-cygwin child. Move it. */
+ if (fildes[0] < 3)
+ {
+ int fd = fcntl (fildes[0], F_DUPFD, 3);
+ close (fildes[0]);
+ fildes[0] = fd;
+ }
+ if (fildes[1] < 3)
+ {
+ int fd = fcntl (fildes[1], F_DUPFD, 3);
+ close (fildes[1]);
+ fildes[1] = fd;
+ }
+ if (fildes[0] < 0 || fildes[1] < 0)
+ {
+ sys_error (_("cannot make pipe for command substitution"));
+ goto error_exit;
+ }
+#endif /* __CYGWIN__ */
+
old_pid = last_made_pid;
#if defined (JOB_CONTROL)
old_pipeline_pgrp = pipeline_pgrp;
--- support/bashversion.c 2008-09-09 08:31:53.000000000 -0500
+++ support/bashversion.c 2017-01-23 13:55:08.024037200 -0600
@@ -26,6 +26,9 @@
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
+#else
+extern int optind;
+extern char *optarg;
#endif
#include "bashansi.h"
@@ -41,9 +44,6 @@
#define LFLAG 0x0020
#define XFLAG 0x0040
-extern int optind;
-extern char *optarg;
-
extern char *dist_version;
extern int patch_level;
--- support/mkversion.sh 2008-08-13 07:25:57.000000000 -0500
+++ support/mkversion.sh 2017-01-23 13:55:08.024037200 -0600
@@ -29,7 +29,7 @@ source_dir="."
while [ $# -gt 0 ]; do
case "$1" in
-o) shift; OUTFILE=$1; shift ;;
- -b) shift; inc_build=yes ;;
+ -b) shift; ;; # inc_build=yes ;; # hacked out for cygport
-s) shift; rel_status=$1; shift ;;
-p) shift; patch_level=$1; shift ;;
-d) shift; dist_version=$1; shift ;;
--- variables.c 2016-06-15 15:05:52.000000000 -0500
+++ variables.c 2017-01-23 13:55:08.024037200 -0600
@@ -5239,6 +5239,7 @@ sv_winsize (name)
/* Update the value of HOME in the export environment so tilde expansion will
work on cygwin. */
#if defined (__CYGWIN__)
+void
sv_home (name)
char *name;
{

View File

@ -1,15 +0,0 @@
diff -u ./configure ../bash-4.4-fixed/configure
--- ./configure 2016-09-07 22:57:01.000000000 +0200
+++ ../bash-4.4-fixed/configure 2020-01-08 14:10:26.316858174 +0100
@@ -16064,10 +16064,7 @@
solaris2*) LOCAL_CFLAGS=-DSOLARIS ;;
lynxos*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
linux*) LOCAL_LDFLAGS=-rdynamic # allow dynamic loading
- case "`uname -r`" in
- 2.[456789]*|[34]*) $as_echo "#define PGRP_PIPE 1" >>confdefs.h
- ;;
- esac ;;
+ $as_echo "#define PGRP_PIPE 1" >>confdefs.h ;;
*qnx6*) LOCAL_CFLAGS="-Dqnx -Dqnx6" LOCAL_LIBS="-lncurses" ;;
*qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
powerux*) LOCAL_LIBS="-lgen" ;;

View File

@ -11369,9 +11369,6 @@ with pkgs;
any-nix-shell = callPackage ../shells/any-nix-shell { };
bash_4 = lowPrio (callPackage ../shells/bash/4.4.nix {
binutils = stdenv.cc.bintools;
});
bash = lowPrio (callPackage ../shells/bash/5.1.nix {
binutils = stdenv.cc.bintools;
});
@ -11382,12 +11379,6 @@ with pkgs;
withDocs = true;
};
bashInteractive_4 = lowPrio (callPackage ../shells/bash/4.4.nix {
binutils = stdenv.cc.bintools;
interactive = true;
withDocs = true;
});
bash-completion = callPackage ../shells/bash/bash-completion { };
gradle-completion = callPackage ../shells/zsh/gradle-completion { };