Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package tree for openSUSE:Factory checked in at 2022-08-29 11:59:40 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/tree (Old) and /work/SRC/openSUSE:Factory/.tree.new.2083 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "tree" Mon Aug 29 11:59:40 2022 rev:26 rq:999908 version:2.0.3 Changes: -------- --- /work/SRC/openSUSE:Factory/tree/tree.changes 2022-02-17 23:42:17.907700034 +0100 +++ /work/SRC/openSUSE:Factory/.tree.new.2083/tree.changes 2022-08-29 11:59:41.462257859 +0200 @@ -1,0 +2,12 @@ +Sun Aug 28 16:45:30 UTC 2022 - Andreas Stieger <[email protected]> + +- tree 2.0.3: + * Fix segfault when filelimit is used and tree encounters a + directory it cannot enter + * Fixed broken -x option (stops recursing.) + * Fix use after free (causing segfault) for dir/subdir in list.c + * Multiple fixes for .gitignore functionality + * Fixed segfault when an unknown directory is given with -X + * Fixed output up for -X and -J options + +------------------------------------------------------------------- Old: ---- tree-2.0.2.tgz New: ---- tree-2.0.3.tgz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ tree.spec ++++++ --- /var/tmp/diff_new_pack.4mhKci/_old 2022-08-29 11:59:41.898258878 +0200 +++ /var/tmp/diff_new_pack.4mhKci/_new 2022-08-29 11:59:41.902258887 +0200 @@ -17,13 +17,13 @@ Name: tree -Version: 2.0.2 +Version: 2.0.3 Release: 0 Summary: File listing as a tree License: GPL-2.0-or-later Group: Productivity/File utilities -URL: http://mama.indstate.edu/users/ice/tree/ -Source0: http://mama.indstate.edu/users/ice/tree/src/%{name}-%{version}.tgz +URL: https://mama.indstate.edu/users/ice/tree/ +Source0: https://mama.indstate.edu/users/ice/tree/src/%{name}-%{version}.tgz %description Tree is a recursive directory listing command that produces a depth ++++++ tree-2.0.2.tgz -> tree-2.0.3.tgz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tree-2.0.2/CHANGES new/tree-2.0.3/CHANGES --- old/tree-2.0.2/CHANGES 2022-02-16 22:45:05.000000000 +0100 +++ new/tree-2.0.3/CHANGES 2022-08-26 23:55:19.000000000 +0200 @@ -1,3 +1,29 @@ +Version 2.0.3 (08/26/2022) + - Fix segfault when filelimit is used and tree encounters a directory it + cannot enter. (Kenta Arai) + - Use += when assigning CFLAGS and LDFLAGS in the Makefile allowing + them to be modified by environment variables during make. (Ben Brown) + Possibly assumes GNU make. + - Fixed broken -x option (stops recursing.) (balping) + - Fix use after free (causing segfault) for dir/subdir in list.c (Erik + Skultety / Ben Brown) + - Fixes for .gitignore functionality (Saniya Maheshwari / Mig-hub ? / Carlos + Pinto) + - Fixed * handing in patmatch. Worked almost like ** before, now properly + stops at /'s. These issues were the result of forgetting that patmatch() + was just to match filenames to patterns, not paths. + - Patterns starting with / are actually relative to the .gitignore file, + not the root of the filesystem, go figure. + - Patterns without /'s in .gitignore apply to any file in any directory + under the .gitignore, not just the .gitignore directory + - Remove "All rights reserved" from copyright statements. A left-over from + trees original artistic license. + - Add in --du and --prune to --help output (Nxueyamao?) + - Fixed segfault when an unknown directory is given with -X + - Fixed output up for -X and -J options. + - Remove one reference to strnlen which isn't necessary since it may not + be available on some OS's. + Version 2.0.2 (02/16/2022) - Okay, apparently the stddata addition is causing havoc (who knew how many scripts just haphazardly hand programs random file descriptors, that's diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tree-2.0.2/Makefile new/tree-2.0.3/Makefile --- old/tree-2.0.2/Makefile 2022-02-16 22:45:43.000000000 +0100 +++ new/tree-2.0.3/Makefile 2022-08-26 21:14:41.000000000 +0200 @@ -21,7 +21,7 @@ CC=gcc INSTALL=install -VERSION=2.0.2 +VERSION=2.0.3 TREE_DEST=tree DESTDIR=${PREFIX}/bin MAN=tree.1 @@ -32,62 +32,62 @@ # Uncomment options below for your particular OS: # Linux defaults: -#CFLAGS=-ggdb -pedantic -Wall -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -CFLAGS=-O3 -pedantic -Wall -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -LDFLAGS=-s +CFLAGS=-ggdb -pedantic -Wall -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 +#CFLAGS+=-O3 -pedantic -Wall -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 +#LDFLAGS+=-s # Uncomment for FreeBSD: #CC=cc -#CFLAGS=-O2 -Wall -fomit-frame-pointer -#LDFLAGS=-s +#CFLAGS+=-O2 -Wall -fomit-frame-pointer +#LDFLAGS+=-s # Uncomment for OpenBSD: #TREE_DEST=colortree #MAN=colortree.1 -#CFLAGS=-O2 -Wall -fomit-frame-pointer -#LDFLAGS=-s +#CFLAGS+=-O2 -Wall -fomit-frame-pointer +#LDFLAGS+=-s # Uncomment for Solaris: #CC=cc -#CFLAGS=-xO0 -v -#LDFLAGS= +#CFLAGS+=-xO0 -v +#LDFLAGS+= #MANDIR=${prefix}/share/man # Uncomment for Cygwin: -#CFLAGS=-O2 -Wall -fomit-frame-pointer -#LDFLAGS=-s +#CFLAGS+=-O2 -Wall -fomit-frame-pointer +#LDFLAGS+=-s #TREE_DEST=tree.exe # Uncomment for OS X: # It is not allowed to install to /usr/bin on OS X any longer (SIP): #CC=cc -#CFLAGS=-O2 -Wall -fomit-frame-pointer -no-cpp-precomp -#LDFLAGS= +#CFLAGS+=-O2 -Wall -fomit-frame-pointer -no-cpp-precomp +#LDFLAGS+= #MANDIR=${PREFIX}/share/man # Uncomment for HP/UX: #prefix=/opt #CC=cc # manpage of mbsrtowcs() requires C99 and the two defines -#CFLAGS=+w -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=200112 -AC99 -#LDFLAGS= +#CFLAGS+=+w -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=200112 -AC99 +#LDFLAGS+= #MANDIR=${PREFIX}/share/man # Uncomment for OS/2: -#CFLAGS=-02 -Wall -fomit-frame-pointer -Zomf -Zsmall-conv -#LDFLAGS=-s -Zomf -Zsmall-conv +#CFLAGS+=-02 -Wall -fomit-frame-pointer -Zomf -Zsmall-conv +#LDFLAGS+=-s -Zomf -Zsmall-conv # Uncomment for HP NonStop: #prefix = /opt #CC=c89 -#CFLAGS=-Wextensions -WIEEE_float -g -Wnowarn=1506 -D_XOPEN_SOURCE_EXTENDED=1 \ +#CFLAGS+=-Wextensions -WIEEE_float -g -Wnowarn=1506 -D_XOPEN_SOURCE_EXTENDED=1 \ # -Wallow_cplusplus_comments -#LDFLAGS= +#LDFLAGS+= # AIX #CC=cc_r -q64 #LD=ld -d64 -#LDFLAGS=-lc +#LDFLAGS+=-lc #------------------------------------------------------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tree-2.0.2/README new/tree-2.0.3/README --- old/tree-2.0.2/README 2022-02-16 22:50:42.000000000 +0100 +++ new/tree-2.0.3/README 2022-08-27 00:14:49.000000000 +0200 @@ -9,7 +9,13 @@ hide something from you. The main distribution site for tree is here: + http://oldmanprogrammer.net/code.php?src=tree + Backup GIT sites are: + https://gitlab.com/OldManProgrammer/unix-tree + https://github.com/Old-Man-Programmer/tree + + Old site for as long as it lasts: http://mama.indstate.edu/users/ice/tree/ ftp://mama.indstate.edu/linux/tree/ @@ -260,8 +266,21 @@ Maxim Cournoyer - Reported HTML url output issue w/ 2.0.0-2.0.1 +Kenta Arai + - Reported Segfault with --filelimit option + +Ben Brown + - Updates to the Makefile + - Reported use after free error + +Erik Skultety + - Reported same use after error + +Saniya Maheshwari / Mig-hub ? / Carlos Pinto + - Reported various issues with --gitignore + And many others whom I've failed to keep track of. I should have started this list years ago. - - Steve Baker - [email protected] + - Steve Baker + [email protected] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tree-2.0.2/color.c new/tree-2.0.3/color.c --- old/tree-2.0.2/color.c 2022-01-05 01:41:38.000000000 +0100 +++ new/tree-2.0.3/color.c 2022-06-16 15:38:02.000000000 +0200 @@ -1,6 +1,5 @@ /* $Copyright: $ * Copyright (c) 1996 - 2022 by Steve Baker ([email protected]) - * All Rights reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tree-2.0.2/doc/tree.1 new/tree-2.0.3/doc/tree.1 --- old/tree-2.0.2/doc/tree.1 2022-02-15 01:18:37.000000000 +0100 +++ new/tree-2.0.3/doc/tree.1 2022-02-24 02:38:15.000000000 +0100 @@ -302,7 +302,7 @@ .B -i Makes tree not print the indentation lines, useful when used in conjunction with the \fB-f\fP option. Also removes as much whitespace as possible when used -with the \fB-J\fP or \fB-x\fP options. +with the \fB-J\fP or \fB-X\fP options. .PP .TP .B -A diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tree-2.0.2/file.c new/tree-2.0.3/file.c --- old/tree-2.0.2/file.c 2022-01-03 20:15:09.000000000 +0100 +++ new/tree-2.0.3/file.c 2022-06-16 15:38:06.000000000 +0200 @@ -1,6 +1,5 @@ /* $Copyright: $ * Copyright (c) 1996 - 2022 by Steve Baker ([email protected]) - * All Rights reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,7 +18,7 @@ #include "tree.h" extern bool dflag, Fflag, aflag, fflag, pruneflag; -extern bool noindent, force_color, flimit, matchdirs; +extern bool noindent, force_color, matchdirs; extern bool reverse; extern int pattern, ipattern; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tree-2.0.2/filter.c new/tree-2.0.3/filter.c --- old/tree-2.0.2/filter.c 2022-01-03 20:09:40.000000000 +0100 +++ new/tree-2.0.3/filter.c 2022-08-26 23:24:05.000000000 +0200 @@ -1,6 +1,5 @@ /* $Copyright: $ * Copyright (c) 1996 - 2022 by Steve Baker ([email protected]) - * All Rights reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,7 +23,7 @@ void gittrim(char *s) { - int i, e = strnlen(s,PATH_MAX)-1; + int i, e = strlen(s)-1; if (s[e] == '\n') e--; @@ -43,7 +42,8 @@ struct pattern *new_pattern(char *pattern) { struct pattern *p = xmalloc(sizeof(struct pattern)); - p->pattern = scopy(pattern); + p->pattern = scopy(pattern + ((pattern[0] == '/')? 1 : 0)); + p->relative = (strchr(pattern,'/') == NULL); p->next = NULL; return p; } @@ -132,17 +132,33 @@ int fpos = sprintf(fpattern, "%s/", ig->path); for(p = ig->remove; p != NULL; p = p->next) { - if (patmatch(path, p->pattern, isdir) == 1) { - filter = 1; - break; + if (p->relative) { + if (patmatch(name, p->pattern, isdir) == 1) { +// printf("> name: %s, pattern: %s\n", path, p->pattern); + filter = 1; + break; + } + } else { + sprintf(fpattern + fpos, "%s", p->pattern); +// printf("> path: %s, fpattern: %s\n", path, fpattern); + if (patmatch(path, fpattern, isdir) == 1) { +// printf("Matched path: %s, fpattern: %s\n", path, fpattern); + filter = 1; + break; + } } - if (p->pattern[0] == '/') continue; - sprintf(fpattern + fpos, "%s", p->pattern); - if (patmatch(path, fpattern, isdir) == 1) { - filter = 1; - break; - } - } + +// if (patmatch(path, p->pattern, isdir) == 1) { +// filter = 1; +// break; +// } +// if (p->pattern[0] == '/') continue; +// sprintf(fpattern + fpos, "%s", p->pattern); +// if (patmatch(path, fpattern, isdir) == 1) { +// filter = 1; +// break; +// } + } } if (!filter) return 0; @@ -150,12 +166,19 @@ int fpos = sprintf(fpattern, "%s/", ig->path); for(p = ig->reverse; p != NULL; p = p->next) { - if (patmatch(path, p->pattern, isdir) == 1) return 0; - - if (p->pattern[0] == '/') continue; - sprintf(fpattern + fpos, "%s", p->pattern); + if (p->relative) { + if (patmatch(name, p->pattern, isdir) == 1) return 0; + } else { + sprintf(fpattern + fpos, "%s", p->pattern); + if (patmatch(path, fpattern, isdir) == 1) return 0; + } - if (patmatch(path, fpattern, isdir) == 1) return 0; +// if (patmatch(path, p->pattern, isdir) == 1) return 0; +// +// if (p->pattern[0] == '/') continue; +// sprintf(fpattern + fpos, "%s", p->pattern); +// +// if (patmatch(path, fpattern, isdir) == 1) return 0; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tree-2.0.2/hash.c new/tree-2.0.3/hash.c --- old/tree-2.0.2/hash.c 2022-01-03 20:14:47.000000000 +0100 +++ new/tree-2.0.3/hash.c 2022-06-16 15:38:14.000000000 +0200 @@ -1,6 +1,5 @@ /* $Copyright: $ * Copyright (c) 1996 - 2022 by Steve Baker ([email protected]) - * All Rights reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tree-2.0.2/html.c new/tree-2.0.3/html.c --- old/tree-2.0.2/html.c 2022-02-16 22:34:22.000000000 +0100 +++ new/tree-2.0.3/html.c 2022-06-16 15:38:18.000000000 +0200 @@ -1,6 +1,5 @@ /* $Copyright: $ * Copyright (c) 1996 - 2022 by Steve Baker ([email protected]) - * All Rights reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,7 +20,7 @@ extern char *version, *hversion; extern bool dflag, lflag, pflag, sflag, Fflag, aflag, fflag, uflag, gflag; extern bool Dflag, inodeflag, devflag, Rflag, duflag, hflag, siflag; -extern bool noindent, force_color, xdev, nolinks, flimit, metafirst, noreport; +extern bool noindent, force_color, xdev, nolinks, metafirst, noreport; extern char *host, *sp, *title; extern const char *charset; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tree-2.0.2/info.c new/tree-2.0.3/info.c --- old/tree-2.0.2/info.c 2022-01-03 20:09:54.000000000 +0100 +++ new/tree-2.0.3/info.c 2022-06-16 15:38:21.000000000 +0200 @@ -1,6 +1,5 @@ /* $Copyright: $ * Copyright (c) 1996 - 2022 by Steve Baker ([email protected]) - * All Rights reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tree-2.0.2/json.c new/tree-2.0.3/json.c --- old/tree-2.0.2/json.c 2022-01-03 20:11:03.000000000 +0100 +++ new/tree-2.0.3/json.c 2022-08-26 21:50:52.000000000 +0200 @@ -1,6 +1,5 @@ /* $Copyright: $ * Copyright (c) 1996 - 2022 by Steve Baker ([email protected]) - * All Rights reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,7 +19,7 @@ extern bool dflag, lflag, pflag, sflag, Fflag, aflag, fflag, uflag, gflag; extern bool Dflag, inodeflag, devflag, Rflag, cflag, hflag, siflag, duflag; -extern bool noindent, force_color, xdev, nolinks, flimit, noreport; +extern bool noindent, force_color, xdev, nolinks, noreport; extern const int ifmt[]; extern const char fmt[], *ftype[]; @@ -133,7 +132,7 @@ int json_printfile(char *dirname, char *filename, struct _info *file, int descend) { - fprintf(outfile, ",\"name\":\""); + fprintf(outfile, "\"name\":\""); json_encode(outfile, filename); fputc('"',outfile); @@ -153,6 +152,7 @@ } if (file) json_fillinfo(file); + if (file && file->err) fprintf(outfile, ",\"error\": \"%s\"", file->err); if (!descend) fputc('}',outfile); else fprintf(outfile, ",\"contents\":["); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tree-2.0.2/list.c new/tree-2.0.3/list.c --- old/tree-2.0.2/list.c 2022-02-16 22:07:58.000000000 +0100 +++ new/tree-2.0.3/list.c 2022-08-26 21:13:01.000000000 +0200 @@ -1,6 +1,5 @@ /* $Copyright: $ * Copyright (c) 1996 - 2022 by Steve Baker ([email protected]) - * All Rights reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,12 +19,12 @@ extern bool dflag, lflag, pflag, sflag, Fflag, aflag, fflag, uflag, gflag; extern bool Dflag, Hflag, inodeflag, devflag, Rflag, duflag, pruneflag, metafirst; -extern bool hflag, siflag, noreport, noindent, force_color, xdev, nolinks, flimit; +extern bool Jflag, hflag, siflag, noreport, noindent, force_color, xdev, nolinks; extern struct _info **(*getfulltree)(char *d, u_long lev, dev_t dev, off_t *size, char **err); extern int (*topsort)(); extern FILE *outfile; -extern int Level, *dirs, maxdirs, errors; +extern int flimit, Level, *dirs, maxdirs, errors; extern int htmldirlen; extern bool colorize, linktargetcolor; @@ -93,7 +92,7 @@ lc.printinfo(dirname[i], info, 0); } else info = NULL; - needsclosed = lc.printfile(NULL, dirname[i], info, dir != NULL); + needsclosed = lc.printfile(NULL, dirname[i], info, (dir != NULL) || (!dir && n)); if (!dir && n) { lc.error("error opening dir"); @@ -107,10 +106,13 @@ } else { lc.newline(info, 0, 0, 0); if (dir) { - tot = listdir(dirname[i], dir, 1, 0, needfulltree); - free_dir(dir); + tot = listdir(dirname[i], dir, 1, st.st_dev, needfulltree); } else tot = (struct totals){0, 0}; } + if (dir) { + free_dir(dir); + dir = NULL; + } if (needsclosed) lc.close(info, 0, dirname[i+1] != NULL); if (duflag) tot.size = info->size; @@ -130,7 +132,7 @@ struct totals tot = {0}, subtotal; struct ignorefile *ig = NULL; struct infofile *inf = NULL; - struct _info **subdir; + struct _info **subdir = NULL; int descend, htmldescend = 0, found, n, dirlen = strlen(dirname), pathlen = dirlen + 257; int needsclosed; char *path, *newpath, *filename, *err = NULL; @@ -221,7 +223,7 @@ } } else tot.files++; - needsclosed = lc.printfile(dirname, filename, *dir, descend + htmldescend); + needsclosed = lc.printfile(dirname, filename, *dir, descend + htmldescend + (Jflag && errors)); if (err) lc.error(err); if (descend) { @@ -231,9 +233,12 @@ tot.dirs += subtotal.dirs; tot.files += subtotal.files; tot.size += subtotal.size; - free_dir(subdir); } else if (!needsclosed) lc.newline(*dir, lev, 0, *(dir+1)!=NULL); + if (subdir) { + free_dir(subdir); + subdir = NULL; + } if (needsclosed) lc.close(*dir, descend? lev : -1, *(dir+1)!=NULL); if (*(dir+1) && !*(dir+2)) dirs[lev] = 2; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tree-2.0.2/tree.c new/tree-2.0.3/tree.c --- old/tree-2.0.2/tree.c 2022-02-15 03:15:04.000000000 +0100 +++ new/tree-2.0.3/tree.c 2022-07-20 15:17:20.000000000 +0200 @@ -1,6 +1,5 @@ /* $Copyright: $ * Copyright (c) 1996 - 2022 by Steve Baker ([email protected]) - * All Rights reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,8 +18,8 @@ #include "tree.h" -char *version ="$Version: $ tree v2.0.2 (c) 1996 - 2022 by Steve Baker, Thomas Moore, Francesc Rocher, Florian Sesser, Kyosuke Tokoro $"; -char *hversion="\t\t tree v2.0.2 %s 1996 - 2022 by Steve Baker and Thomas Moore <br>\n" +char *version ="$Version: $ tree v2.0.3 (c) 1996 - 2022 by Steve Baker, Thomas Moore, Francesc Rocher, Florian Sesser, Kyosuke Tokoro $"; +char *hversion="\t\t tree v2.0.3 %s 1996 - 2022 by Steve Baker and Thomas Moore <br>\n" "\t\t HTML output hacked and copyleft %s 1998 by Francesc Rocher <br>\n" "\t\t JSON output hacked and copyleft %s 2014 by Florian Sesser <br>\n" "\t\t Charsets / OS/2 support %s 2001 by Kyosuke Tokoro\n"; @@ -29,9 +28,10 @@ bool dflag, lflag, pflag, sflag, Fflag, aflag, fflag, uflag, gflag; bool qflag, Nflag, Qflag, Dflag, inodeflag, devflag, hflag, Rflag; bool Hflag, siflag, cflag, Xflag, Jflag, duflag, pruneflag; -bool noindent, force_color, nocolor, xdev, noreport, nolinks, flimit; +bool noindent, force_color, nocolor, xdev, noreport, nolinks; bool ignorecase, matchdirs, fromfile, metafirst, gitignore, showinfo; bool reverse; +int flimit; struct listingcalls lc; @@ -610,6 +610,7 @@ " --ignore-case Ignore case when pattern matching.\n" " --matchdirs Include directory names in -P pattern matching.\n" " --metafirst Print meta-data at the beginning of each line.\n" + " --prune Prune empty directories from the output.\n" " --info Print information about files found in .info files.\n" " --noreport Turn off file/directory count at end of tree listing.\n" " --charset X Use charset X for terminal/HTML and indentation line output.\n" @@ -625,6 +626,7 @@ " -s Print the size in bytes of each file.\n" " -h Print the size in a more human readable way.\n" " --si Like -h, but use in SI units (powers of 1000).\n" + " --du Compute size of directories by their contents.\n" " -D Print the date of last modification or (-c) status change.\n" " --timefmt <f> Print and format time according to the format <f>.\n" " -F Appends '/', '=', '*', '@', '|' or '>' as per ls -F.\n" @@ -1061,7 +1063,7 @@ void free_dir(struct _info **d) { int i; - + for(i=0;d[i];i++) { free(d[i]->name); if (d[i]->lnk) free(d[i]->lnk); @@ -1121,6 +1123,7 @@ return match; } +// printf("> buf[%s], pat[%s]\n", buf, pat); while(*pat && match) { switch(*pat) { case '[': @@ -1151,7 +1154,11 @@ break; case '*': pat++; - if(!*pat) return 1; + if(!*pat) { + int f = (strchr(buf, '/') == NULL); +// printf("end *: buf = '%s', f = %d\n", buf, f); + return f; + } match = 0; /* "Support" ** for .gitignore support, mostly the same as *: */ if (*pat == '*') { @@ -1165,10 +1172,13 @@ while(*buf && *buf != '/') buf++; } } else { - while(*buf && !(match = patmatch(buf++, pat, isdir))); +// printf("* buf[%s], pat[%s]\n", buf, pat); + while(*buf && !(match = patmatch(buf++, pat, isdir))) + if (*buf == '/') break; // if (!*buf && !match) match = patmatch(buf, pat, isdir); } - if (!*buf && !match) match = patmatch(buf, pat, isdir); +// printf("*|%d buf[%s], pat[%s]\n", match, buf, pat); + if (!match && (!*buf || *buf == '/')) match = patmatch(buf, pat, isdir); return match; case '?': if(!*buf) return 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tree-2.0.2/tree.h new/tree-2.0.3/tree.h --- old/tree-2.0.2/tree.h 2022-02-15 00:47:18.000000000 +0100 +++ new/tree-2.0.3/tree.h 2022-06-16 15:38:36.000000000 +0200 @@ -1,6 +1,5 @@ /* $Copyright: $ * Copyright (c) 1996 - 2022 by Steve Baker ([email protected]) - * All Rights reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -163,6 +162,7 @@ /* filter.c */ struct pattern { char *pattern; + int relative; struct pattern *next; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tree-2.0.2/unix.c new/tree-2.0.3/unix.c --- old/tree-2.0.2/unix.c 2022-01-03 20:11:45.000000000 +0100 +++ new/tree-2.0.3/unix.c 2022-06-16 15:38:39.000000000 +0200 @@ -1,6 +1,5 @@ /* $Copyright: $ * Copyright (c) 1996 - 2022 by Steve Baker ([email protected]) - * All Rights reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tree-2.0.2/xml.c new/tree-2.0.3/xml.c --- old/tree-2.0.2/xml.c 2022-01-03 20:11:33.000000000 +0100 +++ new/tree-2.0.3/xml.c 2022-08-26 21:48:00.000000000 +0200 @@ -1,6 +1,5 @@ /* $Copyright: $ * Copyright (c) 1996 - 2022 by Steve Baker ([email protected]) - * All Rights reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,7 +19,7 @@ extern bool dflag, lflag, pflag, sflag, Fflag, aflag, fflag, uflag, gflag; extern bool Dflag, inodeflag, devflag, Rflag, cflag, duflag, siflag; -extern bool noindent, force_color, xdev, nolinks, flimit, noreport; +extern bool noindent, force_color, xdev, nolinks, noreport; extern const char *charset; extern const int ifmt[]; @@ -117,6 +116,16 @@ int xml_printfile(char *dirname, char *filename, struct _info *file, int descend) { + int t, mt; + + if (file) { + if (file->lnk) mt = file->mode & S_IFMT; + else mt = file->mode & S_IFMT; + } else mt = 0; + for(t=0;ifmt[t];t++) + if (ifmt[t] == mt) break; + fprintf(outfile,"<%s", ftype[t]); + fprintf(outfile, " name=\""); html_encode(outfile, filename); fputc('"',outfile); @@ -156,7 +165,7 @@ void xml_close(struct _info *file, int level, int needcomma) { if (!noindent && level >= 0) xml_indent(level-1); - fprintf(outfile,"</%s>%s", file->tag, noindent? "" : "\n"); + fprintf(outfile,"</%s>%s", file? file->tag : "unknown", noindent? "" : "\n"); }
