*Synopsis*: /usr/bin/printf does not recognize positional arguments like %n$

Due to a change requested by <User 1-7MTUEB>,
<None> is now the responsible engineer for:

CR 6631969 changed on Jan 6 2010 by <User 1-7MTUEB>

=== Field ============ === New Value ============= === Old Value =============

Hook 5                                             <email address omitted>    
Keyword                                            oss-sponsor                
Responsible Engineer                               <User 1-7MTUEB>            
====================== =========================== ===========================

     
*Change Request ID*: 6631969

*Synopsis*: /usr/bin/printf does not recognize positional arguments like %n$

  Product: solaris
  Category: utility
  Subcategory: shell
  Type: Defect
  Subtype: 
  Status: 3-Accepted
  Substatus: 
  Priority: 3-Medium
  Introduced In Release: 
  Introduced In Build: 
  Responsible Engineer: 
  Keywords: opensolaris, oss-request

=== *Description* ============================================================
Category
   utility
Sub-Category
   other
Description
   /usr/bin/printf does not recognize positional arguments. printf(3c) says:
-- snip --
Conversions can be applied to the  nth  argument  after  the
format  in the argument list, rather than to the next unused
argument. In this case,  the  conversion  specifier  %  (see
below) is replaced by the sequence %n$, where n is a decimal
integer in the range [1, NL_ARGMAX], giving the position  of
the argument in the argument list. This feature provides for
the definition of format strings that select arguments in an
order  appropriate  to  specific languages (see the EXAMPLES
section).
-- snip --
However an attempt to use this feature with /usr/bin/printf results in 
gibberish:
$ /usr/bin/printf "%2\$x %1\$d\n" 14 2
ffbffcd7 -4195116
ksh -c 'printf "%2\$x %1\$d\n" 14 2'
Frequency
   Always
Regression
   No
Steps to Reproduce
   Run  /usr/bin/printf like this:
$ /usr/bin/printf "%2\$x %1\$d\n" 14 2
Expected Result
   The arguments "14" and "2" printed in reverse order:
-- snip --
2 14
-- snip --
Actual Result
   Some hexadecimal numbers which look completely unrelated to the input 
arguments:
-- snip --
ffbffcd7 -4195116
-- snip --
Error Message(s)
   -
Test Case
   See above.
Workaround
   Use ksh93's "printf" builtin, e.g.
-- snip --
$ ksh93 -c 'printf "%2\$x %1\$d\n" 14 2'
2 14
-- snip --
Submitter wants to work on bug
   Yes
Additional configuration information
   Solaris 11/B72

*** (#1 of 1): 2007-11-20 01:42:32 GMT+00:00 <User 1-F4SZV>


=== *Public Comments* ========================================================

=== *Workaround* =============================================================

=== *Additional Details* =====================================================
        Targeted Release: 
        Commit To Fix In Build: 
        Fixed In Build: 
        Integrated In Build: 
        Verified In Build: 
  See Also: 6619428, 6649911
  Duplicate of: 
  Hooks:
        Hook1: 
        Hook2: 
        Hook3: 
        Hook4: 
        Hook5: 
        Hook6: <email address omitted>
  Program Management: 
  Root Cause: 
  Fix Affects Documentation: No
  Fix Affects Localization: No

=== *History* ================================================================
        Date Submitted: 2007-11-20 01:42:31 GMT+00:00
        Submitted By: <User 1-F4SZV>

        Status Changed    Date Updated                  Updated By
        3-Accepted        2009-02-24 13:54:53 GMT+00:00 <User 1-1SURPB>


=== *Service Request* ========================================================
        Impact: Limited
        Functionality: Nonessential
        Severity: 5
        Product Name: solaris
        Product Release: solaris_nevada
        Product Build: snv_72
        Operating System: solaris_nevada
        Hardware: generic
        Submitted Date: 2007-11-20 01:42:32 GMT+00:00


=== *Multiple Release (MR) Cluster* - 0 ======================================

Reply via email to