fsck files w/relative paths

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



if i create a dummy local fs in a file:
$ dd if=/dev/zero of=foo count=1 seek=1000
$ mke2fs -F foo

now trying to run fsck on it:
$ fsck ./foo
fsck from util-linux 2.22.2
Usage: fsck.ext4 [-panyrcdfvtDFV] [-b superblock] [-B blocksize]
                [-I inode_buffer_blocks] [-P process_inode_size]
                [-l|-L bad_blocks_file] [-C fd] [-j external_journal]
                [-E extended-options] device

that's weird ...

running it through strace shows it behaves as if no args were provided 
(num_devices=0), so it looks up my rootfs details, and then runs fsck:
[pid 28095] execve("/sbin/fsck.ext4", ["fsck.ext4", "./foo", "/dev/sdd2"], [/* 
69 vars */]) = 0

reading the code, it expects files to have absolute paths.  so running:
$ fsck $PWD/foo
works just fine

we could tweak parse_argv() so that it checks for argv[0] == '.' in addition 
to argv[0] == '/'.  but that wouldn't fix other relative paths like:
$ fsck images/foo
$ fsck foo

should we treat all non-options as devices ?  would that break anything ?
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux