This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi! Please see http://sources.redhat.com/ml/bug-glibc/2001-11/msg00109.html for description. I have slightly changed next_brace_sub so that it doesn't use break and doesn't compare character with '}' twice, plus added tests to globtest.sh. Bootstrapped on i686, no make check regressions. 2001-11-29 Jakub Jelinek <jakub@redhat.com> * sysdeps/generic/glob.c (next_brace_sub): Return NULL if braces don't match, fix {{a,b},c} globbing, clean up. Patch by Flavio Veloso <flaviovs@magnux.com>. * posix/globtest.sh: Add new tests. --- libc/posix/globtest.sh.jj Thu Aug 23 18:48:53 2001 +++ libc/posix/globtest.sh Thu Nov 29 13:32:05 2001 @@ -146,6 +146,32 @@ if test $failed -ne 0; then result=1 fi +failed=0 +${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${common_objpfx}posix/globtest -b "$testdir" "{file{1,2},-file3}" | +sort > $testout +cat <<"EOF" | cmp - $testout >> $logfile || failed=1 +`-file3' +`file1' +`file2' +EOF +if test $failed -ne 0; then + echo "Braces test 2 failed" >> $logfile + result=1 +fi + +failed=0 +${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${common_objpfx}posix/globtest -b "$testdir" "{" | +sort > $testout +cat <<"EOF" | cmp - $testout >> $logfile || failed=1 +GLOB_NOMATCH +EOF +if test $failed -ne 0; then + echo "Braces test 3 failed" >> $logfile + result=1 +fi + # Test NOCHECK failed=0 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ --- libc/sysdeps/generic/glob.c.jj Thu Aug 23 18:49:29 2001 +++ libc/sysdeps/generic/glob.c Thu Nov 29 13:17:21 2001 @@ -355,42 +355,14 @@ static inline #endif const char * -next_brace_sub (begin) - const char *begin; +next_brace_sub (cp) + const char *cp; { unsigned int depth = 0; - const char *cp = begin; - - while (1) - { - if (depth == 0) - { - if (*cp != ',' && *cp != '}' && *cp != '\0') - { - if (*cp == '{') - ++depth; - ++cp; - continue; - } - } - else - { - while (*cp != '\0' && (*cp != '}' || depth > 0)) - { - if (*cp == '}') - --depth; - ++cp; - } - if (*cp == '\0') - /* An incorrectly terminated brace expression. */ - return NULL; - - continue; - } - break; - } - - return cp; + while (*cp != '\0' && (*cp != '}' || depth--) && (*cp != ',' || depth)) + if (*cp++ == '{') + depth++; + return *cp != '\0' ? cp : NULL; } #endif /* !GLOB_ONLY_P */ Jakub
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |