diff options
author | Mike Frysinger <vapier@gentoo.org> | 2012-12-15 01:55:55 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2012-12-15 01:55:55 +0000 |
commit | 162d5c8a99db6b9ea889c85388bd7ca2bb41404f (patch) | |
tree | 188e0830c6e429715dbd074e3ad2e9a078ee3786 /app-shells | |
parent | Version bump per bug#434050 (diff) | |
download | historical-162d5c8a99db6b9ea889c85388bd7ca2bb41404f.tar.gz historical-162d5c8a99db6b9ea889c85388bd7ca2bb41404f.tar.bz2 historical-162d5c8a99db6b9ea889c85388bd7ca2bb41404f.zip |
Speed up `read -N` behavior. Install the headers needed by USE=plugins.
Package-Manager: portage-2.2.0_alpha144/cvs/Linux x86_64
Manifest-Sign-Key: 0xFB7C4156
Diffstat (limited to 'app-shells')
-rw-r--r-- | app-shells/bash/ChangeLog | 8 | ||||
-rw-r--r-- | app-shells/bash/Manifest | 30 | ||||
-rw-r--r-- | app-shells/bash/bash-4.2_p39-r1.ebuild | 218 | ||||
-rw-r--r-- | app-shells/bash/files/bash-4.2-speed-up-read-N.patch | 112 |
4 files changed, 353 insertions, 15 deletions
diff --git a/app-shells/bash/ChangeLog b/app-shells/bash/ChangeLog index 7bf9e7944a67..cdb8f32ff079 100644 --- a/app-shells/bash/ChangeLog +++ b/app-shells/bash/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for app-shells/bash # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/app-shells/bash/ChangeLog,v 1.328 2012/11/19 22:26:11 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-shells/bash/ChangeLog,v 1.329 2012/12/15 01:55:49 vapier Exp $ + +*bash-4.2_p39-r1 (15 Dec 2012) + + 15 Dec 2012; Mike Frysinger <vapier@gentoo.org> +bash-4.2_p39-r1.ebuild, + +files/bash-4.2-speed-up-read-N.patch: + Speed up `read -N` behavior. Install the headers needed by USE=plugins. 16 Nov 2012; Agostino Sarubbo <ago@gentoo.org> -bash-4.1_p10.ebuild, -bash-4.1_p7.ebuild, -bash-4.1_p9.ebuild, -bash-4.2_p10.ebuild, diff --git a/app-shells/bash/Manifest b/app-shells/bash/Manifest index 683f8750d97d..43ed80c33dfd 100644 --- a/app-shells/bash/Manifest +++ b/app-shells/bash/Manifest @@ -30,6 +30,7 @@ AUX bash-4.2-extglob-multibyte.patch 955 SHA256 7e8e5161d4bfbf9049c961072fcf47d0 AUX bash-4.2-no-readline.patch 287 SHA256 f145706f0a83939575023929905199ac4359c97530641c39635be36a46fa8d8c SHA512 558b6bc3a7588ca83190264c842a0eb79d838ebe8002f3aecf8a4dbbbbfa770a3568e2f35496ab80683c0317f15afbeb5748bd0c0027c7afbcb0419217dd5847 WHIRLPOOL e760a202352817c8b465d03b9f9101b3c5f87c7d5c88263d086b574bf89834c7d2e9de8aebcb4427e456ce17b1f51e89d3739c5a556179f03ea832cf385ab83d AUX bash-4.2-parallel-build.patch 4448 SHA256 1c5f7fb5c324d6f2b786ad259cc35bfdd3fe3087e778e4a5031277b33ca097c3 SHA512 44690ed868ed95b7949b21a308f402af64d46873a8eb023f44e3f12381719e66b5c123c75d496ccb3d51b10b7102ae041dc41d55131ff9835757731afb9f7711 WHIRLPOOL 70bf422d8207f08d15cfe95daf5b6ac264bd320c7544ee626efe0afdb751ebd4c953a59e39e44af85273cbdec3ebbd060597ab9ccfcc1b5b767fde4f6afa9916 AUX bash-4.2-print-heredoc.patch 854 SHA256 a686e71f9ab788015fa80eb448252eeedc2d8f8e97b0fc0c66c0d3f3088e87b4 SHA512 702ea663e19147529199404523a1a6e957dc8f36486b8fafdf647b744f58ab3fcaee667455b8a7d3146618c277068677521e038d9387f803e257e3e0827fcc43 WHIRLPOOL 0b5250775f056d2dd1e19ab35d436f1660b7dd0c5edd7b6c6a25646109bb3dde3e5031a387c2b551b6fc824c1066c1ebc8c9016a57964a3ffa33200924066a27 +AUX bash-4.2-speed-up-read-N.patch 2858 SHA256 8547d32535ed4e2fe5cb7b3503e6044c3f5df3772079509bd02cec4177059dcf SHA512 6b7f611ac35746c5ce8caad49def25d060397d81844c0dda2ba7c73f4b0318a28b3fb89f356695c8a7799b70ab0591d9612619403b7d4ade8aba1e60a933fdae WHIRLPOOL da9647b199f090b358b8186187d9ceff6cc5dd7cb20885f7963c1a1b445bf833093c2db931763a9c05f2e4b87e9e1c201bd34a441c49a39703eca7f3c61b2d49 AUX bash-4.x-deferred-heredocs.patch 1255 SHA256 845ffcd7035eef5dc029747f211a737e0260b53b16086a37fb3c8ab3609a7d36 SHA512 9016203189d0b601f0441daec19f902de7387b599a2196c475d76c596dcf9a9c22765a58e7fc5a3117522ec2722475bd166bea271ff3048f31674e8bed2901a0 WHIRLPOOL f3a2ef5245c446b7e90917e987d80efba5e6437dbe86fc27bbd7768bc5f1e5f6e7663b350ca8a81a3f21a29af6e1594c14061be0d818fce6a4a63aed7efcb6fe AUX bash_logout 205 SHA256 15aaded954389c05d7de5d36c4887db61975ad52c87ad78baf1062ec8997289d SHA512 7234250c03fc920996a381f9daef9e2d8ab1e1a29acdebed6669d8e0fe1c872a7fa343adf7d9ddc81225b0cd9eb223ba7ad1ff42448aff057fc6d6baa8f04a7d WHIRLPOOL 16242c8796af44f550f2935b37c770c022754c63db75b57fbe49d1a313b8651235619ead571cd70ae37f890c694d1c6b2e4871ec51345743eff8649782d0523b AUX bashrc 2868 SHA256 bf41619c84676d5f89a0480359a563a83e8575e9bf5126d38d2afabaf59e715c SHA512 3e1e23a562959b2eb63eaa7c9387862b2ea8efd5782d74d140a8163ced88abd9b170f22e2914c2bacd5ae9b003aa7f853151562d4726e4ce63bdee9f59f53d14 WHIRLPOOL ac67d48d667ae24bba0e5157fd1af7e7434960b2f4906902af3f0657190f833b5b920fc19e8bad139b7eb45d8eee037d097ecc2ed0cf33e35854d14d76c2a4e6 @@ -203,23 +204,24 @@ EBUILD bash-3.2_p51.ebuild 5864 SHA256 490653a9868ba93a572ef0e4b8d26e0bfc3a93b6c EBUILD bash-4.0_p38.ebuild 5624 SHA256 5b4f8eb489e6db9b068532a55fad5b379d22f86c397c16a3b6b892d558707d2a SHA512 03ddd07c10b548694c4ff50d044040ef88c12d3ec242ecb67e419798259cb885b99477bb24861982ea8dfc843a868a01ee92cb6f1c430eb3c476436bb2fe9230 WHIRLPOOL 75f9ab9afd3286ebc97d6325b86268b2a8214b26c5158c77b9aec17d1584be50647ea972131a28aa5b331cf9acdcf0690d2d0c4a7ca0da94f6ea34ab8c05efec EBUILD bash-4.1_p11.ebuild 5664 SHA256 ac909f86646bcf807fb81d734706a9d151d4d5a7d2d1c8e55ab5c6c48c54770b SHA512 6d0c88c5fa23128e587ec46f694ada17fe04bc75108067511bda7eb6e433a672398ecefc1e2e09427ca668ae9546e7cf3a69ff9b48a529bac0212870ee1c27fe WHIRLPOOL 3e96f5578a2b4e17beb2adde580a1e6ccee156a3df0bdb6801c9e6c8244a4023e94f97454f37ae92d67a5e903ef32c3ad454ca0e9976446b8fcabd4746455c80 EBUILD bash-4.2_p37.ebuild 6311 SHA256 c807f0def9dc9dcac9958cb7a9606dd9f1ce33142933dcf0f8cd3276434f86ea SHA512 f72570af7efb4e07b5b5e67fb81f6c12f8b177f75592b2b12da606371ee63001c43126a2da03ef41e140894e47935c21df3a8235e10da9131a4f3bdd51c35575 WHIRLPOOL 54c55493d4f9443e33ee97421abca38237c4027d2bfe0f5c43b04e56cf35b795ca08d33e62517b79a193045dd67b1286b05630621f47bc376e26a276322dcce4 +EBUILD bash-4.2_p39-r1.ebuild 6511 SHA256 b475371f82ad19450b1eaace2eb3162e6dd86a5dfbd41ac6164232cdc11795a8 SHA512 19a40132ab1da0f46dd281803694fce1648f2386dc11ff1c8f283f861abd8d041ad9f09f1ab1fe2ff96101c8bd8d3e3daac3d2811c31c595d741e232bdbef06e WHIRLPOOL c8d75740f8264e7cf80cc8ab492340e9afb9a290e80f7bee9f40c3cc40b60a40ca6180a5211a613ee091d0e2884b5057565c1b2bbd8426152421c0fd2059659f EBUILD bash-4.2_p39.ebuild 6321 SHA256 d021ad20244b04d4a6b5f8f7d920aba2b2d7bc760e200d245f29860ef91bb9a2 SHA512 9484e4a61f61dcfddb420a1829a41463db2e4827e4f0bb7de47f84423f32eff0644097fcaa5b6c4b0313dc91d3ecb9f3134f4e420343540d69118612ddf571a2 WHIRLPOOL 75be42a4bebd19b2e2cfbdf3dafc6f981a7daa2a29068c1df31e76d848aa4a5c8a6ccba181e4fab72a82deddcb21e3076ef660f9e7dd1764053da54436da45d9 -MISC ChangeLog 50352 SHA256 655447165629a6f73184d49f0ff3445c5f1882d2156449b471b376d59accb00e SHA512 1481bf01c462422e266688d6b74b71eac08a3bb93161caa370892e77efa5f99f999162241eaceb8e2b44d71a78142ea14204dc40de53009ee3fa4a89de31ff1f WHIRLPOOL 2ad7ac4b28c16d386b7a2aaffce653f5fc7b773e87a482fc8b6ab91e6ce3ccd9d8b05aa20e48712c9509868a28ea7f4b6b0c12529073bf4e1787f581c399fc8d +MISC ChangeLog 50576 SHA256 eedfcd9d94e89e7328b4d3c5e3b8c172f6ab5f9371c13b5155714800a42d3d30 SHA512 077a0d05910d2e0ba2ada87e9d1c6bc1ffd9b4af45464f55d6683ea0b3897cd7c113fbdae93f00897198bad877cb908f758764e4832ef05fb121fe4af623f6df WHIRLPOOL c0504cdde5723f248ad6527b2c25b10b2e99d312ab1d80aa2404f43e637cb17fdb093ec9e6c7c61f32f9313b6b61e8e1dc641c42d199bfd388dab15e58abe56c MISC metadata.xml 568 SHA256 48d380acb97dda0a7f4bd918b208d11367a8367d289b0a2d78ef08ef9a4e2562 SHA512 e50fd93498123511ac7460795687e694d368aaa2e7001ad752aae7bb6b67ed4746c8e171e4d5ff42e6aade0fd29d001330afdb593b8446046a98b27b113b7c5e WHIRLPOOL 83ad81f6ec56c7deaaa1d6cd18ee73621f02bedb62201d59ac44676120251e040f73c9ef238d91abf0c8c7d115a8b4b8df6ea22b533102c8daadfad755de51d6 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) -iQIcBAEBCAAGBQJQqrIGAAoJELEHsLL7fEFW3GIP/2u0DeCLFsFcrSJhsp2NgyZz -iHq3GZHWx7r5WllpPp/HvQnAIuMlQ4fKjL2xieWdKObSqhF5RJEIKMJL9uLOEA7n -CkeKzmgbjoM4Aopxu8vdUGWYmcYA06TILvZDS2P4tKwrN2/jOMxKSKnSFlbejes5 -muTeUCIQpyZoy329iqAdUcrenioMvM1i6r549M4H1WEBP2hKHpNftUAVHsq1dIJr -0cta1pkDwvyYoSQRQFhoH8zYcGdxIPBgw4MLyzG1noKgcIOUmg/oUeS+PleCzKhe -qAcZw8FGEqh4QEzRCIzXEEfv1tbAV1DLe1r/RSVQ0FW84fWJYPvQQ5K38pvfelQh -Wp0/+Hw5/lWXDbS0CxiAKvxqaH/UfHaV2bNlgwJBXmqbUPaUvO6P8Tk1FozexAX4 -HHT7RIQ+yqUkyszL3zYMK2lrJiVSQkFx3FWUlxiugkWznoWy5NnWGGknr7IQLRr2 -2mz1lhwzh4QjJGwZ3G39thAvNxrx2Xl20xlK43gzRwevZ3zy6sZOureov2gymJuT -6mF3S6vlrqG6cBGR+Gp2vgIY31pu58B1BW8FK1CFsA2WBOISyJ6yQGYbEi/6uI0e -vxxQnvm3vjGqEmYJkV0B4+CSdPab295e79V9KEQC/ne+6+gOqf6YoA7jOlv+Tvfe -p9LW3D4USW/q9tCNAnaw -=XuqJ +iQIcBAEBCAAGBQJQy9jDAAoJELEHsLL7fEFWDt4P/iWKfpN22M+NxRc0IWD/0d7A +lPF8Om8vrfbnGX2xK0msotKogQH4B7vmd9D/MjYXUVVI7J76J6zcOkc0gxfzGuqP +UZrYGFtLuv/vJk1S8DL0NLt0/aMXiIDo2xkWNp1wlVM8aEuXCCgBL+U2bq0sF3OV +n2WECD7icEnvXVx/MsD9s6wc91MCJPpcMBB4YrfZnknebozDAplgDV0yvEX0toLN +AzdyqyINgxRisDgzzQW92psOQrIDXhTWjGlXxiTKL5EO+YbYQSAqhtrQmcV/LgvL +wMxDLthYqhp5e63VqoXEzDDfFBfHwG3hhUm/x85HKA08toXH41EqarnaRPi0XmlD +NUSlbn1578vfzBFdBcQOCLCEIOj2JcaqNp9cApLNFQFxQM9Jm9goBODS49h0HfDq +6nzkFFwloqW8ELGA09NWOEknhK3Z0un6MT/PG1TNRIXoCRje6XtXeoH0isPs4ODe +aW4gXkrEtuHWEFlZo63zOnegL+O+4Gja2Px7rqNSwpE0V3z2jmZkEt/pTZhGLdHa +0R4uk59pFVDjSaUaJ7S/nPUZIpX/RieYQmn+yV3tKGQL6IRjZmlAkdJALdW5FH6z +UZZHZKe3JTFCv0ruNNMXBllb//9Ht7xKBU0EgOhrzarZaqyzNqa8kXdbbhDui4sB +wn1RvDBBIhFnJcTpD0vR +=Tfkv -----END PGP SIGNATURE----- diff --git a/app-shells/bash/bash-4.2_p39-r1.ebuild b/app-shells/bash/bash-4.2_p39-r1.ebuild new file mode 100644 index 000000000000..d4986def9efd --- /dev/null +++ b/app-shells/bash/bash-4.2_p39-r1.ebuild @@ -0,0 +1,218 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-shells/bash/bash-4.2_p39-r1.ebuild,v 1.1 2012/12/15 01:55:49 vapier Exp $ + +EAPI="1" + +inherit eutils flag-o-matic toolchain-funcs multilib + +# Official patchlevel +# See ftp://ftp.cwru.edu/pub/bash/bash-4.2-patches/ +PLEVEL=${PV##*_p} +MY_PV=${PV/_p*} +MY_PV=${MY_PV/_/-} +MY_P=${PN}-${MY_PV} +[[ ${PV} != *_p* ]] && PLEVEL=0 +patches() { + local opt=$1 plevel=${2:-${PLEVEL}} pn=${3:-${PN}} pv=${4:-${MY_PV}} + [[ ${plevel} -eq 0 ]] && return 1 + eval set -- {1..${plevel}} + set -- $(printf "${pn}${pv/\.}-%03d " "$@") + if [[ ${opt} == -s ]] ; then + echo "${@/#/${DISTDIR}/}" + else + local u + for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${pn} ; do + printf "${u}/${pn}-${pv}-patches/%s " "$@" + done + fi +} + +DESCRIPTION="The standard GNU Bourne again shell" +HOMEPAGE="http://tiswww.case.edu/php/chet/bash/bashtop.html" +SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)" + +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd" +IUSE="afs bashlogger examples mem-scramble +net nls plugins +readline vanilla" + +DEPEND=">=sys-libs/ncurses-5.2-r2 + readline? ( >=sys-libs/readline-6.2 ) + nls? ( virtual/libintl )" +RDEPEND="${DEPEND} + !<sys-apps/portage-2.1.6.7_p1 + !<sys-apps/paludis-0.26.0_alpha5" +# we only need yacc when the .y files get patched (bash42-005) +DEPEND+=" virtual/yacc" + +S=${WORKDIR}/${MY_P} + +pkg_setup() { + if is-flag -malign-double ; then #7332 + eerror "Detected bad CFLAGS '-malign-double'. Do not use this" + eerror "as it breaks LFS (struct stat64) on x86." + die "remove -malign-double from your CFLAGS mr ricer" + fi + if use bashlogger ; then + ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs." + ewarn "This will log ALL output you enter into the shell, you have been warned." + fi +} + +src_unpack() { + unpack ${MY_P}.tar.gz + cd "${S}" + + # Include official patches + [[ ${PLEVEL} -gt 0 ]] && epatch $(patches -s) + + # Clean out local libs so we know we use system ones + rm -rf lib/{readline,termcap}/* + touch lib/{readline,termcap}/Makefile.in # for config.status + sed -ri -e 's:\$[(](RL|HIST)_LIBSRC[)]/[[:alpha:]]*.h::g' Makefile.in || die + + # Avoid regenerating docs after patches #407985 + sed -i -r '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in || die + touch -r . doc/* + + epatch "${FILESDIR}"/${PN}-4.2-execute-job-control.patch #383237 + epatch "${FILESDIR}"/${PN}-4.2-parallel-build.patch + epatch "${FILESDIR}"/${PN}-4.2-no-readline.patch + epatch "${FILESDIR}"/${PN}-4.2-speed-up-read-N.patch + + epatch_user +} + +src_compile() { + local myconf= + + # For descriptions of these, see config-top.h + # bashrc/#26952 bash_logout/#90488 ssh/#24762 + append-cppflags \ + -DDEFAULT_PATH_VALUE=\'\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"\' \ + -DSTANDARD_UTILS_PATH=\'\"/bin:/usr/bin:/sbin:/usr/sbin\"\' \ + -DSYS_BASHRC=\'\"/etc/bash/bashrc\"\' \ + -DSYS_BASH_LOGOUT=\'\"/etc/bash/bash_logout\"\' \ + -DNON_INTERACTIVE_LOGIN_SHELLS \ + -DSSH_SOURCE_BASHRC \ + $(use bashlogger && echo -DSYSLOG_HISTORY) + + # Don't even think about building this statically without + # reading Bug 7714 first. If you still build it statically, + # don't come crying to us with bugs ;). + #use static && export LDFLAGS="${LDFLAGS} -static" + use nls || myconf="${myconf} --disable-nls" + + # Historically, we always used the builtin readline, but since + # our handling of SONAME upgrades has gotten much more stable + # in the PM (and the readline ebuild itself preserves the old + # libs during upgrades), linking against the system copy should + # be safe. + # Exact cached version here doesn't really matter as long as it + # is at least what's in the DEPEND up above. + export ac_cv_rl_version=6.2 + + # Force linking with system curses ... the bundled termcap lib + # sucks bad compared to ncurses. For the most part, ncurses + # is here because readline needs it. But bash itself calls + # ncurses in one or two small places :(. + + use plugins && append-ldflags -Wl,-rpath,/usr/$(get_libdir)/bash + econf \ + --with-installed-readline=. \ + --with-curses \ + $(use_with afs) \ + $(use_enable net net-redirections) \ + --disable-profiling \ + $(use_enable mem-scramble) \ + $(use_with mem-scramble bash-malloc) \ + $(use_enable readline) \ + $(use_enable readline history) \ + $(use_enable readline bang-history) \ + ${myconf} + emake || die + + if use plugins ; then + emake -C examples/loadables all others || die + fi +} + +src_install() { + emake install DESTDIR="${D}" || die + + dodir /bin + mv "${D}"/usr/bin/bash "${D}"/bin/ || die + dosym bash /bin/rbash + + insinto /etc/bash + doins "${FILESDIR}"/{bashrc,bash_logout} + insinto /etc/skel + for f in bash{_logout,_profile,rc} ; do + newins "${FILESDIR}"/dot-${f} .${f} + done + + local sed_args=( + -e "s:#${USERLAND}#@::" + -e '/#@/d' + ) + if ! use readline ; then + sed_args+=( #432338 + -e '/^shopt -s histappend/s:^:#:' + -e 's:use_color=true:use_color=false:' + ) + fi + sed -i \ + "${sed_args[@]}" \ + "${D}"/etc/skel/.bashrc \ + "${D}"/etc/bash/bashrc || die + + if use plugins ; then + exeinto /usr/$(get_libdir)/bash + doexe $(echo examples/loadables/*.o | sed 's:\.o::g') || die + insinto /usr/include/bash-plugins + doins *.h builtins/*.h examples/loadables/*.h include/*.h \ + lib/{glob/glob.h,tilde/tilde.h} + fi + + if use examples ; then + for d in examples/{functions,misc,scripts,scripts.noah,scripts.v2} ; do + exeinto /usr/share/doc/${PF}/${d} + insinto /usr/share/doc/${PF}/${d} + for f in ${d}/* ; do + if [[ ${f##*/} != PERMISSION ]] && [[ ${f##*/} != *README ]] ; then + doexe ${f} + else + doins ${f} + fi + done + done + fi + + doman doc/*.1 + dodoc README NEWS AUTHORS CHANGES COMPAT Y2K doc/FAQ doc/INTRO + dosym bash.info /usr/share/info/bashref.info +} + +pkg_preinst() { + if [[ -e ${ROOT}/etc/bashrc ]] && [[ ! -d ${ROOT}/etc/bash ]] ; then + mkdir -p "${ROOT}"/etc/bash + mv -f "${ROOT}"/etc/bashrc "${ROOT}"/etc/bash/ + fi + + if [[ -L ${ROOT}/bin/sh ]]; then + # rewrite the symlink to ensure that its mtime changes. having /bin/sh + # missing even temporarily causes a fatal error with paludis. + local target=$(readlink "${ROOT}"/bin/sh) + local tmp=$(emktemp "${ROOT}"/bin) + ln -sf "${target}" "${tmp}" + mv -f "${tmp}" "${ROOT}"/bin/sh + fi +} + +pkg_postinst() { + # If /bin/sh does not exist, provide it + if [[ ! -e ${ROOT}/bin/sh ]]; then + ln -sf bash "${ROOT}"/bin/sh + fi +} diff --git a/app-shells/bash/files/bash-4.2-speed-up-read-N.patch b/app-shells/bash/files/bash-4.2-speed-up-read-N.patch new file mode 100644 index 000000000000..b96ad0c887e1 --- /dev/null +++ b/app-shells/bash/files/bash-4.2-speed-up-read-N.patch @@ -0,0 +1,112 @@ +http://lists.gnu.org/archive/html/bug-bash/2012-11/msg00034.html + +From 530d4988afd68ea9d2cf1b0267d4dc821d0d204f Mon Sep 17 00:00:00 2001 +From: Mike Frysinger <vapier@gentoo.org> +Date: Mon, 19 Nov 2012 17:58:51 -0500 +Subject: [PATCH] bash: speed up `read -N` + +Rather than using 1 byte reads, use the existing cache read logic. +This could be sped up more, but this change is not as invasive and +should (hopefully) be fairly safe. + +Signed-off-by: Mike Frysinger <vapier@gentoo.org> +--- + builtins/read.def | 21 ++++++++++++++++----- + externs.h | 1 + + lib/sh/zread.c | 15 +++++++++++++-- + 3 files changed, 30 insertions(+), 7 deletions(-) + +diff --git a/builtins/read.def b/builtins/read.def +index e32dec7..81a1b3f 100644 +--- a/builtins/read.def ++++ b/builtins/read.def +@@ -457,7 +457,10 @@ read_builtin (list) + interrupt_immediately++; + terminate_immediately++; + +- unbuffered_read = (nchars > 0) || (delim != '\n') || input_is_pipe; ++ if ((nchars > 0) && !input_is_tty && ignore_delim) ++ unbuffered_read = 2; ++ else if ((nchars > 0) || (delim != '\n') || input_is_pipe) ++ unbuffered_read = 1; + + if (prompt && edit == 0) + { +@@ -505,10 +508,18 @@ read_builtin (list) + print_ps2 = 0; + } + +- if (unbuffered_read) +- retval = zread (fd, &c, 1); +- else +- retval = zreadc (fd, &c); ++ switch (unbuffered_read) ++ { ++ case 2: ++ retval = zreadcn (fd, &c, nchars - nr); ++ break; ++ case 1: ++ retval = zread (fd, &c, 1); ++ break; ++ default: ++ retval = zreadc (fd, &c); ++ break; ++ } + + if (retval <= 0) + { +diff --git a/externs.h b/externs.h +index 09244fa..a5ad645 100644 +--- a/externs.h ++++ b/externs.h +@@ -479,6 +479,7 @@ extern ssize_t zread __P((int, char *, size_t)); + extern ssize_t zreadretry __P((int, char *, size_t)); + extern ssize_t zreadintr __P((int, char *, size_t)); + extern ssize_t zreadc __P((int, char *)); ++extern ssize_t zreadcn __P((int, char *, int)); + extern ssize_t zreadcintr __P((int, char *)); + extern void zreset __P((void)); + extern void zsyncfd __P((int)); +diff --git a/lib/sh/zread.c b/lib/sh/zread.c +index 5db21a9..af7d02b 100644 +--- a/lib/sh/zread.c ++++ b/lib/sh/zread.c +@@ -101,15 +101,18 @@ static char lbuf[128]; + static size_t lind, lused; + + ssize_t +-zreadc (fd, cp) ++zreadcn (fd, cp, len) + int fd; + char *cp; ++ int len; + { + ssize_t nr; + + if (lind == lused || lused == 0) + { +- nr = zread (fd, lbuf, sizeof (lbuf)); ++ if (len > sizeof (lbuf)) ++ len = sizeof (lbuf); ++ nr = zread (fd, lbuf, len); + lind = 0; + if (nr <= 0) + { +@@ -123,6 +126,14 @@ zreadc (fd, cp) + return 1; + } + ++ssize_t ++zreadc (fd, cp) ++ int fd; ++ char *cp; ++{ ++ return zreadcn (fd, cp, sizeof (lbuf)); ++} ++ + /* Don't mix calls to zreadc and zreadcintr in the same function, since they + use the same local buffer. */ + ssize_t +-- +1.7.12.4 + |