From cdde4aaee97a971ef322ef866b1f34b651ce6189 Mon Sep 17 00:00:00 2001 From: Kacper Kornet Date: Fri, 30 Mar 2012 02:01:17 +0000 Subject: [PATCH] - up to 40e - tty_close.patch from http://article.gmane.org/gmane.os.miros.mksh/19 Changed files: mksh-circumflex.patch -> 1.2 mksh-columns.patch -> 1.2 mksh-distro.patch -> 1.5 mksh-tty_close.patch -> 1.1 mksh.spec -> 1.39 --- mksh-circumflex.patch | 17 ++++++++--------- mksh-columns.patch | 31 ------------------------------- mksh-distro.patch | 14 +++++++------- mksh-tty_close.patch | 23 +++++++++++++++++++++++ mksh.spec | 10 +++++----- 5 files changed, 43 insertions(+), 52 deletions(-) delete mode 100644 mksh-columns.patch create mode 100644 mksh-tty_close.patch diff --git a/mksh-circumflex.patch b/mksh-circumflex.patch index 0952788..62139e4 100644 --- a/mksh-circumflex.patch +++ b/mksh-circumflex.patch @@ -4,7 +4,7 @@ diff -ur mksh-40.org//eval.c mksh-40/eval.c @@ -887,6 +887,7 @@ switch (c) { case '[': - case NOT: + case '!': + case NOT2: case '-': case ']': @@ -16,8 +16,8 @@ diff -ur mksh-40.org//misc.c mksh-40/misc.c if (!in_bracket) { saw_glob = true; in_bracket = true; -- if (ISMAGIC(p[1]) && p[2] == NOT) -+ if (ISMAGIC(p[1]) && (p[2] == NOT || p[2] == NOT2)) +- if (ISMAGIC(p[1]) && p[2] == '!') ++ if (ISMAGIC(p[1]) && (p[2] == '!' || p[2] == NOT2)) p += 2; if (ISMAGIC(p[1]) && p[2] == ']') p += 2; @@ -25,18 +25,17 @@ diff -ur mksh-40.org//misc.c mksh-40/misc.c int c, d, notp, found = 0; const unsigned char *orig_p = p; -- if ((notp = (ISMAGIC(*p) && *++p == NOT))) -+ if ((notp = (ISMAGIC(*p) && (*++p == NOT || *p == NOT2)))) +- if ((notp = (ISMAGIC(*p) && *++p == '!'))) ++ if ((notp = (ISMAGIC(*p) && (*++p == '!' || *p == NOT2)))) p++; do { c = *p++; diff -ur mksh-40.org//sh.h mksh-40/sh.h --- mksh-40.org//sh.h 2011-06-12 16:59:09.000000000 +0200 +++ mksh-40/sh.h 2011-07-07 18:29:16.346761511 +0200 -@@ -380,6 +380,7 @@ +@@ -380,5 +380,6 @@ #define MAGIC (7) /* prefix for *?[!{,} during expand */ #define ISMAGIC(c) ((unsigned char)(c) == MAGIC) - #define NOT '!' /* might use ^ (ie, [!...] vs [^..]) */ +#define NOT2 '^' #define LINE 4096 /* input line size */ @@ -48,8 +47,8 @@ diff -ur mksh-40.org//tree.c mksh-40/tree.c case CHAR: c = *wp++; if ((opmode & WDS_MAGIC) && -- (ISMAGIC(c) || c == '[' || c == NOT || -+ (ISMAGIC(c) || c == '[' || c == NOT || c == NOT2 || +- (ISMAGIC(c) || c == '[' || c == '!' || ++ (ISMAGIC(c) || c == '[' || c == '!' || c == NOT2 || c == '-' || c == ']' || c == '*' || c == '?')) shf_putc(MAGIC, shf); shf_putc(c, shf); diff --git a/mksh-columns.patch b/mksh-columns.patch deleted file mode 100644 index 06c24dc..0000000 --- a/mksh-columns.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff -u -p -u -p -r1.522 sh.h ---- sh.h 3 Mar 2012 21:31:21 -0000 1.522 -+++ sh.h 9 Mar 2012 15:14:49 -0000 -@@ -855,7 +855,7 @@ EXTERN char *current_wd; - */ - #define MIN_COLS (2 + MIN_EDIT_SPACE + 3) - #define MIN_LINS 3 --EXTERN mksh_ari_t x_cols E_INIT(80); /* tty columns */ -+EXTERN mksh_ari_t x_cols E_INIT(-1); /* tty columns */ - EXTERN mksh_ari_t x_lins E_INIT(-1); /* tty lines */ - - /* These to avoid bracket matching problems */ -diff -u -p -u -p -r1.141 var.c ---- var.c 3 Mar 2012 21:31:23 -0000 1.141 -+++ var.c 9 Mar 2012 15:14:49 -0000 -@@ -1458,14 +1458,13 @@ set_array(const char *var, bool reset, c - void - change_winsz(void) - { -- if (x_lins < 0) { -+ if (x_cols < 0 && x_lins < 0) { - /* first time initialisation */ - #ifdef TIOCGWINSZ - if (tty_fd < 0) - /* non-FTALKING, try to get an fd anyway */ - tty_init(true, false); - #endif -- x_cols = -1; - } - - #ifdef TIOCGWINSZ diff --git a/mksh-distro.patch b/mksh-distro.patch index 549582b..7ead549 100644 --- a/mksh-distro.patch +++ b/mksh-distro.patch @@ -5,8 +5,8 @@ diff -ur mksh.org/check.t mksh/check.t # http://www.research.att.com/~gsf/public/ifs.sh expected-stdout: -- @(#)MIRBSD KSH R40 2011/12/11 -+ @(#)MIRBSD KSH R40 2011/12/11 @DISTRO@ +- @(#)MIRBSD KSH R40 2012/03/20 ++ @(#)MIRBSD KSH R40 2012/03/20 @DISTRO@ description: Check version of shell. stdin: @@ -15,10 +15,10 @@ diff -ur mksh.org/sh.h mksh/sh.h +++ mksh/sh.h 2011-07-12 08:01:04.445312267 +0200 @@ -153,7 +153,7 @@ #ifdef EXTERN - __RCSID("$MirOS: src/bin/mksh/sh.h,v 1.484.2.11 2011/12/11 18:18:28 tg Exp $"); + __RCSID("$MirOS: src/bin/mksh/sh.h,v 1.484.2.16 2012/03/24 21:22:43 tg Exp $"); #endif --#define MKSH_VERSION "R40 2011/12/11" -+#define MKSH_VERSION "R40 2011/12/11 @DISTRO@" - - #ifndef MKSH_INCLUDES_ONLY +-#define MKSH_VERSION "R40 2012/03/20" ++#define MKSH_VERSION "R40 2012/03/20 @DISTRO@" + /* arithmetic types: C implementation */ + #if !HAVE_CAN_INTTYPES diff --git a/mksh-tty_close.patch b/mksh-tty_close.patch new file mode 100644 index 0000000..7715503 --- /dev/null +++ b/mksh-tty_close.patch @@ -0,0 +1,23 @@ +commit 04ac6ad16336a70603c4817d678f9a1eddd18c74 +Author: tg +Date: Sun Mar 25 14:28:11 2012 +0000 + + fix regression w.r.t. TTY and external programmes: + • release the TTY after the initial change_winsz() + • since we release it, we can skip initialising tty_state, too + +diff --git a/main.c b/main.c +index 8022782..0405b1b 100644 +--- a/main.c ++++ b/main.c +@@ -252,8 +252,9 @@ main_init(int argc, const char *argv[], Source **sp, struct block **lp) + + #ifdef TIOCGWINSZ + /* try to initialise tty size before importing environment */ +- tty_init(true, false); ++ tty_init(false, false); + change_winsz(); ++ tty_close(); + #endif + + #ifdef _PATH_DEFPATH diff --git a/mksh.spec b/mksh.spec index 23fcbb0..20ae3ab 100644 --- a/mksh.spec +++ b/mksh.spec @@ -4,19 +4,19 @@ Summary: MirBSD Korn Shell Summary(pl.UTF-8): Powłoka Korna z MirBSD Name: mksh -Version: 40d -Release: 3 +Version: 40e +Release: 1 License: BSD Group: Applications/Shells Source0: http://www.mirbsd.org/MirOS/dist/mir/mksh/%{name}-R%{version}.cpio.gz -# Source0-md5: c6428401103367730a95b99284bf47dc +# Source0-md5: d9a2df50c09692fc24d52ee9cf3bb789 Source1: %{name}-mkshrc Patch0: %{name}-mkshrc_support.patch Patch1: %{name}-circumflex.patch Patch2: %{name}-no_stop_alias.patch Patch3: %{name}-distro.patch Patch4: %{name}-cmdline-length.patch -Patch5: %{name}-columns.patch +Patch5: %{name}-tty_close.patch URL: https://www.mirbsd.org/mksh.htm %if %{with tests} BuildRequires: ed @@ -87,7 +87,7 @@ mv mksh/* .; rmdir mksh %patch2 -p1 %patch3 -p1 %patch4 -p1 -%patch5 -p0 +%patch5 -p1 sed -i -e 's#@DISTRO@#PLD/Linux 3.0#g' check.t sh.h -- 2.44.0