Fix tcsh globbing causing bad automount, Fix truncated history file after
network crash
This commit is contained in:
parent
4d81496279
commit
2d2c0edb5d
176
tcsh-6.17.00-glob-automount.patch
Normal file
176
tcsh-6.17.00-glob-automount.patch
Normal file
@ -0,0 +1,176 @@
|
||||
diff -up tcsh-6.17.00/sh.glob.c.glob-automount tcsh-6.17.00/sh.glob.c
|
||||
--- tcsh-6.17.00/sh.glob.c.glob-automount 2008-06-19 17:20:56.000000000 +0200
|
||||
+++ tcsh-6.17.00/sh.glob.c 2009-10-19 16:51:39.000000000 +0200
|
||||
@@ -423,6 +423,14 @@ handleone(Char *str, Char **vl, int acti
|
||||
return (str);
|
||||
}
|
||||
|
||||
+static char **blkend(char **up)
|
||||
+{
|
||||
+
|
||||
+ while (*up)
|
||||
+ up++;
|
||||
+ return (up);
|
||||
+}
|
||||
+
|
||||
static Char **
|
||||
libglob(Char **vl)
|
||||
{
|
||||
@@ -430,6 +438,12 @@ libglob(Char **vl)
|
||||
glob_t globv;
|
||||
char *ptr;
|
||||
int nonomatch = adrof(STRnonomatch) != 0, magic = 0, match = 0;
|
||||
+ char **snowc = NULL;
|
||||
+ char **nowc;
|
||||
+ char **globres;
|
||||
+ char **sres;
|
||||
+ char **res;
|
||||
+ int size = GLOBSPACE;
|
||||
|
||||
if (!vl || !vl[0])
|
||||
return(vl);
|
||||
@@ -438,35 +452,124 @@ libglob(Char **vl)
|
||||
globv.gl_pathv = 0;
|
||||
globv.gl_pathc = 0;
|
||||
|
||||
+ sres = res = (Char **) xmalloc((size_t) (size * sizeof(Char *)));
|
||||
+ *res = NULL;
|
||||
+
|
||||
if (nonomatch)
|
||||
gflgs |= GLOB_NOCHECK;
|
||||
|
||||
do {
|
||||
+ ptr = short2str(*vl);
|
||||
+ if (!any(ptr, '?') && !any(ptr, '*') && !any(ptr, '[') && !any(ptr, ']'))
|
||||
+ {
|
||||
+ if (snowc == NULL)
|
||||
+ snowc = nowc = (Char **) xmalloc((size_t) ((blklen(vl) + 1) * sizeof(Char *)));
|
||||
+ *nowc++ = SAVE(ptr);
|
||||
+ *nowc = NULL;
|
||||
+
|
||||
+ continue;
|
||||
+
|
||||
+ }
|
||||
ptr = short2qstr(*vl);
|
||||
- switch (glob(ptr, gflgs, 0, &globv)) {
|
||||
- case GLOB_ABEND:
|
||||
- globfree(&globv);
|
||||
- setname(ptr);
|
||||
- stderror(ERR_NAME | ERR_GLOB);
|
||||
- /* NOTREACHED */
|
||||
- case GLOB_NOSPACE:
|
||||
- globfree(&globv);
|
||||
- stderror(ERR_NOMEM);
|
||||
- /* NOTREACHED */
|
||||
- default:
|
||||
- break;
|
||||
+ switch (glob(ptr, gflgs, 0, &globv)) {
|
||||
+ case GLOB_ABEND:
|
||||
+ globfree(&globv);
|
||||
+ setname(ptr);
|
||||
+ stderror(ERR_NAME | ERR_GLOB);
|
||||
+ /* NOTREACHED */
|
||||
+ case GLOB_NOSPACE:
|
||||
+ globfree(&globv);
|
||||
+ stderror(ERR_NOMEM);
|
||||
+ /* NOTREACHED */
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ if (globv.gl_flags & GLOB_MAGCHAR) {
|
||||
+ match |= (globv.gl_matchc != 0);
|
||||
+ magic = 1;
|
||||
+ }
|
||||
+
|
||||
+ globres = (globv.gl_pathc == 0 || (magic && !match && !nonomatch)) ?
|
||||
+ NULL : blk2short(globv.gl_pathv);
|
||||
+
|
||||
+ if (snowc != NULL)
|
||||
+ {
|
||||
+ while ((blklen(sres) + blklen(snowc)) >= size) {
|
||||
+ size += GLOBSPACE;
|
||||
+ sres = (Char **) xrealloc((ptr_t) sres, (size_t) (size * sizeof(Char *)));
|
||||
+ }
|
||||
+
|
||||
+ if (blklen(sres) == 0)
|
||||
+ {
|
||||
+ sres = blkcpy(sres, snowc);
|
||||
+ res = blkend(sres);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ res = blkend(sres);
|
||||
+ res = blkcpy(res, snowc);
|
||||
+ }
|
||||
+ xfree(snowc);
|
||||
+ snowc = NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (globres != NULL)
|
||||
+ {
|
||||
+ while ((blklen(sres) + blklen(globres)) >= size) {
|
||||
+ size += GLOBSPACE;
|
||||
+ sres = (Char **) xrealloc((ptr_t) sres, (size_t) (size * sizeof(Char *)));
|
||||
+ }
|
||||
+
|
||||
+ if (blklen(sres) == 0)
|
||||
+ {
|
||||
+ sres = blkcpy(sres, globres);
|
||||
+ res = blkend(sres);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ res = blkend(sres);
|
||||
+ res = blkcpy(res, globres);
|
||||
+ }
|
||||
+ xfree(globres);
|
||||
+ globres = NULL;
|
||||
}
|
||||
- if (globv.gl_flags & GLOB_MAGCHAR) {
|
||||
- match |= (globv.gl_matchc != 0);
|
||||
- magic = 1;
|
||||
+ else
|
||||
+ {
|
||||
+ globfree(&globv);
|
||||
+ return NULL;
|
||||
}
|
||||
- gflgs |= GLOB_APPEND;
|
||||
+
|
||||
+ globfree(&globv);
|
||||
}
|
||||
while (*++vl);
|
||||
- vl = (globv.gl_pathc == 0 || (magic && !match && !nonomatch)) ?
|
||||
- NULL : blk2short(globv.gl_pathv);
|
||||
- globfree(&globv);
|
||||
- return (vl);
|
||||
+
|
||||
+ if (snowc != NULL)
|
||||
+ {
|
||||
+ while ((blklen(sres) + blklen(snowc)) >= size) {
|
||||
+ size += GLOBSPACE;
|
||||
+ sres = (Char **) xrealloc((ptr_t) sres, (size_t) (size * sizeof(Char *)));
|
||||
+ }
|
||||
+
|
||||
+ if (blklen(sres) == 0)
|
||||
+ {
|
||||
+ sres = blkcpy(sres, snowc);
|
||||
+ res = blkend(sres);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ res = blkend(sres);
|
||||
+ res = blkcpy(res, snowc);
|
||||
+ }
|
||||
+ xfree(snowc);
|
||||
+ snowc = NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (blklen(sres) != 0)
|
||||
+ vl = saveblk(sres);
|
||||
+ else
|
||||
+ vl = NULL;
|
||||
+
|
||||
+ return vl;
|
||||
}
|
||||
|
||||
Char *
|
12
tcsh-6.17.00-history.patch
Normal file
12
tcsh-6.17.00-history.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff -up tcsh-6.17.00/sh.c_old tcsh-6.17.00/sh.c
|
||||
--- tcsh-6.17.00/sh.c_old 2009-10-19 17:18:01.000000000 +0200
|
||||
+++ tcsh-6.17.00/sh.c 2009-10-19 17:18:50.000000000 +0200
|
||||
@@ -1291,6 +1291,8 @@ main(int argc, char **argv)
|
||||
/*
|
||||
* Mop-up.
|
||||
*/
|
||||
+ /* Take care of these (especially HUP) here instead of inside flush. */
|
||||
+ handle_pending_signals();
|
||||
if (intty) {
|
||||
if (loginsh) {
|
||||
xprintf("logout\n");
|
13
tcsh.spec
13
tcsh.spec
@ -3,7 +3,7 @@
|
||||
Summary: An enhanced version of csh, the C shell
|
||||
Name: tcsh
|
||||
Version: 6.17
|
||||
Release: 3%{?dist}
|
||||
Release: 4%{?dist}
|
||||
License: BSD
|
||||
Group: System Environment/Shells
|
||||
Source: ftp://ftp.astron.com/pub/tcsh/%{name}-%{version}.00.tar.gz
|
||||
@ -18,6 +18,11 @@ Patch9: tcsh-6.13.00-memoryuse.patch
|
||||
Patch11: tcsh-6.14.00-order.patch
|
||||
Patch12: tcsh-6.15.00-rs-color.patch
|
||||
Patch13: tcsh-6.17.00-mh-color.patch
|
||||
# The idea is good, but the patch must be rewritten to be accepted by upstream
|
||||
# (see tcsh mailing list for more information):
|
||||
Patch14: tcsh-6.17.00-glob-automount.patch
|
||||
# Accepted by upstream:
|
||||
Patch15: tcsh-6.17.00-history.patch
|
||||
Provides: csh = %{version}
|
||||
Requires(post): grep
|
||||
Requires(postun): coreutils, grep
|
||||
@ -46,6 +51,8 @@ like syntax.
|
||||
%patch11 -p1 -b .order
|
||||
%patch12 -p1 -b .rs-color
|
||||
%patch13 -p1 -b .mh-color
|
||||
%patch14 -p1 -b .glob-automount
|
||||
%patch15 -p1 -b .history
|
||||
|
||||
for i in Fixes WishList; do
|
||||
iconv -f iso-8859-1 -t utf-8 "$i" > "${i}_" && \
|
||||
@ -119,6 +126,10 @@ fi
|
||||
%{_mandir}/man1/*.1*
|
||||
|
||||
%changelog
|
||||
* Mon Oct 19 2009 Vitezslav Crhonek <vcrhonek@redhat.com> - 6.17-4
|
||||
- Fix tcsh globbing causing bad automount
|
||||
- Fix truncated history file after network crash
|
||||
|
||||
* Wed Aug 26 2009 Vitezslav Crhonek <vcrhonek@redhat.com> - 6.17-3
|
||||
- Add new colorls variable
|
||||
Resolves: #518808
|
||||
|
Loading…
Reference in New Issue
Block a user