[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dos filesystem check
From: |
Richard Hirst |
Subject: |
Re: dos filesystem check |
Date: |
Mon, 25 Mar 2002 11:52:07 +0000 |
User-agent: |
Mutt/1.3.24i |
On Sat, Mar 23, 2002 at 10:15:36AM +1100, Andrew Clausen wrote:
> Definitely a bug in mkdosfs... MS s/w might corrupt/misinterpret
> the mkdosfs file system.
So parted should not ignore it in script mode, as it does now?
> > Also, having decided there is a bug, parted really shouldn't exit with
> > code 0.
>
> Weird... it should! Could you please debug this? I can't reproduce
> (easily). If it's too much trouble for you, I can investigate.
I asume you mean it shouldn't exit with code 0...
I can't reproduce the "you have found a bug" problem atm, will
investigate if/when I can (but see likely explanation below).
Looking at exit codes in general though, still on parted 1.4:
parted/parted.c:_init()
3 of the "goto error" should be "goto error_done_ui", I think.
parted/parted.c:main()
"if (!dev)" needs to return non-zero so if you pass a bad device
name to parted in a script, the script can tell.
When an exception is thrown for my partition size / filesystem size
mismatch, it has Ignore and Cancel options.
For script mode parted/ui.c:exception_handler() will return
PED_EXCEPTION_UNHANDLED. fat_boot_sector_analyse() will see that the
geom is bigger than the filesystem and decide it isn't a problem.
Hence the exit code of 0. Guess that might be ok; seems a bit odd to
issue a warning and then ignore it anyway in script mode.
Now that I'm not getting the "you found a bug", I get a further
warning on this FAT fs which was created with mkdosfs:
address@hidden:/build/parted/parted-1.4.24.ori# parted -s /dev/sdc check 1
Warning: Partition size (64197 sectors) and filesystem size (64196 sectors) do
not match.
Warning: File system doesn't have expected sizes for Windows to like it.
Cluster size is 2k (0k expected); number of clusters is 16009 (63666 expected);
size of FATs is 63 sectors (249 expected).
address@hidden:/build/parted/parted-1.4.24.ori# echo $?
0
Note "(0k expected)", and again a return code of 0.
In this case the return certainly shouldn't be 0, as the exception
wasn't handled. This is because parted/parted.c:do_check() ignores the
return code from ped_file_system_check() and always returns success.
As for the return of zero when an EXCEPTION_BUG is reported, it was
thrown by fat_check() in this case, so if do_check() had checked the
return code, I would have got the non-zero exit code I expected.
Richard