bugfindutils - Bugs: bug #50859, fstype btrfs isn't supported

 
 

bug #50859: fstype btrfs isn't supported

Submitted by:  Tavian Barnes <tavianator>
Submitted on:  Sun 23 Apr 2017 02:44:50 PM UTC  
 
Category: findSeverity: 3 - Normal
Item Group: Wrong resultStatus: None
Privacy: PublicAssigned to: Bernhard Voelker <berny>
Originator Name: Open/Closed: Open
Release: 4.6.0Fixed Release: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun 23 Apr 2017 09:48:39 PM UTC, comment #2:

Ah okay, you're actually parsing the device number out of /proc/self/mountinfo? When I implemented -fstype for bfs, I didn't bother getting it from there, as it's not returned by getmntent(). I just stat() the mount point itself, which obviously works.

Tavian Barnes <tavianator>
Sun 23 Apr 2017 09:34:23 PM UTC, comment #1:

find(1) supports BTRFS like any other file system type: there
is nothing special implemented in the code. Instead, it looks
at the entries in "/proc/self/mountinfo" to find the device id.

Thus, "find -fstype btrfs" works ... as long as you search in
the root of an BTRFS file system: the underlying stat() system
call returns a different device number for BTRFS snaphots and
BTRFS subvolumes, and these can not be found in the above
mentioned mountinfo file:

$ stat -c "%d %n" /mnt /mnt/_subvol /mnt/.snapshot
38 /mnt
40 /mnt/_subvol
41 /mnt/.snapshot

See also https://savannah.gnu.org/bugs/?50326
Also other tools like "df -T" are not able to display the
file system type.

$ df --output=fstype,target /mnt /mnt/_subvol /mnt/.snapshot
Type Mounted on
btrfs /mnt
- /mnt/_subvol
- /mnt/.snapshot

Now, we could only add a workaround for this BTRFS - let's
call it - "anomaly" to find(1): if it doesn't find a file system
type for a given path, and the next one higher in the hierarchy
is a BTRFS, then it could assume that the current entry is on a
BTRFS snapshot or BTRFS subvolume.
I have such a hack in my local git tree, but didn't publish it
yet (as I usually do not use BTRFS at all, thus lacking tests).
What do others think about such a (hacky?) workaround?

Bernhard Voelker <berny>
Project MemberIn charge of this item.
Sun 23 Apr 2017 02:44:50 PM UTC, original submission:

On a btrfs file system, find -fstype btrfs doesn't find any files, and find -printf '%p %F\n' prints

. unknown
./.git unknown
./.git/refs unknown
...

Tavian Barnes <tavianator>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by berny (Posted a comment)
  • -unavailable- added by tavianator (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 23 Apr 2017 09:34:23 PM UTCbernyAssigned toNone=>berny

    Back to the top


    Powered by Savane 3.1-cleanup1