bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* is_dotdot confusion in Gnulib fts's fts_safe_changedir?
@ 2019-03-17 23:16 Paul Eggert
  2019-03-18  4:53 ` Jim Meyering
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Eggert @ 2019-03-17 23:16 UTC (permalink / raw
  To: Jim Meyering; +Cc: Gnulib bugs

[-- Attachment #1: Type: text/plain, Size: 322 bytes --]

I installed the attached patch into Gnulib to remove an unnecessary
assignment in fts_safe_changedir.

Jim, could you please check this? My patch does not change behavior, but
I worry that there's a bug in fts_safe_changedir that the unnecessary
assignment was a symptom of. This is code you wrote many years ago, so ...


[-- Attachment #2: 0001-fts-minor-simplification.patch --]
[-- Type: text/x-patch, Size: 1171 bytes --]

From 452fa9db18bc6f3cbcc4095b86edbfe3f825209c Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sun, 17 Mar 2019 12:39:50 -0700
Subject: [PATCH] fts: minor simplification

* lib/fts.c (fts_safe_changedir): Remove redundant assignment.
---
 ChangeLog | 5 +++++
 lib/fts.c | 1 -
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 9ce4bf24c..28787600f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2019-03-17  Paul Eggert  <eggert@cs.ucla.edu>
+
+	fts: minor simplification
+	* lib/fts.c (fts_safe_changedir): Remove redundant assignment.
+
 2019-03-17  Akim Demaille  <akim@lrde.epita.fr>
 
 	bitset, timevar: Depend on c99.
diff --git a/lib/fts.c b/lib/fts.c
index 58232ac97..8b7a4de9c 100644
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -2069,7 +2069,6 @@ fts_safe_changedir (FTS *sp, FTSENT *p, int fd, char const *dir)
                 int parent_fd;
                 fd_ring_print (sp, stderr, "pre-pop");
                 parent_fd = i_ring_pop (&sp->fts_fd_ring);
-                is_dotdot = true;
                 if (0 <= parent_fd)
                   {
                     fd = parent_fd;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: is_dotdot confusion in Gnulib fts's fts_safe_changedir?
  2019-03-17 23:16 is_dotdot confusion in Gnulib fts's fts_safe_changedir? Paul Eggert
@ 2019-03-18  4:53 ` Jim Meyering
  0 siblings, 0 replies; 2+ messages in thread
From: Jim Meyering @ 2019-03-18  4:53 UTC (permalink / raw
  To: Paul Eggert; +Cc: Gnulib bugs

On Sun, Mar 17, 2019 at 4:16 PM Paul Eggert <eggert@cs.ucla.edu> wrote:
> I installed the attached patch into Gnulib to remove an unnecessary
> assignment in fts_safe_changedir.
>
> Jim, could you please check this? My patch does not change behavior, but
> I worry that there's a bug in fts_safe_changedir that the unnecessary
> assignment was a symptom of. This is code you wrote many years ago, so ...

Hi Paul,

Thank you. I agree it's an unnecessary assignment.
I confirmed that it was in the original (to gnulib) version,
7f01591aadb13b59cb04f9ad42400eb7ea1c6e19.
Incidentally, that seems like the type of useless assignment a modern
compiler could easily warn about.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-18  4:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-17 23:16 is_dotdot confusion in Gnulib fts's fts_safe_changedir? Paul Eggert
2019-03-18  4:53 ` Jim Meyering

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).