bugfindutils - Bugs: bug #59766, printf %i doesn't show same result...

 
 

bug #59766: printf %i doesn't show same result in all situations

Submitter:  None
Submitted:  Sat 26 Dec 2020 04:19:42 PM UTC
   
 
Category:  find Severity:  3 - Normal
Item Group:  Wrong result Status:  None
Privacy:  Public Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  Open Release:  4.7.0
Fixed Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 27 Dec 2020 12:57:43 PM UTC, comment #3: 

well I've guessed, that this may a performance-problem, if stat() is called every time, so I would be completely satisfied with a new option, which let me force stat()-calls in certain situations.

Anonymous
Sat 26 Dec 2020 08:30:17 PM UTC, comment #2: 

I've noticed this before too: https://savannah.gnu.org/bugs/?54913#comment5

The problem is, d_type and d_ino will be wrong for bind mounts.  This is a known bug (even a POSIX violation for d_ino), but with little interest in fixing it from the kernel side: https://www.spinics.net/lists/linux-fsdevel/msg139630.html

It's expensive to stat() every file, so a workaround would be preferable.  In bfs I only stat() files whose name matches a mount point (discovered by reading /proc/self/mounts), although bfs never trusts d_ino: https://github.com/tavianator/bfs/blob/038579b8fd9b96a207cb45e0adf113e881d8ff8d/bftw.c#L961-L971

Tavian Barnes <tavianator>
Sat 26 Dec 2020 04:30:04 PM UTC, comment #1: 

addon:

find -inum ###

also uses the inodes from getdent() for comparison...

this also should be checked against the inodes from stat()

Anonymous
Sat 26 Dec 2020 04:19:42 PM UTC, original submission:  

in linux the ip-tool for example mounts pseudo-files from /proc over normal files in /run/netns/... for giving a net-namespace a name.

you can achieve similar by doing following:
touch /tmp/foo
mount --bind /proc/1/ns/net /tmp/foo

(there are further relevant use-cases for such mounts)

using `find /run/netns/ "%f %i\n"` prints the inodes of the underlaying normal files instead of those of the pseudo-files, because it uses the inode-numbers from the getdent()-call.

using "-ls" as find-option or any other additional property, which need a stat()-call leads to the expected inode of the pseudo-files...

at least the output should be the same with any combination of options.

if you decide to prefer the normal inodes should alaways be shown, you should add an option to get the inodes from possibly mounted files without the need to know a property in advance (those /proc-files always have size 0, so a "-size 0" helps me at the moment)

Anonymous

 

(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

 

Carbon-Copy List
  • -email is unavailable- added by tavianator (Posted a comment)
  •  

    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.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code