List Info

Thread: incomplete documentation for sub-second time stamps in find -printf format specifiers




incomplete documentation for sub-second time stamps in find -printf format specifiers
user name
2008-03-18 14:19:38
URL:
  <http://savann
ah.gnu.org/bugs/?22662>

                 Summary: incomplete documentation for
sub-second time stamps
in find -printf format specifiers
                 Project: findutils
            Submitted by: None
            Submitted on: Tuesday 03/18/2008 at 19:19 UTC
                Category: find
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: blaz
        Originator Email: blaz.lorgertriera.net
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.3.9
           Fixed Release: None

    _______________________________________________________

Details:

I'm actually using find version 4.4.0, unfortunately it is
not yet available
in drop down box, so I selected version 4.3.9.

Since version 4.2 you have changed behaviour of format
specifiers for time.
For some (, S, +) this change is clearly documented in man and
info pages. 
But for others (T, X) this change is not documented.

Since output of %AX looks strange (08:12:22 PM.0056544350)
I'm also wondering
if this is a bug in code and not just incomplete
documentation.





    _______________________________________________________

Reply to this item at:

  <http://savann
ah.gnu.org/bugs/?22662>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





incomplete documentation for sub-second time stamps in find -printf format specifiers
user name
2008-03-19 15:40:40
Update of bug #22662 (project findutils):

             Assigned to:                    None => jay 
                  
                 Release:                   4.3.9 =>
4.4.0                  


    _______________________________________________________

Reply to this item at:

  <http://savann
ah.gnu.org/bugs/?22662>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





incomplete documentation for sub-second time stamps in find -printf format specifiers
user name
2008-03-21 10:29:17
Follow-up Comment #2, bug #22662 (project findutils):

My previous comment didn't address the "find
-printf" formats %a, %c, %t,
which also currently contain a fractional part in the
seconds field; I am not
proposing to change those.

    _______________________________________________________

Reply to this item at:

  <http://savann
ah.gnu.org/bugs/?22662>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





incomplete documentation for sub-second time stamps in find -printf format specifiers
user name
2008-03-21 10:24:10
Follow-up Comment #1, bug #22662 (project findutils):

Yes, the %AX problem is indeed a bug, and thanks for letting
us know about
it.

%AX uses the strftime format %X.  That yields the locale's
preferred time
representation:-

$ for locale in POSIX fr_FR.UTF-8  en_IE.UTF-8 en_US.UTF-8;
do printf "%-13s
[%s]n" "$locale" "$(LC_ALL=$locale  date
+%X)"; done
POSIX         [14:31:09]
fr_FR.UTF-8   [14:31:09]
en_IE.UTF-8   [14:31:09]
en_US.UTF-8   [02:31:09 PM]

It looks like the en_US.UTF-8 locale uses the %r format for
strftime's %X
format.  POSIX allows us to determine what format is being
used by calling
nl_langinfo():

$ LC_ALL=en_US.UTF-8 ./locale_time_formats 
POSIX locale:
D_T_FMT   : [%a %b %e %H:%M:%S %Y]
D_FMT     : [%m/%d/%y]
T_FMT     : [%H:%M:%S]
en_US.UTF-8 locale:
D_T_FMT   : [%a %d %b %Y %r %Z]
D_FMT     : [%m/%d/%Y]
T_FMT     : [%r]

On the other hand my locale has T_FMT=%T.   It should be
safe to append
nanoseconds for formats where T_FMT yields just %S (won't
happen), %T, or %s
(also won't happen), or where the format ends in %S.

If we know the locale is POSIX, we could manually translate
%r to 
 %I:%M:%S %p so that the %S expands correctly, and we can
probably do that in
all cases for %T.

However, there is another likely bug in the implementation. 
It hard-codes
the use of "." as the radix character instead of
using  the value of
RADIXCHAR.

However, these things would be hard to document.  How about
doing things this
way:

1. In the POSIX locale, the seconds field always includes a
fractional part,
for all formats.

2. In locales other than POSIX, the only fields for which
find will include
nanoseconds are %[ACT]S, %[ACT}+, %[ACT] and
%[ACT]T, and in those cases the
locale's radix character will separate the whole part and
the fractional part.
  In locales where the strftime formats %X and %T are
identical, this will
also happen for %[ACT]X.  (Here, "%[ACT]X" means
"%AX, %CX or %TX").

3. In other cases the seconds field may lack a fractional
part.

In terms of what will change with respect to 4.4.0:
a) No change in the POSIX locale
b) Change in behaviour of %AX, %CX, %TX for non-POSIX
locales.
c) Use of radix character where appropriate, versus
"." previously.

The upside of this approach is that it is relatively easy to
document and the
behavioural change is small.  

A down-side is that it makes it hard for scripts to consume
the output of
%[ACT]X.  On the other hand, that output is already hard to
consume since it
has a bug in the 4.4.0 release, and in any case it is
probably better to
specify "%AT %Ap" if that is what you actually
want, rather than "%AX".


    _______________________________________________________

Reply to this item at:

  <http://savann
ah.gnu.org/bugs/?22662>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





incomplete documentation for sub-second time stamps in find -printf format specifiers
country flaguser name
United States
2008-05-16 17:40:42
Follow-up Comment #3, bug #22662 (project findutils):

I believe that the attached patch fixes the problem. 


(file #15671)
    _______________________________________________________

Additional Item Attachment:

File name:
0001-Fix-Savannah-bug-22662-nanoseconds-appended-after.patch

Size:6 KB


    _______________________________________________________

Reply to this item at:

  <http://savann
ah.gnu.org/bugs/?22662>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )