findutils 20041227-1: problem with find -printf %n

Leonardo Vainsencher lev9@013.net
Wed Feb 23 20:43:00 GMT 2005


I would like to report that "find -printf %n" appends a spurious 'd' to the output produced.
This happens also for %G, %U, %b, %D, %k format directives.

Under Cygwin:
=========
% cygcheck -v -s | grep ^find
findutils 20041227-1
% for i in G U b D k n; do
    fmt="%12$i\t%f\n"
    echo \"$fmt\":
    find -maxdepth 1 -name Makefile -printf $fmt
done
"%12G\t%f\n":
         513d   Makefile
"%12U\t%f\n":
        1001d   Makefile
"%12b\t%f\n":
           6d   Makefile
"%12D\t%f\n":
  3371281718d   Makefile
"%12k\t%f\n":
           3d   Makefile
"%12n\t%f\n":
           1d   Makefile

Under Linux (%D removed):
=================
% for i in G U b k n; do
    fmt="%12$i\t%f\n"
    echo \"$fmt\":
    find -maxdepth 1 -name Makefile -printf $fmt
done
"%12G\t%f\n":
        1000    Makefile
"%12U\t%f\n":
        1000    Makefile
"%12b\t%f\n":
          40    Makefile
"%12k\t%f\n":
          20    Makefile
"%12n\t%f\n":
           1    Makefile

Looking at find/parser.c source (from findutils-20041227-1-src.tar.bz2) it appears
that a "break;" is missing at line 1777 in funcion
"static struct segment ** make_segment (struct segment **segment, char *format, int len, int kind)"

The result after adding the break statement:
===========================
% for i in G U b D k n; do
    fmt="%12$i\t%f\n"
    echo \"$fmt\":
    /usr/src/findutils-20041227-1/find/find -maxdepth 1 -name Makefile -printf $fmt
done
"%12G\t%f\n":
         513    Makefile
"%12U\t%f\n":
        1001    Makefile
"%12b\t%f\n":
           6    Makefile
"%12D\t%f\n":
  3371281718    Makefile
"%12k\t%f\n":
           3    Makefile
"%12n\t%f\n":
           1    Makefile

-- 
Leonardo Vainsencher
LEV9@013.net.il

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list