From 45eb77c6dbe3d34a21fb481b88063990729fd0f3 Mon Sep 17 00:00:00 2001 From: Jan Zeleny Date: Fri, 25 May 2012 16:46:49 +0200 Subject: [PATCH] Rebased to 0.3.0beta 1 (0.2.91) Changelog available at https://fedorahosted.org/sssd/wiki/Releases/DingNotes-0.2.91 --- .gitignore | 1 + ...ndle-off-by-one-error-in-path_concat.patch | 62 ------- 0002-path_utils-Handle-in-path_concat.patch | 62 ------- ...concat-should-return-empty-string-on.patch | 153 ------------------ ding-libs.spec | 61 +++++-- sources | 2 +- 6 files changed, 50 insertions(+), 291 deletions(-) delete mode 100644 0001-path_utils-handle-off-by-one-error-in-path_concat.patch delete mode 100644 0002-path_utils-Handle-in-path_concat.patch delete mode 100644 0003-path_utils-path_concat-should-return-empty-string-on.patch diff --git a/.gitignore b/.gitignore index 9634b65..9c366d9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /ding-libs-0.1.2.tar.gz /ding-libs-0.1.3.tar.gz +/ding-libs-0.2.91.tar.gz diff --git a/0001-path_utils-handle-off-by-one-error-in-path_concat.patch b/0001-path_utils-handle-off-by-one-error-in-path_concat.patch deleted file mode 100644 index 7ba4508..0000000 --- a/0001-path_utils-handle-off-by-one-error-in-path_concat.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 6bc68b4dfeaf3320adc58e52dea5530ce2ce8a6c Mon Sep 17 00:00:00 2001 -From: Stephen Gallagher -Date: Tue, 6 Mar 2012 11:05:53 -0500 -Subject: [PATCH 1/2] path_utils: handle off-by-one error in path_concat() - -https://fedorahosted.org/sssd/ticket/1230 ---- - path_utils/path_utils.c | 2 +- - path_utils/path_utils_ut.c | 18 ++++++++++++++---- - 2 files changed, 15 insertions(+), 5 deletions(-) - -diff --git a/path_utils/path_utils.c b/path_utils/path_utils.c -index 97c845c70f41e071c0d9524172ad3b0b33a84c3b..360d49943436681970691cc829c8039f3a0e8a5f 100644 ---- a/path_utils/path_utils.c -+++ b/path_utils/path_utils.c -@@ -210,7 +210,7 @@ int path_concat(char *path, size_t path_size, const char *head, const char *tail - for (p = tail; *p && *p == '/'; p++); /* skip any leading slashes in tail */ - if (dst > path) - if (dst < dst_end) *dst++ = '/'; /* insert single slash between head & tail */ -- for (src = p; *src && dst <= dst_end;) *dst++ = *src++; /* copy tail */ -+ for (src = p; *src && dst < dst_end;) *dst++ = *src++; /* copy tail */ - if (*src) return ENOBUFS; /* failed to copy everything */ - } - *dst = 0; -diff --git a/path_utils/path_utils_ut.c b/path_utils/path_utils_ut.c -index 044e9ea2d12e396f9f68a23bde8b11f6ac3fcc09..fbefcab1eb66b5c36a3d7a74a099f569ea764b3b 100644 ---- a/path_utils/path_utils_ut.c -+++ b/path_utils/path_utils_ut.c -@@ -241,16 +241,26 @@ END_TEST - START_TEST(test_path_concat_neg) - { - char small[3]; -- char small2[4]; -- char p2[8]; -+ char small2[5]; -+ char small3[7]; -+ char p2[9]; - - /* these two test different conditions */ -+ -+ /* Test if head is longer than the buffer */ - fail_unless(path_concat(small, 3, "/foo", "bar") == ENOBUFS); -- fail_unless(path_concat(small2, 4, "/foo", "bar") == ENOBUFS); -+ -+ /* Test if head is the same length as the buffer */ -+ fail_unless(path_concat(small2, 5, "/foo", "bar") == ENOBUFS); -+ -+ /* Test if head+tail is the longer than the buffer */ -+ fail_unless(path_concat(small3, 7, "/foo", "bar") == ENOBUFS); - - /* off-by-one */ -+ p2[8] = 1; /* Check whether we've written too far */ - fail_unless(path_concat(p2, 8, "/foo", "bar") == ENOBUFS); -- fail_unless_str_equal(p2, "/foo/bar"); -+ fail_unless(p2[8] == 1); /* This should be untouched */ -+ fail_unless_str_equal(p2, "/foo/ba"); - } - END_TEST - --- -1.7.7.6 - diff --git a/0002-path_utils-Handle-in-path_concat.patch b/0002-path_utils-Handle-in-path_concat.patch deleted file mode 100644 index f6415c5..0000000 --- a/0002-path_utils-Handle-in-path_concat.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 641d6b290b49dad364a7de5fe5af7c983482d2b7 Mon Sep 17 00:00:00 2001 -From: Stephen Gallagher -Date: Tue, 6 Mar 2012 11:34:41 -0500 -Subject: [PATCH 2/2] path_utils: Handle "/" in path_concat - ---- - path_utils/path_utils.c | 12 ++++++++++-- - path_utils/path_utils_ut.c | 9 +++++++++ - 2 files changed, 19 insertions(+), 2 deletions(-) - -diff --git a/path_utils/path_utils.c b/path_utils/path_utils.c -index 360d49943436681970691cc829c8039f3a0e8a5f..25ca4267fc0d7d9f3483646c2aef22fcdef1eb24 100644 ---- a/path_utils/path_utils.c -+++ b/path_utils/path_utils.c -@@ -202,14 +202,22 @@ int path_concat(char *path, size_t path_size, const char *head, const char *tail - - if (head && *head) { - for (p = head; *p; p++); /* walk to end of head */ -- for (p--; p >= head && *p == '/'; p--); /* skip any trailing slashes in head */ -+ for (p--; p > head && *p == '/'; p--); /* skip any trailing slashes in head */ - if ((p - head) > path_size-1) return ENOBUFS; - for (src = head; src <= p && dst < dst_end;) *dst++ = *src++; /* copy head */ - } - if (tail && *tail) { - for (p = tail; *p && *p == '/'; p++); /* skip any leading slashes in tail */ - if (dst > path) -- if (dst < dst_end) *dst++ = '/'; /* insert single slash between head & tail */ -+ /* insert single slash between head & tail -+ * Making sure not to add an extra if the -+ * preceding character is also a slash -+ * (such as the case where head was the -+ * special-case "/". -+ */ -+ if (dst < dst_end && *(dst-1) != '/') { -+ *dst++ = '/'; -+ } - for (src = p; *src && dst < dst_end;) *dst++ = *src++; /* copy tail */ - if (*src) return ENOBUFS; /* failed to copy everything */ - } -diff --git a/path_utils/path_utils_ut.c b/path_utils/path_utils_ut.c -index fbefcab1eb66b5c36a3d7a74a099f569ea764b3b..34462cfdd4a2238f878a170fba2481b31f96e33e 100644 ---- a/path_utils/path_utils_ut.c -+++ b/path_utils/path_utils_ut.c -@@ -229,6 +229,15 @@ START_TEST(test_path_concat) - fail_unless(path_concat(p, PATH_MAX, "", "foo") == SUCCESS); - fail_unless_str_equal(p, "foo"); - -+ fail_unless(path_concat(p, PATH_MAX, "/", "foo") == SUCCESS); -+ fail_unless_str_equal(p, "/foo"); -+ -+ fail_unless(path_concat(p, PATH_MAX, "/foo", "/") == SUCCESS); -+ fail_unless_str_equal(p, "/foo/"); -+ -+ fail_unless(path_concat(p, PATH_MAX, "/foo", "bar/") == SUCCESS); -+ fail_unless_str_equal(p, "/foo/bar/"); -+ - fail_unless(path_concat(p, PATH_MAX, NULL, "foo") == SUCCESS); - fail_unless_str_equal(p, "foo"); - --- -1.7.7.6 - diff --git a/0003-path_utils-path_concat-should-return-empty-string-on.patch b/0003-path_utils-path_concat-should-return-empty-string-on.patch deleted file mode 100644 index ddb5f5c..0000000 --- a/0003-path_utils-path_concat-should-return-empty-string-on.patch +++ /dev/null @@ -1,153 +0,0 @@ -From c4fdad249bf62d61856d26f97849e61351a356d5 Mon Sep 17 00:00:00 2001 -From: Stephen Gallagher -Date: Wed, 7 Mar 2012 09:29:46 -0500 -Subject: [PATCH] path_utils: path_concat should return empty string on - ENOBUFS - -Also clean up the code a bit and add more comments ---- - path_utils/path_utils.c | 48 ++++++++++++++++++++++++++++++++++--------- - path_utils/path_utils.h | 3 +- - path_utils/path_utils_ut.c | 19 +++++++++++++--- - 3 files changed, 55 insertions(+), 15 deletions(-) - -diff --git a/path_utils/path_utils.c b/path_utils/path_utils.c -index 25ca4267fc0d7d9f3483646c2aef22fcdef1eb24..0a758c5bfd09ef5708e9f68d3aecc0733607e3d8 100644 ---- a/path_utils/path_utils.c -+++ b/path_utils/path_utils.c -@@ -192,6 +192,7 @@ bool is_absolute_path(const char *path) - - int path_concat(char *path, size_t path_size, const char *head, const char *tail) - { -+ int ret; - const char *p, *src; - char *dst, *dst_end; - -@@ -201,13 +202,27 @@ int path_concat(char *path, size_t path_size, const char *head, const char *tail - dst_end = path + path_size - 1; /* -1 allows for NULL terminator */ - - if (head && *head) { -- for (p = head; *p; p++); /* walk to end of head */ -- for (p--; p > head && *p == '/'; p--); /* skip any trailing slashes in head */ -- if ((p - head) > path_size-1) return ENOBUFS; -- for (src = head; src <= p && dst < dst_end;) *dst++ = *src++; /* copy head */ -+ /* walk to end of head */ -+ for (p = head; *p; p++); -+ -+ /* skip any trailing slashes in head */ -+ for (p--; p > head && *p == '/'; p--); -+ -+ /* If the length of head exceeds the buffer size, fail */ -+ if ((p - head) > path_size-1) { -+ ret = ENOBUFS; -+ goto fail; -+ } -+ -+ /* Copy head into path */ -+ for (src = head; src <= p && dst < dst_end;) { -+ *dst++ = *src++; -+ } - } - if (tail && *tail) { -- for (p = tail; *p && *p == '/'; p++); /* skip any leading slashes in tail */ -+ /* skip any leading slashes in tail */ -+ for (p = tail; *p && *p == '/'; p++); -+ - if (dst > path) - /* insert single slash between head & tail - * Making sure not to add an extra if the -@@ -218,15 +233,28 @@ int path_concat(char *path, size_t path_size, const char *head, const char *tail - if (dst < dst_end && *(dst-1) != '/') { - *dst++ = '/'; - } -- for (src = p; *src && dst < dst_end;) *dst++ = *src++; /* copy tail */ -- if (*src) return ENOBUFS; /* failed to copy everything */ -+ -+ /* Copy the tail into the path */ -+ for (src = p; *src && dst < dst_end;) { -+ *dst++ = *src++; -+ } -+ -+ /* If we got past dst_end and there is more data -+ * in the src buffer, we should return ENOBUFS -+ */ -+ if (*src) { -+ ret = ENOBUFS; /* failed to copy everything */ -+ goto fail; -+ } - } - *dst = 0; -- if (dst > dst_end) { -- return ENOBUFS; -- } -+ - return SUCCESS; - -+fail: -+ /* On failure, set the buffer to the empty string for safety */ -+ *path = '\0'; -+ return ret; - } - - int make_path_absolute(char *absolute_path, size_t absolute_path_size, const char *path) -diff --git a/path_utils/path_utils.h b/path_utils/path_utils.h -index 2fd567c4eaa30ee1eb05af868d7d14b6e2a71a43..17ed1f4324a192c32d8229417d527424ef01ccd2 100644 ---- a/path_utils/path_utils.h -+++ b/path_utils/path_utils.h -@@ -198,7 +198,8 @@ bool is_absolute_path(const char *path); - * @param[in] tail The second component of the path - * - * @return \c SUCCESS if successful, non-zero error code otherwise. -- * \li \c ENOBUFS If the buffer space is too small -+ * \li \c ENOBUFS If the buffer space is too small. In this case, -+ * path will be set to an empty string. - */ - int path_concat(char *path, size_t path_size, const char *head, const char *tail); - -diff --git a/path_utils/path_utils_ut.c b/path_utils/path_utils_ut.c -index 34462cfdd4a2238f878a170fba2481b31f96e33e..aadd89b74420a4f8bc51ace779ecfb4223afa0e3 100644 ---- a/path_utils/path_utils_ut.c -+++ b/path_utils/path_utils_ut.c -@@ -252,24 +252,35 @@ START_TEST(test_path_concat_neg) - char small[3]; - char small2[5]; - char small3[7]; -- char p2[9]; -+ char p2[10]; - - /* these two test different conditions */ - - /* Test if head is longer than the buffer */ - fail_unless(path_concat(small, 3, "/foo", "bar") == ENOBUFS); -+ /* On ENOBUFS, path should be empty */ -+ fail_unless_str_equal(small, ""); - - /* Test if head is the same length as the buffer */ - fail_unless(path_concat(small2, 5, "/foo", "bar") == ENOBUFS); -+ /* On ENOBUFS, path should be empty */ -+ fail_unless_str_equal(small2, ""); - - /* Test if head+tail is the longer than the buffer */ - fail_unless(path_concat(small3, 7, "/foo", "bar") == ENOBUFS); -+ /* On ENOBUFS, path should be empty */ -+ fail_unless_str_equal(small3, ""); - - /* off-by-one */ -- p2[8] = 1; /* Check whether we've written too far */ -+ /* Fill with garbage data for now */ -+ memset(p2, 'Z', 9); -+ p2[9] = '\0'; -+ - fail_unless(path_concat(p2, 8, "/foo", "bar") == ENOBUFS); -- fail_unless(p2[8] == 1); /* This should be untouched */ -- fail_unless_str_equal(p2, "/foo/ba"); -+ /* Make sure we don't write past the end of the buffer */ -+ fail_unless(p2[8] == 'Z', "Got [%d]", p2[8]); -+ /* On ENOBUFS, path should be empty */ -+ fail_unless_str_equal(p2, ""); - } - END_TEST - --- -1.7.7.6 - diff --git a/ding-libs.spec b/ding-libs.spec index 0b47704..3b6c5d3 100644 --- a/ding-libs.spec +++ b/ding-libs.spec @@ -1,6 +1,6 @@ Name: ding-libs -Version: 0.1.3 -Release: 8%{?dist} +Version: 0.2.91 +Release: 1%{?dist} Summary: "Ding is not GLib" assorted utility libraries Group: Development/Libraries License: LGPLv3+ @@ -10,16 +10,12 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %global path_utils_version 0.2.1 %global dhash_version 0.4.3 -%global collection_version 0.6.1 -%global ref_array_version 0.1.2 -%global ini_config_version 0.6.2 +%global collection_version 0.6.2 +%global ref_array_version 0.1.3 +%global ini_config_version 0.7.0 ### Patches ### -Patch0001: 0001-path_utils-handle-off-by-one-error-in-path_concat.patch -Patch0002: 0002-path_utils-Handle-in-path_concat.patch -Patch0003: 0003-path_utils-path_concat-should-return-empty-string-on.patch - ### Dependencies ### ### Build Dependencies ### @@ -202,6 +198,45 @@ A dynamically-growing, reference-counted array %doc refarray/doc/html/ +############################################################################## +# basicobjects +############################################################################## + +%package -n libbasicobjects +Summary: Basic object types for C +Group: Development/Libraries +License: GPLv3+ +Version: %{basicobjects_version} + +%description -n libbasicobjects +Basic object types + +%package -n libbasicobjects-devel +Summary: Development files for libbasicobjects +Group: Development/Libraries +License: GPLv3+ +Version: %{basicobjects_version} +Requires: libbasicobjects = %{basicobjects_version}-%{release} + +%description -n libbasicobjects-devel +Basic object types + +%post -n libbasicobjects -p /sbin/ldconfig +%postun -n libbasicobjects -p /sbin/ldconfig + +%files -n libbasicobjects +%defattr(-,root,root,-) +%doc COPYING +%doc COPYING.LESSER +%{_libdir}/libbasicobjects.so.0 +%{_libdir}/libbasicobjects.so.0.0.0 + +%files -n libbasicobjects-devel +%defattr(-,root,root,-) +%{_includedir}/simplebuffer.h +%{_libdir}/libbasicobjects.so +%{_libdir}/pkgconfig/basicobjects.pc + ############################################################################## # ini_config ############################################################################## @@ -251,10 +286,6 @@ structure %prep %setup -q -%patch0001 -p1 -%patch0002 -p1 -%patch0003 -p1 - %build %configure \ --disable-static @@ -287,6 +318,10 @@ rm -f */doc/html/installdox rm -rf $RPM_BUILD_ROOT %changelog +* Fri May 25 2012 Jan Zeleny - 0.2.91-1 +- Rebase to 0.3.0beta1, changelog available at + https://fedorahosted.org/sssd/wiki/Releases/DingNotes-0.2.91 + * Tue Mar 06 2012 Stephen Gallagher - 0.1.3-8 - Make path_concat return empty string on ENOBUFS diff --git a/sources b/sources index 26e72b6..ab59ea1 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -b4f5e03b0b1bd0ab765902a7a466f749 ding-libs-0.1.3.tar.gz +7d9306ea4f0c2d6ef657c772abd2a8fd ding-libs-0.2.91.tar.gz