diff -Nru deborphan-1.7.32/debian/changelog deborphan-1.7.33/debian/changelog --- deborphan-1.7.32/debian/changelog 2019-10-16 22:14:03.000000000 +0000 +++ deborphan-1.7.33/debian/changelog 2020-05-20 13:58:26.000000000 +0000 @@ -1,3 +1,11 @@ +deborphan (1.7.33) unstable; urgency=medium + + * Use quotes to refer to local include files + * Avoid crash in addkeep with empty keep files (Closes: #929273) + * Bump Standards-Version to 4.5.0 + + -- Chris Hofstaedtler Wed, 20 May 2020 13:58:26 +0000 + deborphan (1.7.32) unstable; urgency=medium [ Debian Janitor ] diff -Nru deborphan-1.7.32/debian/control deborphan-1.7.33/debian/control --- deborphan-1.7.32/debian/control 2019-10-16 22:14:03.000000000 +0000 +++ deborphan-1.7.33/debian/control 2020-05-20 13:58:26.000000000 +0000 @@ -4,7 +4,7 @@ Maintainer: deborphan Maintainers Uploaders: Chris Hofstaedtler , Carsten Hey -Standards-Version: 4.4.1 +Standards-Version: 4.5.0 Build-Depends: debhelper-compat (= 12), po4a Rules-Requires-Root: no diff -Nru deborphan-1.7.32/src/deborphan.c deborphan-1.7.33/src/deborphan.c --- deborphan-1.7.32/src/deborphan.c 2019-10-16 22:14:03.000000000 +0000 +++ deborphan-1.7.33/src/deborphan.c 2020-05-20 13:58:26.000000000 +0000 @@ -15,8 +15,8 @@ #include #include -#include -#include +#include "config.h" +#include "deborphan.h" /* These files should already be installed on the host machine - the GPL does not allow redistribution in this package. */ diff -Nru deborphan-1.7.32/src/exit.c deborphan-1.7.33/src/exit.c --- deborphan-1.7.32/src/exit.c 2019-10-16 22:14:03.000000000 +0000 +++ deborphan-1.7.33/src/exit.c 2020-05-20 13:58:26.000000000 +0000 @@ -7,14 +7,14 @@ file COPYING provided in this package for details. */ +#include #include #include #include #include -#include -#include -#include +#include "config.h" +#include "deborphan.h" #ifdef ENABLE_NLS #include diff -Nru deborphan-1.7.32/src/file.c deborphan-1.7.33/src/file.c --- deborphan-1.7.32/src/file.c 2019-10-16 22:14:03.000000000 +0000 +++ deborphan-1.7.33/src/file.c 2020-05-20 13:58:26.000000000 +0000 @@ -7,18 +7,17 @@ file COPYING provided in this package for details. */ +#include #include #include #include #include -#include - #include #include +#include -#include -#include -#include +#include "config.h" +#include "deborphan.h" /* This uses up as much memory as your status file (near a * megabyte). It is considerably faster, though. diff -Nru deborphan-1.7.32/src/keep.c deborphan-1.7.33/src/keep.c --- deborphan-1.7.32/src/keep.c 2019-10-16 22:14:03.000000000 +0000 +++ deborphan-1.7.33/src/keep.c 2020-05-20 13:58:26.000000000 +0000 @@ -15,13 +15,12 @@ #include #include #include -#include - #include #include #include +#include -#include +#include "deborphan.h" /* If package is a valid package, this function returns 0. On error, it * returns -1, if it is not a valid package, it returns the position in @@ -130,15 +129,23 @@ error(EXIT_FAILURE, errno, "Opening %s", kfile); } - // ... check if the final newline is missing ... - if (fseek(fp, -1L, SEEK_END) < 0) { + if (fseek(fp, 0L, SEEK_END) < 0) { error(EXIT_FAILURE, errno, "fseek on %s", kfile); } - c = fgetc(fp); - fseek(fp, 0L, SEEK_END); - if (c != EOF && c != '\n') { - // ... and add '\n' if appropriate. - fputc('\n', fp); + + if (ftell(fp) != 0L) { + // ... check if the final newline is missing ... + if (fseek(fp, -1L, SEEK_END) < 0) { + error(EXIT_FAILURE, errno, "fseek on %s", kfile); + } + c = fgetc(fp); + if (fseek(fp, 0L, SEEK_END) < 0) { + error(EXIT_FAILURE, errno, "fseek on %s", kfile); + } + if (c != EOF && c != '\n') { + // ... and add '\n' if appropriate. + fputc('\n', fp); + } } int i = 0; diff -Nru deborphan-1.7.32/src/libdeps.c deborphan-1.7.33/src/libdeps.c --- deborphan-1.7.32/src/libdeps.c 2019-10-16 22:14:03.000000000 +0000 +++ deborphan-1.7.33/src/libdeps.c 2020-05-20 13:58:26.000000000 +0000 @@ -13,8 +13,8 @@ #include #include -#include -#include +#include "config.h" +#include "deborphan.h" extern int options[]; diff -Nru deborphan-1.7.32/src/pkginfo.c deborphan-1.7.33/src/pkginfo.c --- deborphan-1.7.32/src/pkginfo.c 2019-10-16 22:14:03.000000000 +0000 +++ deborphan-1.7.33/src/pkginfo.c 2020-05-20 13:58:26.000000000 +0000 @@ -12,12 +12,12 @@ result in deborphan giving the wrong packages, or even crashing. */ #include +#include #include #include -#include -#include -#include +#include "config.h" +#include "deborphan.h" static regex_t re_statusinst, re_statusnotinst, re_statushold, re_namedev, re_gnugrepv, re_descdummy, re_desctransit, re_statusconfig, re_status; diff -Nru deborphan-1.7.32/src/set.c deborphan-1.7.33/src/set.c --- deborphan-1.7.32/src/set.c 2019-10-16 22:14:03.000000000 +0000 +++ deborphan-1.7.33/src/set.c 2020-05-20 13:58:26.000000000 +0000 @@ -5,12 +5,13 @@ Distributed under the terms of the MIT License, see the file COPYING provided in this package for details. */ +#include #include #include #include -#include -#include +#include "config.h" +#include "deborphan.h" dep* set_dep(dep* p, const char* name) { char *str, *t; diff -Nru deborphan-1.7.32/src/string.c deborphan-1.7.33/src/string.c --- deborphan-1.7.32/src/string.c 2019-10-16 22:14:03.000000000 +0000 +++ deborphan-1.7.33/src/string.c 2020-05-20 13:58:26.000000000 +0000 @@ -6,9 +6,11 @@ file COPYING provided in this package for details. */ -#include #include +#include "config.h" +#include "deborphan.h" + /* Simple function to hash a string to an unsigned int. */ unsigned int strhash(const char* line) {