bugfindutils - Bugs: bug #15036, find's %M format arg is...

 
 

bug #15036: find's %M format arg is undocumented

Submitter:  Lenny Foner <foner>
Submitted:  Tue 22 Nov 2005 08:37:16 PM UTC
   
 
Category:  find Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  jay
Originator Name:  Open/Closed:  Closed
Release:  4.2.26 Fixed Release:  4.2.27
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 23 Nov 2005 06:25:44 AM UTC, comment #2: 

bug #10537 covers the need for more format directives, and so this bug can be marked as fixed.

James Youngman <jay>
Group administrator
Wed 23 Nov 2005 06:23:24 AM UTC, comment #1: 

I have now documented %M.  The documentation change will be incorporated in the next releases of findutils-4.2.x and findutils-4.3.x. 

Please do submit the enhancement request as a separate item, because I'd like to close this report in order to indicate that the "%M format arg is undocumented" problem itself has been fixed.

Off the top of my head, the other thing that makes it difficult to emulate -ls with -printf is the fact that there is no way to make it indicate the target of a symbolic link:

~$ rm -f foo bar; ln -s foo bar; find bar -ls
165262    0 lrwxrwxrwx   1 jay      jay             3 Nov 22 22:17 bar -> foo

So we'd need something that expands to " -> foo" if a file is a symbolic link, and to nothing otherwise.

We're running out of letters for format directives.  I'm toying with the idea of supporting %{word} format directives, but the idea is vague as yet.  Please phrase your new support request in terms of what you'd like the new directives to expand to, don't worry for the moment about what we'll call them.

The attraction of %{foo} is that maybe we could also consider %{foo%%.jpg} and %{bar:-baz}, not to mention '-exec% foo %{ugh} ;'.   Of course, the countervailing argument is that this would be a 10% increase in the size of the code (to pluck a number from thin air) for the convenience of 1% of the users.

Thanks,
James.

James Youngman <jay>
Group administrator
Tue 22 Nov 2005 08:37:16 PM UTC, original submission:  

When using find -printf, the %M format arg (which prints mode information in symbolic form) is completely undocumented, both in the manpage and in the Info nodes.  I guessed that it might be there by analogy with %g/%G and %u/%U, and I'm very glad it was, because a script I was using would have had to have been rewritten if it wasn't.  But it should be documented in both places.  Thanks!  (Later versions of the Info mention %M when talking about escaping unusual characters, but don't actually mention it where it might actually be invoked, namely on the page talking about %u/%U etc.)

(I was doing this in the first place because I was trying to emulate find -ls but with owner/group written numerically; this is essential when trying to compare output across machines which map uid/gid differently.  It would be really, really nice if -ls had some sort of modifier that made it possible to get this information in numeric form, without having to hand-craft a format string; I note that such hand-crafting might even be impossible, since it's not clear to me how to get file-time outputs that are identical with -ls's behavior given the format directives available---%t adds day-of-week and seconds, while %T and various modifiers don't appear to make it possible to switch formats between month-day-hour and month-day-year depending on the age of the file as -ls and the ls program do.  To really do this transparently might require invoking find -twice-, using two different format strings and filtering based on the files' ages.  Yucko.  Yet it would obviously be a trivial change to the -ls logic, assuming some agreement over how to name the option that invokes it, or a new directive could be added for printf so that it's possible to exactly emulate -ls -or- to tweak certain fields as I had to do.  I'll refile this paragraph as a feature request as well so these can be independently tracked.)

Lenny Foner <foner>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.

 

Follow 5 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2005-12-06 jay Open/ClosedOpen Closed
    Fixed ReleaseNone 4.2.27
2005-11-23 jay StatusNone Fixed
2005-11-23 jay Assigned toNone jay
2005-11-22 foner Carbon-Copy- Added foner

Back to the top

Powered by Savane 3.13-d3ae.
Corresponding source code