Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for findmnt #210

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Add support for findmnt #210

wants to merge 2 commits into from

Conversation

Harshit933
Copy link
Contributor

@Harshit933 Harshit933 commented Feb 2, 2025

For now the output of findmnt is:

[harshit:~/dev/util-linux (findmnt|✔)] target/debug/util-linux findmnt
 target                                     source          fstype       options                                                                                               
 /                                          /dev/nvme0n1p7  ext4         rw,relatime                                                                                           
 /proc                                      proc            proc         rw,nosuid,nodev,noexec,relatime                                                                       
 /proc/sys/fs/binfmt_misc                   systemd-1       autofs       rw,relatime,fd=41,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=6207                         
 /proc/sys/fs/binfmt_misc                   binfmt_misc     binfmt_misc  rw,nosuid,nodev,noexec,relatime                                                                       
 /sys                                       sys             sysfs        rw,nosuid,nodev,noexec,relatime                                                                       
 /sys/firmware/efi/efivars                  efivarfs        efivarfs     rw,nosuid,nodev,noexec,relatime                                                                       
 /sys/kernel/security                       securityfs      securityfs   rw,nosuid,nodev,noexec,relatime                                                                       
 /sys/fs/cgroup                             cgroup2         cgroup2      rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot                                       
 /sys/fs/pstore                             pstore          pstore       rw,nosuid,nodev,noexec,relatime                                                                       
 /sys/fs/bpf                                bpf             bpf          rw,nosuid,nodev,noexec,relatime,mode=700                                                              
 /sys/kernel/tracing                        tracefs         tracefs      rw,nosuid,nodev,noexec,relatime                                                                       
 /sys/kernel/debug                          debugfs         debugfs      rw,nosuid,nodev,noexec,relatime                                                                       
 /sys/fs/fuse/connections                   fusectl         fusectl      rw,nosuid,nodev,noexec,relatime                                                                       
 /sys/kernel/config                         configfs        configfs     rw,nosuid,nodev,noexec,relatime                                                                       
 /dev                                       dev             devtmpfs     rw,nosuid,relatime,size=8027368k,nr_inodes=2006842,mode=755,inode64                                   
 /dev/shm                                   tmpfs           tmpfs        rw,nosuid,nodev,inode64                                                                               
 /dev/pts                                   devpts          devpts       rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000                                                 
 /dev/hugepages                             hugetlbfs       hugetlbfs    rw,nosuid,nodev,relatime,pagesize=2M                                                                  
 /dev/mqueue                                mqueue          mqueue       rw,nosuid,nodev,noexec,relatime                                                                       
 /run                                       run             tmpfs        rw,nosuid,nodev,relatime,mode=755,inode64                                                             
 /run/credentials/systemd-journald.service  tmpfs           tmpfs        ro,nosuid,nodev,noexec,relatime,nosymfollow,size=1024k,nr_inodes=1024,mode=700,inode64,noswap         
 /run/user/1000                             tmpfs           tmpfs        rw,nosuid,nodev,relatime,size=1612004k,nr_inodes=403001,mode=700,uid=1000,gid=1000,inode64            
 /run/user/1000/doc                         portal          fuse.portal  rw,nosuid,nodev,relatime,user_id=1000,group_id=1000                                                   
 /tmp                                       tmpfs           tmpfs        rw,nosuid,nodev,nr_inodes=1048576,inode64                                                             
 /boot                                      /dev/nvme0n1p6  vfat         rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro

Potential fix #23

@cakebaker
Copy link
Contributor

Can you please run cargo clippy? The CI shows some clippy errors. Plus the test fails on macOS because there's no /proc on macOS as far as I know.

@Harshit933 Harshit933 force-pushed the findmnt branch 2 times, most recently from 01071f2 to 2977baa Compare February 8, 2025 06:39
@Harshit933
Copy link
Contributor Author

Harshit933 commented Feb 8, 2025

Plus the test fails on macOS because there's no /proc on macOS as far as I know.

Yup. I guess that is the case. I'll feature gate this on linux only

error: test failed, to rerun pass `--test tests`
run: /Users/runner/work/util-linux/util-linux/target/debug/util-linux findmnt
thread 'test_findmnt::test_findmnt' panicked at tests/by-util/test_findmnt.rs:5:17:
Command was expected to succeed. Exit code: 101.
stdout = 
 stderr = thread 'main' panicked at src/uu/findmnt/src/findmnt.rs:43:54:
called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@sylvestre
Copy link
Contributor

Yup. I guess that is the case. I'll feature gate this on linux only

there might be crate or equivalent for mac/unix. Maybe have a look before making this linux specific

@Harshit933
Copy link
Contributor Author

@sylvestre I see there are some alternatives present inside macOS like the mount and diskutil commands. But shouldn't they be implemented differently from the findmnt one? I am a bit confused here on what do I need to do further.

@cakebaker cakebaker mentioned this pull request Feb 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement program findmnt
3 participants