delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/02/23/11:50:05

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Wed, 23 Feb 2005 18:49:32 +0200
From: Leonardo Vainsencher <lev9 AT 013 DOT net>
Subject: findutils 20041227-1: problem with find -printf %n
To: cygwin AT cygwin DOT com
Message-id: <200502231849.32463.lev9@013.net.il>
Organization: Home Office
MIME-version: 1.0
User-Agent: KMail/1.7.1

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 AT 013 DOT net DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019