mirror of
https://https.git.savannah.gnu.org/git/findutils.git
synced 2026-01-26 15:39:06 +00:00
Bug #27213: avoid failed assertions for non-executable directories.
Addresses Savannah bug #27213 - https://savannah.gnu.org/bugs/?27213 This used to fail in recent releases: 1. mkdir -p foo/bar 2. chmod a-x foo 3. find foo 4. find foo -ls Now it will print error messages for the denied permission on foo, but will not abort completely, and in 3. will even print the name foo/bar, while it won't do so in 4., as the -ls predicate requires stat information. For now, 4. will print two identical error message. This should get fixed some day.
This commit is contained in:
parent
969f7feed3
commit
20171febf2
@ -18,3 +18,4 @@ c++defs.h
|
||||
useless-if-before-free
|
||||
vc-list-files
|
||||
update-copyright
|
||||
unused-parameter.h
|
||||
|
||||
1
build-aux/.gitignore
vendored
1
build-aux/.gitignore
vendored
@ -17,3 +17,4 @@ compile
|
||||
/useless-if-before-free
|
||||
/vc-list-files
|
||||
/update-copyright
|
||||
/unused-parameter.h
|
||||
|
||||
@ -459,6 +459,23 @@ consider_visiting (FTS *p, FTSENT *ent)
|
||||
error_severity (1);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
error(0, ent->fts_errno, "%s",
|
||||
safely_quote_err_filename(0, ent->fts_path));
|
||||
error_severity(1);
|
||||
/* Continue despite the error, as file name without stat info
|
||||
* might be better than not even processing the file name. This
|
||||
* can lead to repeated error messages later on, though, if a
|
||||
* predicate requires stat information.
|
||||
*
|
||||
* Not printing an error message here would be even more wrong,
|
||||
* though, as this could cause the contents of a directory to be
|
||||
* silently ignored, as the directory wouldn't be identified as
|
||||
* such.
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -467,7 +484,7 @@ consider_visiting (FTS *p, FTSENT *ent)
|
||||
|| ent->fts_info == FTS_NS /* e.g. symlink loop */)
|
||||
{
|
||||
assert (!state.have_stat);
|
||||
assert (ent->fts_info == FTS_NSOK || state.type != 0);
|
||||
assert (ent->fts_info == FTS_NSOK || state.type == 0);
|
||||
mode = state.type;
|
||||
}
|
||||
else
|
||||
|
||||
11
find/util.c
11
find/util.c
@ -216,6 +216,9 @@ get_statinfo (const char *pathname, const char *name, struct stat *p)
|
||||
{
|
||||
if (!options.ignore_readdir_race || (errno != ENOENT) )
|
||||
{
|
||||
/* FIXME: this error message might repeat the one from
|
||||
* the FTS_NS case in consider_visiting. How to avoid this?
|
||||
*/
|
||||
error (0, errno, "%s",
|
||||
safely_quote_err_filename (0, pathname));
|
||||
state.exit_status = 1;
|
||||
@ -271,6 +274,10 @@ get_info (const char *pathname,
|
||||
{
|
||||
int result = get_statinfo (pathname, state.rel_pathname, p);
|
||||
if (result != 0)
|
||||
{
|
||||
return -1; /* failure. */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Verify some postconditions. We can't check st_mode for
|
||||
non-zero-ness because of Savannah bug #16378 (which is
|
||||
@ -283,10 +290,6 @@ get_info (const char *pathname,
|
||||
{
|
||||
assert (p->st_ino);
|
||||
}
|
||||
return -1; /* failure. */
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0; /* success. */
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user