Bug 24718 - Proper handling of missing mkfs.*/fsck.*
Summary: Proper handling of missing mkfs.*/fsck.*
Status: RESOLVED WORKSFORME
Alias: None
Product: udisks
Classification: Unclassified
Component: operations (show other bugs)
Version: unspecified
Hardware: Other All
: medium minor
Assignee: David Zeuthen (not reading bugmail)
QA Contact:
URL:
Whiteboard:
Keywords:
: 20800 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-10-25 02:37 UTC by Martin Pitt
Modified: 2012-09-28 15:17 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
first patch attempt (8.49 KB, patch)
2009-10-28 07:33 UTC, Martin Pitt
Details | Splinter Review

Description Martin Pitt 2009-10-25 02:37:05 UTC
Side issue in bug 24679: There are cases where mkfs.* tools are not available. For example, you might not have xfsprogs installed, or Fedora's util-linux-ng package does not build the minix tools. In this case, DK-D should not have can_create/can_mount in KnownFilesystems.
Comment 1 David Zeuthen (not reading bugmail) 2009-10-25 08:55:41 UTC
(In reply to comment #0)
> Side issue in bug 24679: There are cases where mkfs.* tools are not available.
> For example, you might not have xfsprogs installed, or Fedora's util-linux-ng
> package does not build the minix tools. In this case, DK-D should not have
> can_create/can_mount in KnownFilesystems.

Having can_create/can_mount entries in the structs that are returned in the array of the KnownFilesystems property would mean that we'd need to check for availability of the tools/driver on every access. Also, properties are supposed to (in the future anyway), to emit a signal (PropertiesChanged() on org.fd.DBus.Properties) so, strictly, we'd need to listen for changes as well.

This would include using inotify (through GFileMonitor) to listen for e.g. /sbin/mkfs.xfs. It's slightly more complicated because we'd need to search $PATH since we can't assume it's in /sbin/...

Instead we should introduce new two errors

 org.freedesktop.DeviceKit.Disks.Error.FilesystemDriverMissing
 org.freedesktop.DeviceKit.Disks.Error.FilesystemToolsMissing

that can be thrown in FilesystemMount() resp. FilesystemCreate()/PartitionCreate()/etc when appropriate.

We should also introduce methods on the org.freedesktop.DeviceKit.Disks interface (the manager interface)

 CheckFilesystemDriver (IN String filesystem_id, OUT Bool is_supported);
 CheckFilesystemTools (IN String filesystem_id, OUT Bool is_supported);

so clients can proactively check for stuff if, and only if, they want.

We could also split Tools into a more fine-grained set of operations, like GParted does, e.g.

 http://people.freedesktop.org/~david/gparted-fs-support.png

but I don't think that's useful (and we already convey this kind of information in the KnownFilesystems property).
Comment 2 Martin Pitt 2009-10-28 07:33:44 UTC
Created attachment 30774 [details] [review]
first patch attempt

I updated the test suite to check for these new exceptions if mkfs.* or the kernel module is missing. Tested with uninstalling xfsprogs and moving away xfs.ko, and the tests fail due to the unexpected exception.

With the attached patch DK-D now throws the exceptions you suggested, and the tests pass.

Unfortunately this is hard to automate for testing. Originally I planned to at least test the "missing mkfs" bits automatically by re-starting the daemon with an empty $PATH; but since the daemon sets its own path, this does not work. I don't want to mv system files away temporarily in the test suite. So the suite needs to be run with those changes being done manually.

NB that this patch does not yet handle a missing cryptsetup, since that fails directly in job_new() with

  DBusException: org.freedesktop.DeviceKit.Disks.Error.Failed: Error starting job: Failed to execute child process "cryptsetup" (No such file or directory)

It might be prudent to just generally throw an ERROR_TOOLS_MISSING error there instead of a general ERROR_FAILED. This would be slightly confusing for the pathological case of having a wrong or incomplete helper dir, but since that's set at build time it might not be that important. What do you think?
Comment 3 Martin Pitt 2009-10-28 07:34:52 UTC
The patch does not yet add the new CheckFilesystem{Tools,Driver} methods. These require some code reorganization to avoid redundancy. I can look into this later.
Comment 4 David Zeuthen (not reading bugmail) 2009-11-02 09:34:12 UTC
Comment on attachment 30774 [details] [review]
first patch attempt

Committed the patch, thanks (no flag to set it as 'committed' so setting it 'obsolete' for now).

I did the gnome-disk-utility bits to use this in the new-ui branch, see

http://git.gnome.org/cgit/gnome-disk-utility/commit/?h=new-ui&id=86538c45143e32e5e42abd20807826266fa22084
Comment 5 Martin Pitt 2009-11-11 06:37:58 UTC
*** Bug 20800 has been marked as a duplicate of this bug. ***
Comment 6 David Zeuthen (not reading bugmail) 2012-09-28 15:17:43 UTC
We no longer have KnownFilesystems partly because the GUI in Disks now is much saner, e.g.

 http://people.freedesktop.org/~david/palimpsest2-2012-03/09-palimpsest2-format-type.png

instead of the long list of cryptic filesystems we had in Palimpsest.

I don't think we need to bring back KnownFilesystems so closing.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.