Fix few globbing problems
This commit is contained in:
parent
2d2c0edb5d
commit
fa722a75f7
@ -1,6 +1,6 @@
|
||||
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
|
||||
+++ tcsh-6.17.00/sh.glob.c 2009-11-04 13:58:09.000000000 +0100
|
||||
@@ -423,6 +423,14 @@ handleone(Char *str, Char **vl, int acti
|
||||
return (str);
|
||||
}
|
||||
@ -16,7 +16,7 @@ diff -up tcsh-6.17.00/sh.glob.c.glob-automount tcsh-6.17.00/sh.glob.c
|
||||
static Char **
|
||||
libglob(Char **vl)
|
||||
{
|
||||
@@ -430,6 +438,12 @@ libglob(Char **vl)
|
||||
@@ -430,6 +438,13 @@ libglob(Char **vl)
|
||||
glob_t globv;
|
||||
char *ptr;
|
||||
int nonomatch = adrof(STRnonomatch) != 0, magic = 0, match = 0;
|
||||
@ -26,10 +26,11 @@ diff -up tcsh-6.17.00/sh.glob.c.glob-automount tcsh-6.17.00/sh.glob.c
|
||||
+ char **sres;
|
||||
+ char **res;
|
||||
+ int size = GLOBSPACE;
|
||||
+ int cglob = 0, fglob = 0;
|
||||
|
||||
if (!vl || !vl[0])
|
||||
return(vl);
|
||||
@@ -438,35 +452,124 @@ libglob(Char **vl)
|
||||
@@ -438,35 +453,126 @@ libglob(Char **vl)
|
||||
globv.gl_pathv = 0;
|
||||
globv.gl_pathc = 0;
|
||||
|
||||
@ -40,18 +41,7 @@ diff -up tcsh-6.17.00/sh.glob.c.glob-automount tcsh-6.17.00/sh.glob.c
|
||||
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);
|
||||
- ptr = short2qstr(*vl);
|
||||
- switch (glob(ptr, gflgs, 0, &globv)) {
|
||||
- case GLOB_ABEND:
|
||||
- globfree(&globv);
|
||||
@ -64,6 +54,24 @@ diff -up tcsh-6.17.00/sh.glob.c.glob-automount tcsh-6.17.00/sh.glob.c
|
||||
- /* NOTREACHED */
|
||||
- default:
|
||||
- break;
|
||||
- }
|
||||
- if (globv.gl_flags & GLOB_MAGCHAR) {
|
||||
- match |= (globv.gl_matchc != 0);
|
||||
- magic = 1;
|
||||
+ ptr = short2qstr(*vl);
|
||||
+ if (!any(ptr, '?') && !any(ptr, '*') && !any(ptr, '[') && !any(ptr, ']'))
|
||||
+ {
|
||||
+ ptr = short2str(*vl);
|
||||
+ if (snowc == NULL)
|
||||
+ snowc = nowc = (Char **) xmalloc((size_t) ((blklen(vl) + 1) * sizeof(Char *)));
|
||||
+ *nowc++ = SAVE(ptr);
|
||||
+ *nowc = NULL;
|
||||
+
|
||||
+ continue;
|
||||
+
|
||||
+ }
|
||||
+ else
|
||||
+ cglob++;
|
||||
+ switch (glob(ptr, gflgs, 0, &globv)) {
|
||||
+ case GLOB_ABEND:
|
||||
+ globfree(&globv);
|
||||
@ -87,10 +95,10 @@ diff -up tcsh-6.17.00/sh.glob.c.glob-automount tcsh-6.17.00/sh.glob.c
|
||||
+
|
||||
+ if (snowc != NULL)
|
||||
+ {
|
||||
+ while ((blklen(sres) + blklen(snowc)) >= size) {
|
||||
+ size += GLOBSPACE;
|
||||
+ sres = (Char **) xrealloc((ptr_t) sres, (size_t) (size * sizeof(Char *)));
|
||||
+ }
|
||||
+ while ((blklen(sres) + blklen(snowc)) >= size) {
|
||||
+ size += GLOBSPACE;
|
||||
+ sres = (Char **) xrealloc((ptr_t) sres, (size_t) (size * sizeof(Char *)));
|
||||
+ }
|
||||
+
|
||||
+ if (blklen(sres) == 0)
|
||||
+ {
|
||||
@ -108,10 +116,10 @@ diff -up tcsh-6.17.00/sh.glob.c.glob-automount tcsh-6.17.00/sh.glob.c
|
||||
+
|
||||
+ if (globres != NULL)
|
||||
+ {
|
||||
+ while ((blklen(sres) + blklen(globres)) >= size) {
|
||||
+ size += GLOBSPACE;
|
||||
+ sres = (Char **) xrealloc((ptr_t) sres, (size_t) (size * sizeof(Char *)));
|
||||
+ }
|
||||
+ while ((blklen(sres) + blklen(globres)) >= size) {
|
||||
+ size += GLOBSPACE;
|
||||
+ sres = (Char **) xrealloc((ptr_t) sres, (size_t) (size * sizeof(Char *)));
|
||||
+ }
|
||||
+
|
||||
+ if (blklen(sres) == 0)
|
||||
+ {
|
||||
@ -123,18 +131,12 @@ diff -up tcsh-6.17.00/sh.glob.c.glob-automount tcsh-6.17.00/sh.glob.c
|
||||
+ 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;
|
||||
+ xfree(globres);
|
||||
+ globres = NULL;
|
||||
}
|
||||
- gflgs |= GLOB_APPEND;
|
||||
+ else
|
||||
+ fglob++;
|
||||
+
|
||||
+ globfree(&globv);
|
||||
}
|
||||
@ -146,10 +148,10 @@ diff -up tcsh-6.17.00/sh.glob.c.glob-automount tcsh-6.17.00/sh.glob.c
|
||||
+
|
||||
+ if (snowc != NULL)
|
||||
+ {
|
||||
+ while ((blklen(sres) + blklen(snowc)) >= size) {
|
||||
+ size += GLOBSPACE;
|
||||
+ sres = (Char **) xrealloc((ptr_t) sres, (size_t) (size * sizeof(Char *)));
|
||||
+ }
|
||||
+ while ((blklen(sres) + blklen(snowc)) >= size) {
|
||||
+ size += GLOBSPACE;
|
||||
+ sres = (Char **) xrealloc((ptr_t) sres, (size_t) (size * sizeof(Char *)));
|
||||
+ }
|
||||
+
|
||||
+ if (blklen(sres) == 0)
|
||||
+ {
|
||||
@ -165,8 +167,11 @@ diff -up tcsh-6.17.00/sh.glob.c.glob-automount tcsh-6.17.00/sh.glob.c
|
||||
+ snowc = NULL;
|
||||
+ }
|
||||
+
|
||||
+ if ((cglob != 0) && (cglob == fglob))
|
||||
+ return NULL;
|
||||
+
|
||||
+ if (blklen(sres) != 0)
|
||||
+ vl = saveblk(sres);
|
||||
+ vl = saveblk(sres);
|
||||
+ else
|
||||
+ vl = NULL;
|
||||
+
|
||||
|
@ -3,7 +3,7 @@
|
||||
Summary: An enhanced version of csh, the C shell
|
||||
Name: tcsh
|
||||
Version: 6.17
|
||||
Release: 4%{?dist}
|
||||
Release: 5%{?dist}
|
||||
License: BSD
|
||||
Group: System Environment/Shells
|
||||
Source: ftp://ftp.astron.com/pub/tcsh/%{name}-%{version}.00.tar.gz
|
||||
@ -126,6 +126,9 @@ fi
|
||||
%{_mandir}/man1/*.1*
|
||||
|
||||
%changelog
|
||||
* Wed Nov 4 2009 Vitezslav Crhonek <vcrhonek@redhat.com> - 6.17-5
|
||||
- Fix few globbing problems
|
||||
|
||||
* 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
|
||||
|
Loading…
Reference in New Issue
Block a user