From: "Guillermo E. Martinez" <guillermo.e.martinez@oracle.com>
To: libabigail@sourceware.org
Subject: [PATCH] Using `entry_of_file_with_name' returns incorrect result
Date: Mon, 25 Apr 2022 12:01:23 -0500 [thread overview]
Message-ID: <20220425170123.1971444-1-guillermo.e.martinez@oracle.com> (raw)
Hello libabigail team,
This patch corrects the returning value for `entry_of_file_with_name'
function when more than one file in a given directory has a same suffix,
Comments will be appreciated.
Kind Regards,
Guillermo
Function `entry_of_file_with_name' uses `string_ends_with' to test if a
given `fts_path' member of `FTSENT' structure match with `fname'
argument, this result is not correct when in the current directory there
are file with names: "./rmdir-xyx", "./dir-xyz" it returns true for both
files, this patch fixes this ambiguity using `basename' instead.
* src/abg-tools-utils.cc (entry_of_file_with_name): Replace
call `string_ends_with' by `basename'.
---
src/abg-tools-utils.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/abg-tools-utils.cc b/src/abg-tools-utils.cc
index e94c3003..1f0f6fa8 100644
--- a/src/abg-tools-utils.cc
+++ b/src/abg-tools-utils.cc
@@ -2141,8 +2141,8 @@ entry_of_file_with_name(const FTSENT *entry,
|| entry->fts_info == FTS_NS)
return false;
- string fpath = entry->fts_path;
- if (string_ends_with(fpath, fname))
+ string fpath = ::basename(entry->fts_path);
+ if (fpath == fname)
return true;
return false;
}
--
2.35.1
next reply other threads:[~2022-04-25 17:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-25 17:01 Guillermo E. Martinez [this message]
2022-05-02 15:29 ` Dodji Seketeli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220425170123.1971444-1-guillermo.e.martinez@oracle.com \
--to=guillermo.e.martinez@oracle.com \
--cc=libabigail@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).