Follow-up Comment #1, bug #54262 (project findutils):

The code in print.c is

                /* If we would normally follow links, do not do so.
                 * If we would normally not follow links, do so.
                 */
                if ((following_links () ? optionp_stat : optionl_stat)
                    (state.rel_pathname, &sbuf) != 0)

which calls optionl_stat() in the default -P mode.  But optionl_stat() calls
fallback_stat() if the initial fstatat() fails, which does

  switch (errno)
    {
    case ENOENT:
    case ENOTDIR:
      if (options.debug_options & DebugStat)
        fprintf(stderr, "fallback_stat(): stat(%s) failed; falling back on
lstat()\n", name);
      return fstatat(state.cwd_dir_fd, name, p, AT_SYMLINK_NOFOLLOW);

which is probably wrong for %Y.  Also the print.c code should probably check
for ENOTDIR in addition to ENOENT.

Furthermore, the "if we would normally follow links, do not do so" comment,
and subsequent attempt to use optionp_stat() if following_links(), seems to
contradict the documentation which just says "(like %y), plus follow
symlinks".  But that whole block is guarded by

            if (S_ISLNK (stat_buf->st_mode))

which won't be true except for broken links if following_links().

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?54262>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/


Reply via email to