Accepting request 1043899 from home:dimstar:Factory

- Update to version 1.0.8:
  + Bug #2: fix regression introduced by fix for bug #1
    - Obsoletes issue2-mr7.patch
  + man page: add line breaks in Synopsis section

  * Bug #2: fix regression introduced by fix for bug #1

OBS-URL: https://build.opensuse.org/request/show/1043899
OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/makedepend?expand=0&rev=16
This commit is contained in:
Stefan Dirsch 2022-12-31 12:44:19 +00:00 committed by Git OBS Bridge
parent 167b1559a4
commit a4fc2cb2a6
5 changed files with 19 additions and 177 deletions

View File

@ -1,163 +0,0 @@
From 654f6355d501153fe1fbdbc073cb72fd6355e194 Mon Sep 17 00:00:00 2001
From: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Mon, 5 Dec 2022 15:48:17 -0800
Subject: [PATCH] Bug #2: fix regression introduced by fix for bug #1
Refactor code to find the full file path before comparing against
existing items in the list so that we stop adding duplicate entries
for all the files in the system include path and with larger amounts
of code hitting the MAXFILES limit.
Fixes: 3dc64b0 ("Add test case for bug #1 + proposed fix.")
Closes: #2
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
---
include.c | 101 ++++++++++++++++++++++++++----------------------------
1 file changed, 49 insertions(+), 52 deletions(-)
diff --git a/include.c b/include.c
index 697e9de..57e2b24 100644
--- a/include.c
+++ b/include.c
@@ -222,60 +222,17 @@ inc_clean (void)
}
}
-struct inclist *
-inc_path(const char *file, const char *include, int type)
+/*
+ * Return full path for the "include" file of the given "type",
+ * which may be found relative to the source file "file".
+ */
+static const char *
+find_full_inc_path(const char *file, const char *include, int type)
{
static char path[ BUFSIZ ];
register const char **pp, *p;
- register struct inclist *ip;
struct stat st;
- /*
- * Check all previously found include files for a path that
- * has already been expanded.
- */
- if ((type == INCLUDE) || (type == INCLUDEDOT))
- inclistnext = inclist;
- ip = inclistnext;
-
- for (; ip->i_file; ip++) {
- if ((strcmp(ip->i_incstring, include) == 0) &&
- !(ip->i_flags & INCLUDED_SYM)) {
- /*
- * Same filename but same file ?
- */
- char r_include[PATHMAX+1];
- char r_saved_path[PATHMAX+1];
- char* ptr;
- ptr = realpath(include, r_include);
- ptr = realpath(ip->i_file, r_saved_path);
- if (!strcmp(r_include, r_saved_path)) {
- inclistnext = ip + 1;
- return ip;
- }
-
- /*
- * Check if we have a header in the same dir
- */
- for (p=file+strlen(file); p>file; p--)
- if (*p == '/')
- break;
- if (p == file) {
- strcpy(path, include);
- } else {
- strncpy(path, file, (p-file) + 1);
- path[ (p-file) + 1 ] = '\0';
- strcpy(path + (p-file) + 1, include);
- }
- remove_dotdot(path);
- ptr = realpath(path, r_include);
- if (!strcmp(r_include, r_saved_path)) {
- inclistnext = ip + 1;
- return ip;
- }
- }
- }
-
if (inclistnext == inclist) {
/*
* If the path was surrounded by "" or is an absolute path,
@@ -285,7 +242,7 @@ inc_path(const char *file, const char *include, int type)
(type == INCLUDENEXTDOT) ||
(*include == '/')) {
if (stat(include, &st) == 0 && !S_ISDIR(st.st_mode))
- return newinclude(include, include);
+ return include;
if (show_where_not)
warning1("\tnot in %s\n", include);
}
@@ -307,7 +264,7 @@ inc_path(const char *file, const char *include, int type)
}
remove_dotdot(path);
if (stat(path, &st) == 0 && !S_ISDIR(st.st_mode))
- return newinclude(path, include);
+ return path;
if (show_where_not)
warning1("\tnot in %s\n", path);
}
@@ -326,7 +283,7 @@ inc_path(const char *file, const char *include, int type)
remove_dotdot(path);
if (stat(path, &st) == 0 && !S_ISDIR(st.st_mode)) {
includedirsnext = pp + 1;
- return newinclude(path, include);
+ return path;
}
if (show_where_not)
warning1("\tnot in %s\n", path);
@@ -334,3 +291,43 @@ inc_path(const char *file, const char *include, int type)
return NULL;
}
+
+struct inclist *
+inc_path(const char *file, const char *include, int type)
+{
+ const char *fp;
+ struct inclist *ip;
+ char r_include[PATHMAX+1];
+
+ /*
+ * Check all previously found include files for a path that
+ * has already been expanded.
+ */
+ if ((type == INCLUDE) || (type == INCLUDEDOT))
+ inclistnext = inclist;
+ ip = inclistnext;
+
+ fp = find_full_inc_path(file, include, type);
+ if (fp == NULL)
+ return NULL;
+ if (realpath(fp, r_include) == NULL)
+ return NULL;
+
+ for (; ip->i_file; ip++) {
+ if ((strcmp(ip->i_incstring, include) == 0) &&
+ !(ip->i_flags & INCLUDED_SYM)) {
+ /*
+ * Same filename but same file ?
+ */
+ char r_saved_path[PATHMAX+1];
+ if (realpath(ip->i_file, r_saved_path) == NULL)
+ continue;
+ if (!strcmp(r_include, r_saved_path)) {
+ inclistnext = ip + 1;
+ return ip;
+ }
+ }
+ }
+
+ return newinclude(fp, include);
+}
--
GitLab

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a729cfd3c0f4e16c0db1da351e7f53335222e058e3434e84f91251fd6d407065
size 140528

BIN
makedepend-1.0.8.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,8 +1,16 @@
-------------------------------------------------------------------
Tue Dec 20 12:09:34 UTC 2022 - Dominique Leuenberger <dimstar@opensuse.org>
- Update to version 1.0.8:
+ Bug #2: fix regression introduced by fix for bug #1
- Obsoletes issue2-mr7.patch
+ man page: add line breaks in Synopsis section
-------------------------------------------------------------------
Tue Dec 6 11:04:15 UTC 2022 - Stefan Dirsch <sndirsch@suse.com>
- issue2-mr7.patch
* Bug #2: fix regression introduced by fix for bug #1
* Bug #2: fix regression introduced by fix for bug #1
-------------------------------------------------------------------
Sat Oct 29 17:18:03 UTC 2022 - Stefan Dirsch <sndirsch@suse.com>

View File

@ -17,19 +17,17 @@
Name: makedepend
Version: 1.0.7
Version: 1.0.8
Release: 0
Summary: Utility to create dependencies in makefiles
License: MIT
Group: Development/Tools/Building
URL: http://xorg.freedesktop.org/
URL: https://xorg.freedesktop.org/
Source0: http://xorg.freedesktop.org/releases/individual/util/%{name}-%{version}.tar.xz
Patch0: issue2-mr7.patch
BuildRequires: pkg-config
BuildRequires: pkgconfig
BuildRequires: pkgconfig(xproto) >= 7.0.17
# This was part of the xorg-x11-util-devel package up to version 7.6
Conflicts: xorg-x11-util-devel <= 7.6
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
The makedepend program reads each sourcefile in sequence and parses it
@ -41,19 +39,18 @@ make will know which object files must be recompiled when a dependency
has changed.
%prep
%setup -q
%patch0 -p1
%autosetup -p1
%build
%configure
make %{?_smp_mflags}
%make_build
%install
%make_install
%files
%defattr(-,root,root)
%doc AUTHORS ChangeLog COPYING README.md
%license COPYING
%doc AUTHORS ChangeLog README.md
%{_bindir}/makedepend
%{_mandir}/man1/makedepend.1%{?ext_man}