update to the latest upstream release - 2.0.0

This commit is contained in:
Kamil Dudka 2021-12-22 10:05:27 +01:00
parent 18054831f2
commit 4d89cb915d
7 changed files with 38 additions and 218 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
/tree-1.*.*.tgz
/tree-[1-9].*.*.tgz

View File

@ -1 +1 @@
SHA512 (tree-1.8.0.tgz) = 3f657a6278ec5eab2fccab39dfd69bf9376811189a368b5e3213dc900b90a4e7a4961fc58eb80ad2efd5b40d2fbd0146ec59f30fe0bba576f93519214f240695
SHA512 (tree-2.0.0.tgz) = cfb069707b3434ccffbe0e08aaddddc52b33256c4d580ab6f6685518d9b16d288c33c7eec58c152d44fbc9e3f5b6e5759f2a0af8e411c44993d1d0a2a91b9dd2

View File

@ -1,3 +1,12 @@
From 061d7800ccad941b6a2f4cb230412097872fa457 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Wed, 22 Dec 2021 10:10:38 +0100
Subject: [PATCH] Resolves: #948991 - document --du and --prune options
... in help output
Sent upstream via email 20210920
---
tree.c | 2 ++
1 file changed, 2 insertions(+)
@ -5,12 +14,15 @@ diff --git a/tree.c b/tree.c
index 5b56afe..3b4a263 100644
--- a/tree.c
+++ b/tree.c
@@ -653,6 +653,8 @@ void usage(int n)
@@ -610,6 +610,8 @@ void usage(int n)
" --charset X Use charset X for terminal/HTML and indentation line output.\n"
" --filelimit # Do not descend dirs with more than # files in them.\n"
" --timefmt <f> Print and format time according to the format <f>.\n"
" -o filename Output to file instead of stdout.\n"
+ " --du Print directory sizes.\n"
+ " --prune Prune empty directories from the output.\n"
" ------- File options -------\n"
" -q Print non-printable characters as '?'.\n"
" -N Print non-printable characters as is.\n"
--
2.31.1

View File

@ -1,16 +0,0 @@
color.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/color.c b/color.c
index 67dedbe..bbcc9df 100644
--- a/color.c
+++ b/color.c
@@ -191,7 +191,7 @@ void parse_dir_colors()
if (!norm_flgs) norm_flgs = scopy("00");
if (!endcode) {
- sprintf(buf,"%s%s%s",leftcode,norm_flgs,rightcode);
+ sprintf(buf,"%s0%s",leftcode,rightcode);
endcode = scopy(buf);
}

View File

@ -1,7 +1,7 @@
Summary: File system tree viewer
Name: tree-pkg
Version: 1.8.0
Release: 9%{?dist}
Version: 2.0.0
Release: 1%{?dist}
# The entire source code is GPLv2+ except strverscmp.c which is LGPLv2+
License: GPLv2+ and LGPLv2+
@ -16,18 +16,10 @@ BuildRequires: make
# Sent upstream via email 20210920
Patch0: tree-license-fsf-addr.patch
# Preserve timestamp on man page.
# Sent upstream via email 20210920
Patch2: tree-preserve-timestamps.patch
# Document --du and --prune options in help output (bug #948991).
# Sent upstream via email 20210920
Patch4: tree-args.patch
# Use correct default for dircolors "ec" field (bug #812934).
# Sent upstream via email 20210920
Patch6: tree-dircolors-ec.patch
# Keep file size field length constant regardless of whether SI units
# are used (bug #997937).
# Sent upstream via email 20210920
@ -57,13 +49,11 @@ sed -e 's/LINUX/__linux__/' -i tree.c
%build
%set_build_flags
%make_build CFLAGS="$RPM_OPT_FLAGS $(getconf LFS_CFLAGS)"
%make_build CFLAGS="$RPM_OPT_FLAGS $(getconf LFS_CFLAGS)" LDFLAGS="$LDFLAGS"
%install
mkdir -p $RPM_BUILD_ROOT%{_bindir}
%make_install BINDIR=$RPM_BUILD_ROOT%{_bindir} \
MANDIR=$RPM_BUILD_ROOT%{_mandir}/man1
MANDIR=$RPM_BUILD_ROOT%{_mandir}
chmod -x $RPM_BUILD_ROOT%{_mandir}/man1/tree.1
@ -74,6 +64,9 @@ chmod -x $RPM_BUILD_ROOT%{_mandir}/man1/tree.1
%doc README
%changelog
* Wed Dec 22 2021 Kamil Dudka <kdudka@redhat.com> - 2.0.0-1
- update to the latest upstream release
* Fri Sep 17 2021 Kamil Dudka <kdudka@redhat.com> - 1.8.0-9
- reflect review comments from Fedora Review (#2001467)

View File

@ -1,19 +0,0 @@
Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 842281e..ee7fbe6 100644
--- a/Makefile
+++ b/Makefile
@@ -112,9 +112,9 @@ install: tree
install -d $(BINDIR)
install -d $(MANDIR)
if [ -e $(TREE_DEST) ]; then \
- install $(TREE_DEST) $(BINDIR)/$(TREE_DEST); \
+ install -p $(TREE_DEST) $(BINDIR)/$(TREE_DEST); \
fi
- install doc/$(MAN) $(MANDIR)/$(MAN)
+ install -p doc/$(MAN) $(MANDIR)/$(MAN)
distclean:
if [ -f tree.o ]; then rm *.o; fi

View File

@ -4,98 +4,28 @@ Date: Tue, 6 Nov 2018 16:31:32 +0100
Subject: [PATCH] tree: fix programming mistakes detected by static analysis
---
html.c | 5 +++--
json.c | 11 +++++------
list.c | 2 +-
tree.c | 2 +-
unix.c | 5 +++--
xml.c | 11 +++++------
5 files changed, 17 insertions(+), 17 deletions(-)
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/html.c b/html.c
index 75e2ed1..35fb525 100644
--- a/html.c
+++ b/html.c
@@ -221,7 +221,7 @@ off_t html_listdir(char *d, int *dt, int *ft, u_long lev, dev_t dev)
if (*(*dir)->lnk == '/')
listdir((*dir)->lnk,dt,ft,lev+1,dev);
else {
- if (strlen(d)+strlen((*dir)->lnk)+2 > pathsize) path=xrealloc(path,pathsize=(strlen(d)+strlen((*dir)->name)+1024));
+ if (strlen(d)+strlen((*dir)->lnk)+2 > pathsize) path=xrealloc(path,pathsize=(strlen(d)+strlen((*dir)->lnk)+1024));
if (fflag && !strcmp(d,"/")) sprintf(path,"%s%s",d,(*dir)->lnk);
else sprintf(path,"%s/%s",d,(*dir)->lnk);
listdir(path,dt,ft,lev+1,dev);
@@ -254,7 +254,7 @@ off_t html_rlistdir(char *d, int *dt, int *ft, u_long lev, dev_t dev)
{
struct _info **dir;
off_t size = 0;
diff --git a/list.c b/list.c
index 36cfbe5..c490dec 100644
--- a/list.c
+++ b/list.c
@@ -43,7 +43,7 @@ void emit_tree(char **dirname, bool needfulltree)
struct ignorefile *ig = NULL;
struct infofile *inf = NULL;
struct _info **dir = NULL, *info = NULL;
- char *err;
+ char *err = NULL;
int i, j, n, needsclosed;
struct stat st;
dir = getfulltree(d, lev, dev, &size, &err);
@@ -262,6 +262,7 @@ off_t html_rlistdir(char *d, int *dt, int *ft, u_long lev, dev_t dev)
htmlr_listdir(dir, d, dt, ft, lev);
+ free(err);
return size;
}
diff --git a/json.c b/json.c
index 4b15e0d..8c71324 100644
--- a/json.c
+++ b/json.c
@@ -98,8 +98,7 @@ off_t json_listdir(char *d, int *dt, int *ft, u_long lev, dev_t dev)
while(*dir) {
if (!noindent) json_indent(lev);
- if ((*dir)->lnk) mt = (*dir)->mode & S_IFMT;
- else mt = (*dir)->mode & S_IFMT;
+ mt = (*dir)->mode & S_IFMT;
for(t=0;ifmt[t];t++)
if (ifmt[t] == mt) break;
fprintf(outfile,"{\"type\":\"%s\"", ftype[t]);
@@ -141,7 +140,7 @@ off_t json_listdir(char *d, int *dt, int *ft, u_long lev, dev_t dev)
if (*(*dir)->lnk == '/')
listdir((*dir)->lnk,dt,ft,lev+1,dev);
else {
- if (strlen(d)+strlen((*dir)->lnk)+2 > pathsize) path=xrealloc(path,pathsize=(strlen(d)+strlen((*dir)->name)+1024));
+ if (strlen(d)+strlen((*dir)->lnk)+2 > pathsize) path=xrealloc(path,pathsize=(strlen(d)+strlen((*dir)->lnk)+1024));
if (fflag && !strcmp(d,"/")) sprintf(path,"%s%s",d,(*dir)->lnk);
else sprintf(path,"%s/%s",d,(*dir)->lnk);
listdir(path,dt,ft,lev+1,dev);
@@ -181,7 +180,7 @@ off_t json_rlistdir(char *d, int *dt, int *ft, u_long lev, dev_t dev)
{
struct _info **dir;
off_t size = 0;
- char *err;
+ char *err = NULL;
dir = getfulltree(d, lev, dev, &size, &err);
@@ -189,6 +188,7 @@ off_t json_rlistdir(char *d, int *dt, int *ft, u_long lev, dev_t dev)
jsonr_listdir(dir, d, dt, ft, lev);
+ free(err);
return size;
}
@@ -211,8 +211,7 @@ void jsonr_listdir(struct _info **dir, char *d, int *dt, int *ft, u_long lev)
while(*dir) {
if (!noindent) json_indent(lev);
- if ((*dir)->lnk) mt = (*dir)->mode & S_IFMT;
- else mt = (*dir)->mode & S_IFMT;
+ mt = (*dir)->mode & S_IFMT;
for(t=0;ifmt[t];t++)
if (ifmt[t] == mt) break;
fprintf(outfile,"{\"type\":\"%s\"", ftype[t]);
diff --git a/tree.c b/tree.c
index 03140fe..73dd101 100644
index 0d51281..94aed2c 100644
--- a/tree.c
+++ b/tree.c
@@ -882,7 +882,7 @@ struct _info **unix_getfulltree(char *d, u_long lev, dev_t dev, off_t *size, cha
@@ -917,7 +917,7 @@ struct _info **unix_getfulltree(char *d, u_long lev, dev_t dev, off_t *size, cha
if (*(*dir)->lnk == '/')
(*dir)->child = unix_getfulltree((*dir)->lnk,lev+1,dev,&((*dir)->size),&((*dir)->err));
else {
@ -104,86 +34,6 @@ index 03140fe..73dd101 100644
if (fflag && !strcmp(d,"/")) sprintf(path,"%s%s",d,(*dir)->lnk);
else sprintf(path,"%s/%s",d,(*dir)->lnk);
(*dir)->child = unix_getfulltree(path,lev+1,dev,&((*dir)->size),&((*dir)->err));
diff --git a/unix.c b/unix.c
index ca5f76f..9476307 100644
--- a/unix.c
+++ b/unix.c
@@ -129,7 +129,7 @@ off_t unix_listdir(char *d, int *dt, int *ft, u_long lev, dev_t dev)
if (*(*dir)->lnk == '/')
listdir((*dir)->lnk,dt,ft,lev+1,dev);
else {
- if (strlen(d)+strlen((*dir)->lnk)+2 > pathsize) path=xrealloc(path,pathsize=(strlen(d)+strlen((*dir)->name)+1024));
+ if (strlen(d)+strlen((*dir)->lnk)+2 > pathsize) path=xrealloc(path,pathsize=(strlen(d)+strlen((*dir)->lnk)+1024));
if (fflag && !strcmp(d,"/")) sprintf(path,"%s%s",d,(*dir)->lnk);
else sprintf(path,"%s/%s",d,(*dir)->lnk);
listdir(path,dt,ft,lev+1,dev);
@@ -162,7 +162,7 @@ off_t unix_rlistdir(char *d, int *dt, int *ft, u_long lev, dev_t dev)
{
struct _info **dir;
off_t size = 0;
- char *err;
+ char *err = NULL;
dir = getfulltree(d, lev, dev, &size, &err);
@@ -170,6 +170,7 @@ off_t unix_rlistdir(char *d, int *dt, int *ft, u_long lev, dev_t dev)
r_listdir(dir, d, dt, ft, lev);
+ free(err);
return size;
}
diff --git a/xml.c b/xml.c
index 32f3c0c..512eed7 100644
--- a/xml.c
+++ b/xml.c
@@ -106,8 +106,7 @@ off_t xml_listdir(char *d, int *dt, int *ft, u_long lev, dev_t dev)
while(*dir) {
if (!noindent) xml_indent(lev);
- if ((*dir)->lnk) mt = (*dir)->mode & S_IFMT;
- else mt = (*dir)->mode & S_IFMT;
+ mt = (*dir)->mode & S_IFMT;
for(t=0;ifmt[t];t++)
if (ifmt[t] == mt) break;
fprintf(outfile,"<%s", ftype[t]);
@@ -145,7 +144,7 @@ off_t xml_listdir(char *d, int *dt, int *ft, u_long lev, dev_t dev)
if (*(*dir)->lnk == '/')
listdir((*dir)->lnk,dt,ft,lev+1,dev);
else {
- if (strlen(d)+strlen((*dir)->lnk)+2 > pathsize) path=xrealloc(path,pathsize=(strlen(d)+strlen((*dir)->name)+1024));
+ if (strlen(d)+strlen((*dir)->lnk)+2 > pathsize) path=xrealloc(path,pathsize=(strlen(d)+strlen((*dir)->lnk)+1024));
if (fflag && !strcmp(d,"/")) sprintf(path,"%s%s",d,(*dir)->lnk);
else sprintf(path,"%s/%s",d,(*dir)->lnk);
listdir(path,dt,ft,lev+1,dev);
@@ -181,7 +180,7 @@ off_t xml_rlistdir(char *d, int *dt, int *ft, u_long lev, dev_t dev)
{
struct _info **dir;
off_t size = 0;
- char *err;
+ char *err = NULL;
dir = getfulltree(d, lev, dev, &size, &err);
@@ -189,6 +188,7 @@ off_t xml_rlistdir(char *d, int *dt, int *ft, u_long lev, dev_t dev)
xmlr_listdir(dir, d, dt, ft, lev);
+ free(err);
return size;
}
@@ -211,8 +211,7 @@ void xmlr_listdir(struct _info **dir, char *d, int *dt, int *ft, u_long lev)
while(*dir) {
if (!noindent) xml_indent(lev);
- if ((*dir)->lnk) mt = (*dir)->mode & S_IFMT;
- else mt = (*dir)->mode & S_IFMT;
+ mt = (*dir)->mode & S_IFMT;
for(t=0;ifmt[t];t++)
if (ifmt[t] == mt) break;
fprintf(outfile,"<%s", ftype[t]);
--
2.17.2