[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] fts: introduce FTS_VERBATIM
From: |
Jim Meyering |
Subject: |
Re: [PATCH] fts: introduce FTS_VERBATIM |
Date: |
Sun, 18 Nov 2012 02:05:43 +0100 |
Dmitry V. Levin wrote:
> This gives clients the option to disable stripping of trailing slashes
> from input path names during fts_open initialization.
>
> The recent change v0.0-7611-g3a9002d that made fts_open strip trailing
> slashes from input path names had a negative impact on findutils that
> relies on the old fts_open behavior to implement POSIX requirement that
> each path operand of the find utility shall be evaluated unaltered as it
> was provided, including all trailing slash characters.
>
> * lib/fts_.h (FTS_NOATIME): New bit flag.
Thanks, Dmitry. The patch looks perfect.
However, I've corrected s/FTS_NOATIME/FTS_VERBATIM/
in ChangeLog and in the git log:
>From fd9f1acededd74f8cd095e657528aa8fad183536 Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <address@hidden>
Date: Sun, 18 Nov 2012 04:40:18 +0400
Subject: [PATCH] fts: introduce FTS_VERBATIM
This gives clients the option to disable stripping of trailing slashes
from input path names during fts_open initialization.
The recent change v0.0-7611-g3a9002d that made fts_open strip trailing
slashes from input path names had a negative impact on findutils that
relies on the old fts_open behavior to implement POSIX requirement that
each path operand of the find utility shall be evaluated unaltered as it
was provided, including all trailing slash characters.
* lib/fts_.h (FTS_VERBATIM): New bit flag.
(FTS_OPTIONMASK, FTS_NAMEONLY, FTS_STOP): Adjust.
* lib/fts.c (fts_open): Honor it.
---
ChangeLog | 7 +++++++
lib/fts.c | 15 +++++++++------
lib/fts_.h | 10 +++++++---
3 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 67e0342..348e0d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-11-17 Dmitry V. Levin <address@hidden>
+
+ fts: introduce FTS_VERBATIM
+ * lib/fts_.h (FTS_VERBATIM): New bit flag.
+ (FTS_OPTIONMASK, FTS_NAMEONLY, FTS_STOP): Adjust.
+ * lib/fts.c (fts_open): Honor it.
+
2012-11-09 Pádraig Brady <address@hidden>
getlogin-tests: allow errno == ENXIO
diff --git a/lib/fts.c b/lib/fts.c
index 36f7e0d..9c38c4f 100644
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -488,12 +488,15 @@ fts_open (char * const *argv,
/* *Do* allow zero-length file names. */
size_t len = strlen(*argv);
- /* If there are two or more trailing slashes, trim all but one,
- but don't change "//" to "/", and do map "///" to "/". */
- char const *v = *argv;
- if (2 < len && v[len - 1] == '/')
- while (1 < len && v[len - 2] == '/')
- --len;
+ if ( ! (options & FTS_VERBATIM))
+ {
+ /* If there are two or more trailing slashes, trim all but
one,
+ but don't change "//" to "/", and do map "///" to "/".
*/
+ char const *v = *argv;
+ if (2 < len && v[len - 1] == '/')
+ while (1 < len && v[len - 2] == '/')
+ --len;
+ }
if ((p = fts_alloc(sp, *argv, len)) == NULL)
goto mem3;
diff --git a/lib/fts_.h b/lib/fts_.h
index 5294039..73d29d3 100644
--- a/lib/fts_.h
+++ b/lib/fts_.h
@@ -145,10 +145,14 @@ typedef struct {
# define FTS_NOATIME 0x0800 /* use O_NOATIME during traversal */
-# define FTS_OPTIONMASK 0x0fff /* valid user option mask */
+ /* Use this flag to disable stripping of trailing slashes
+ from input path names during fts_open initialization. */
+# define FTS_VERBATIM 0x1000
-# define FTS_NAMEONLY 0x1000 /* (private) child names only */
-# define FTS_STOP 0x2000 /* (private) unrecoverable error */
+# define FTS_OPTIONMASK 0x1fff /* valid user option mask */
+
+# define FTS_NAMEONLY 0x2000 /* (private) child names only */
+# define FTS_STOP 0x4000 /* (private) unrecoverable error */
int fts_options; /* fts_open options, global flags */
/* Map a directory's device number to a boolean. The boolean is
--
1.8.0.197.g5a90748
- Re: [PATCH] fts: reduce two or more trailing spaces to just one, usually, Eric Blake, 2012/11/01
- Re: [PATCH] fts: reduce two or more trailing spaces to just one, usually, Dmitry V. Levin, 2012/11/01
- Re: [PATCH] fts: reduce two or more trailing spaces to just one, usually, James Youngman, 2012/11/16
- Re: [PATCH] fts: reduce two or more trailing spaces to just one, usually, Dmitry V. Levin, 2012/11/16
- Re: [PATCH] fts: reduce two or more trailing spaces to just one, usually, Paul Eggert, 2012/11/16
- Re: [PATCH] fts: reduce two or more trailing spaces to just one, usually, James Youngman, 2012/11/16
- Re: [PATCH] fts: reduce two or more trailing spaces to just one, usually, Jim Meyering, 2012/11/16
- Re: [PATCH] fts: reduce two or more trailing spaces to just one, usually, Jim Meyering, 2012/11/16
- [PATCH] fts: introduce FTS_VERBATIM, Dmitry V. Levin, 2012/11/17
- Re: [PATCH] fts: introduce FTS_VERBATIM,
Jim Meyering <=
- Re: [PATCH] fts: introduce FTS_VERBATIM, Dmitry V. Levin, 2012/11/17