From 0c36365db8921397a258abbea0369cee8d560c99 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Fri, 16 Aug 2024 17:45:10 -0400 Subject: [PATCH] Revised the file opening routine with respect to the search paths. Previously, a file path beginning with "/", "./", or "../" would be searched for verbatim and no searching would be done over paths. This behavior now occurs for a leading "/" only. File paths with "./" or "../" will search for the file with the path verbatim, then proceed to search for the file with each search path prepended to the filename as usual. This solves a problem for reusable, non- PDK IP blocks, where the IP block may have an abstract view pointing to a GDS file which is specified as being located at "../gds/". This file would not be found if the IP block was included into another project. Now it can be done if the path to the IP is given by "addpath". --- VERSION | 2 +- utils/path.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index e4716a47..091aeb8f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.488 +8.3.489 diff --git a/utils/path.c b/utils/path.c index 852b2ef2..71431dac 100644 --- a/utils/path.c +++ b/utils/path.c @@ -736,8 +736,9 @@ PaLockOpen(file, mode, ext, path, library, pRealName, is_locked, fdp) #endif f = fopen(realName, mode); - if ((fdp != NULL) && (f != NULL)) *fdp = fileno(f); - return f; + if ((fdp != NULL) && (f != NULL)) *fdp = fileno(f); + if ((f != NULL) || (file[0] == '/')) + return f; } /* Now try going through the path, one entry at a time. */ @@ -883,9 +884,15 @@ PaZOpen(file, mode, ext, path, library, pRealName) || strcmp(file, "..") == 0 || strncmp(file, "../", 3) == 0))) { + gzFile result; (void) strncpy(realName, file, MAXSIZE-1); realName[MAXSIZE-1] = '\0'; - return gzopen(realName, mode); + + /* For full paths, halt immediately if not found. Otherwise, + * treat the path as relative to something in the search path. + */ + result = gzopen(realName, mode); + if ((result != NULL) || (file[0] == '/')) return result; } /* Now try going through the path, one entry at a time. */