Compare commits

..

No commits in common. "rawhide" and "f20" have entirely different histories.
rawhide ... f20

5 changed files with 21 additions and 261 deletions

View File

@ -1,13 +0,0 @@
diff --git a/src/basedir.c b/src/basedir.c
index 68ab879..1a2a8c4 100644
--- a/src/basedir.c
+++ b/src/basedir.c
@@ -574,7 +574,7 @@ static char * xdgGetRelativeHome(const char *envname, const char *relativefallba
unsigned int homelen;
if (!(home = xdgGetEnv("HOME")))
return NULL;
- if (!(relhome = (char*)malloc((homelen = strlen(home))+fallbacklength))) return NULL;
+ if (!(relhome = (char*)malloc((homelen = strlen(home))+fallbacklength+1))) return NULL;
memcpy(relhome, home, homelen);
memcpy(relhome+homelen, relativefallback, fallbacklength+1);
}

View File

@ -1,145 +0,0 @@
--- a/src/basedir.c 2019-04-01 17:11:52.293770606 +0200
+++ b/src/basedir.c 2019-04-01 14:03:23.465154736 +0200
@@ -142,26 +142,22 @@
/** Free all data in the cache and set pointers to null. */
static void xdgFreeData(xdgCachedData *cache)
{
- if (cache->dataHome);
- {
+ if (cache->dataHome) {
/* the first element of the directory lists is usually the home directory */
if (cache->searchableDataDirectories && cache->searchableDataDirectories[0] != cache->dataHome)
free(cache->dataHome);
cache->dataHome = 0;
}
- if (cache->configHome);
- {
+ if (cache->configHome) {
if (cache->searchableConfigDirectories && cache->searchableConfigDirectories[0] != cache->configHome)
free(cache->configHome);
cache->configHome = 0;
}
- if (cache->cacheHome)
- {
+ if (cache->cacheHome) {
free(cache->cacheHome);
cache->cacheHome = 0;
}
- if (cache->runtimeDirectory)
- {
+ if (cache->runtimeDirectory) {
free(cache->runtimeDirectory);
cache->runtimeDirectory = 0;
}
@@ -327,8 +323,12 @@
if (cache->dataHome && cache->configHome && cache->cacheHome) return TRUE;
- if (!(homeenv = xdgGetEnv("HOME")))
- return FALSE;
+ if (!(homeenv = xdgGetEnv("HOME"))) {
+ cache->dataHome = NULL;
+ cache->configHome = NULL;
+ cache->cacheHome = NULL;
+ return TRUE;
+ }
/* Allocate maximum needed for any of the 3 default values */
if (!(value = (char*)malloc((homelen = strlen(homeenv))+extralen))) return FALSE;
@@ -614,8 +614,8 @@
else
{
char *datahome = (char*)xdgDataHome(NULL);
- char **datadirs = 0;
- if (datahome && !(datadirs = xdgGetDirectoryLists("XDG_DATA_DIRS", datahome, DefaultDataDirectoriesList)))
+ char **datadirs = xdgGetDirectoryLists("XDG_DATA_DIRS", datahome, DefaultDataDirectoriesList);
+ if (datahome && !datadirs)
free(datahome);
return (const char * const *)datadirs;
}
@@ -634,8 +634,8 @@
else
{
char *confighome = (char*)xdgConfigHome(NULL);
- char **configdirs = 0;
- if (confighome && !(configdirs = xdgGetDirectoryLists("XDG_CONFIG_DIRS", confighome, DefaultConfigDirectoriesList)))
+ char **configdirs = xdgGetDirectoryLists("XDG_CONFIG_DIRS", confighome, DefaultConfigDirectoriesList);
+ if (confighome && !configdirs)
free(confighome);
return (const char * const *)configdirs;
}
--- a/tests/testdump.c 2012-01-22 02:29:11.000000000 +0100
+++ b/tests/testdump.c 2019-04-01 14:03:23.463154767 +0200
@@ -24,27 +24,56 @@
#include <basedir.h>
#include <stdio.h>
+#include <stdlib.h>
+
+static void print_item_list(const char * const * item_list, int do_free)
+{
+ const char * const * item;
+ for (item = item_list; *item; item++) {
+ printf("%s%c", *item, (item[1] ? ':' : '\n'));
+ if (do_free) free((void *)*item);
+ }
+ if (do_free) free((void *)item_list);
+}
+
+static void do_test(xdgHandle *handle) {
+ int do_free = (handle == NULL);
+
+ char *dataHome = xdgDataHome(handle);
+ printf("${XDG_DATA_HOME:-$HOME/.local/share}=%s\n", dataHome);
+ if (do_free) free(dataHome);
+
+ char *configHome = xdgConfigHome(handle);
+ printf("${XDG_CONFIG_HOME:-$HOME/.config}=%s\n", configHome);
+ if (do_free) free(configHome);
+
+ printf("${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/}=");
+ print_item_list(xdgDataDirectories(handle), do_free);
+
+ printf("${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/}=");
+ print_item_list(xdgSearchableDataDirectories(handle), do_free);
+
+ printf("${XDG_CONFIG_DIRS:-/etc/xdg}=");
+ print_item_list(xdgConfigDirectories(handle), do_free);
+
+ printf("${XDG_CONFIG_HOME:-$HOME/.config}:${XDG_CONFIG_DIRS:-/etc/xdg}=");
+ print_item_list(xdgSearchableConfigDirectories(handle), do_free);
+
+ char *cacheHome = xdgCacheHome(handle);
+ printf("${XDG_CACHE_HOME:-$HOME/.cache}=%s\n", cacheHome);
+ if (do_free) free(cacheHome);
+}
int main(int argc, char* argv[])
{
- const char * const * item;
xdgHandle handle;
+
+ printf("UNCACHED\n");
+ do_test(0);
if (!xdgInitHandle(&handle)) return 1;
- printf("${XDG_DATA_HOME:-$HOME/.local/share}=%s\n", xdgDataHome(&handle));
- printf("${XDG_CONFIG_HOME:-$HOME/.config}=%s\n", xdgConfigHome(&handle));
- printf("${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/}=");
- for (item = xdgDataDirectories(&handle); *item; item++)
- printf("%s%c", *item, (item[1] ? ':' : '\n'));
- printf("${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/}=");
- for (item = xdgSearchableDataDirectories(&handle); *item; item++)
- printf("%s%c", *item, (item[1] ? ':' : '\n'));
- printf("${XDG_CONFIG_DIRS:-/etc/xdg}=");
- for (item = xdgConfigDirectories(&handle); *item; item++)
- printf("%s%c", *item, (item[1] ? ':' : '\n'));
- printf("${XDG_CONFIG_HOME:-$HOME/.config}:${XDG_CONFIG_DIRS:-/etc/xdg}=");
- for (item = xdgSearchableConfigDirectories(&handle); *item; item++)
- printf("%s%c", *item, (item[1] ? ':' : '\n'));
- printf("${XDG_CACHE_HOME:-$HOME/.cache}=%s\n", xdgCacheHome(&handle));
+ printf("CACHED\n");
+ do_test(&handle);
xdgWipeHandle(&handle);
+ printf("DONE\n");
return 0;
}

View File

@ -1,11 +0,0 @@
--- a/tests/query-harness.sh
+++ b/tests/query-harness.sh
@@ -10,7 +10,7 @@ fi
testquery="${top_builddir}/tests/testquery"
if [ -n "$USE_VALGRIND" ] && (type valgrind 1>/dev/null)
then
- output="`valgrind -q --error-exitcode=1 "$testquery" $arguments`"
+ output="`libtool --mode=execute valgrind -q --error-exitcode=1 "$testquery" $arguments`"
else
output="`"$testquery" $arguments`"
fi

View File

@ -1,16 +1,15 @@
Name: libxdg-basedir
Version: 1.2.0
Release: 28%{?dist}
Release: 5%{?dist}
Summary: Implementation of the XDG Base Directory Specifications
Group: System Environment/Libraries
License: MIT
URL: https://github.com/devnev/libxdg-basedir
Source0: https://github.com/devnev/%{name}/archive/%{name}-%{version}.tar.gz
URL: http://n.ethz.ch/student/nevillm/download/libxdg-basedir
Source0: http://n.ethz.ch/student/nevillm/download/libxdg-basedir/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Patch0: libxdg-basedir-leak.patch
Patch1: libxdg-basedir-valgrind-libtool.patch
Patch2: libxdg-basedir-basedir-bounds-error.patch
Patch3: libxdg-basedir-home-undef.patch
BuildRequires: valgrind libtool
%description
The XDG Base Directory Specification defines where should user files
@ -23,6 +22,7 @@ to the specification and provides a few higher-level functions.
%package devel
Summary: Development files for %{name}
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: pkgconfig
@ -33,10 +33,9 @@ developing applications that use %{name}.
%package doc
Summary: Documentation files for %{name}
Group: Documentation
Requires: %{name} = %{version}-%{release}
BuildRequires: gcc
BuildRequires: doxygen
BuildRequires: make
%description doc
The %{name}-doc package contains doxygen generated files for
@ -47,9 +46,6 @@ developing applications that use %{name}.
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build
%configure --disable-static
@ -63,100 +59,33 @@ make install DESTDIR="$RPM_BUILD_ROOT"
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
%check
make check USE_VALGRIND=1
#env -i make check USE_VALGRIND=1
# Check that we get NULL for all things rooted in ENV{HOME} when running
# with HOME unset
env -i ./tests/testdump | grep null > grep.NULL
env -i ./tests/testdump | grep HOME | grep -v DIRS > grep.HOME
diff -u grep.NULL grep.HOME
%clean
rm -rf $RPM_BUILD_ROOT
%ldconfig_scriptlets
#%check
#make check
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%defattr(-,root,root,-)
%{_libdir}/*.so.*
%files devel
%defattr(-,root,root,-)
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/pkgconfig/%{name}.pc
%files doc
%defattr(-,root,root,-)
%doc doc/html/
%changelog
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.0-28
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.0-27
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.0-26
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.0-25
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.0-24
- Second attempt - Rebuilt for
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.0-23
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.0-22
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.0-21
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Mon Apr 01 2019 Gwyn Ciesla <gwync@protonmail.com> - 1.2.0-20
- Enhance testing.
* Mon Apr 01 2019 Gwyn Ciesla <gwync@protonmail.com> - 1.2.0-19
- Patch correction.
* Mon Apr 01 2019 Gwyn Ciesla <gwync@protonmail.com> - 1.2.0-18
- Patch to handle undefined homedir, BZ 1694706.
* Wed Feb 13 2019 Gwyn Ciesla <gwync@protonmail.com> - 1.2.0-17
- Updated valgrind patch.
* Tue Feb 12 2019 Gwyn Ciesla <gwync@protonmail.com> - 1.2.0-16
- Relocated upstream, crash patch.
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.0-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.0-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.0-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.0-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.0-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.0-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.0-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.0-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Thu Oct 31 2013 Jon Ciesla <limburgher@gmail.com> - 1.2.0-5
- Patch for memory leak, BZ 1018527.

View File

@ -1 +1 @@
SHA512 (libxdg-basedir-1.2.0.tar.gz) = b70f4fe7c155b9f9c8d9afab649ac009892b6c913fafe0b4e63b517bff35d028a43d715d8b636a2667904b74fa7b7b7666e5102b0675ca453982c3988cf1f652
027aaf1495f6ffa4b5a563b511d5d3f3 libxdg-basedir-1.2.0.tar.gz