public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
* fsck files w/relative paths
@ 2013-01-20 23:27 Mike Frysinger
  2013-01-25 15:17 ` Karel Zak
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Frysinger @ 2013-01-20 23:27 UTC (permalink / raw)
  To: util-linux-ng

[-- Attachment #1: Type: Text/Plain, Size: 1068 bytes --]

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 #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-01-25 19:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-20 23:27 fsck files w/relative paths Mike Frysinger
2013-01-25 15:17 ` Karel Zak
2013-01-25 17:02   ` Mike Frysinger
2013-01-25 17:36     ` Karel Zak
2013-01-25 19:55       ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox