Bug 24673

Summary: support creating swap fs with labels
Product: udisks Reporter: Martin Pitt <martin.pitt>
Component: generalAssignee: David Zeuthen (not reading bugmail) <zeuthen>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: support creating swap fs with labels
support creating swap fs with labels
support creating swap fs with labels
support creating swap fs with labels

Description Martin Pitt 2009-10-22 00:44:33 UTC
When running my shiny new test suite [1], I noticed that the test case "create
swap fs with label" fails:

DBusException: org.freedesktop.DeviceKit.Disks.Error.Failed: Error creating file system: helper exited with exit code 1: option label=testswaptst not supported

mkswapfs supports labels just fine, so I wrote a trivial patch to add support
for it to FilesystemCreate().

Thanks for considering,

Martin

[1] http://people.canonical.com/~pitti/tmp/dk-disks-test.py
Comment 1 Martin Pitt 2009-10-22 00:44:38 UTC
Created attachment 30615 [details] [review]
support creating swap fs with labels

mkswapfs supports labels just fine, add support for it to FilesystemCreate().
Comment 2 Martin Pitt 2009-10-22 00:48:03 UTC
Hm, since I'll have a couple of more of those, I filed this with git-bz [1]. Very convenient thing indeed (you might like "git bz apply 24673" :-) ).

However, that doesn't put the "Bug XXXXX - ..." into the subject line, but instead adds a reference to the commit log. Is that okay with you, or should I go back to opening bugs and creating attachments manually?

[1] http://git.fishsoup.net/man/git-bz.html
Comment 3 David Zeuthen (not reading bugmail) 2009-10-22 09:37:54 UTC
(In reply to comment #2)
> Hm, since I'll have a couple of more of those, I filed this with git-bz [1].
> Very convenient thing indeed (you might like "git bz apply 24673" :-) ).
> 
> However, that doesn't put the "Bug XXXXX - ..." into the subject line, but
> instead adds a reference to the commit log. Is that okay with you, or should I
> go back to opening bugs and creating attachments manually?
> 
> [1] http://git.fishsoup.net/man/git-bz.html
> 

It would be nice to use git-bz. I just talked to Owen in the office and he said that that the man page mentioned this. Seems like

 git config bz.add-url-method "subject-prepend:Bug %d – "

should work but it doesn't do that for me on the client end. Probably a git-bz(1) bug because the attachment already has a Subject line.

Anyway, maybe try adding that git-bz configuration bit and attach the patch with git-bz again? (have to mark the old patch as invalid)
Comment 4 Martin Pitt 2009-10-22 09:54:51 UTC
Created attachment 30626 [details] [review]
support creating swap fs with labels

mkswapfs supports labels just fine, add support for it to FilesystemCreate().
Comment 5 Martin Pitt 2009-10-22 09:55:40 UTC
Hah, at least it did something. It now crashes with "httplib.BadStatusLine".

However, when I replace the fancy dash with an ASCII one, it doesn't prepend the "Bug - " at all. Hmm.
Comment 6 Owen Taylor 2009-10-22 09:58:30 UTC
git-bz only adds a new bug reference if it doesn't already find the bug # in
the bug subject or body.

Don't know about the BadStatusLine - there have been reported problems with nonascii commit messages, but not of that form.

(Bug reporting for git-bz is mail to otaylor@fishoup.net)
Comment 7 Martin Pitt 2009-10-22 09:59:55 UTC
Created attachment 30627 [details] [review]
support creating swap fs with labels

Hm, nevermind for now. Correctly formatted patch with the plain old manual method. :-)
Comment 8 David Zeuthen (not reading bugmail) 2009-10-22 11:00:54 UTC
(In reply to comment #7)
> Created an attachment (id=30627) [details]
> support creating swap fs with labels
> 
> Hm, nevermind for now. Correctly formatted patch with the plain old manual
> method. :-)
> 

OK, probably want changes in known_file_systems[] in src/devkit-disks-daemon.c for swap. And also support in src/job-filesystem-change-label.c. With this, creating swap/changing label should work out of the box with Palimpsest.
Comment 9 Martin Pitt 2009-10-22 14:44:50 UTC
Created attachment 30633 [details] [review]
support creating swap fs with labels

Thanks for pointing this out. I updated the test suite to check KnownFileSystems and the "supports labels" flag (which catches this omission), and updated the patch to mark labels as supported for swap.

I actually looked around for a program/howto to change labels on a swap partition, but didn't find one. So I guess there are two options:

 - Implement it ourself (should be a simple binary open/replace, I guess).

 - Call mkswap -L again. This would work for real swap partitions, but destroys the entire content (not verified), and thus potentially hibernation images?

I left out label renaming support for now, so that this patch is consistent now.
Comment 10 David Zeuthen (not reading bugmail) 2009-10-24 08:29:04 UTC
(In reply to comment #9)
> Created an attachment (id=30633) [details]
> support creating swap fs with labels
> 
> Thanks for pointing this out. I updated the test suite to check
> KnownFileSystems and the "supports labels" flag (which catches this omission),
> and updated the patch to mark labels as supported for swap.

Cool, thanks. Applied the patch.

(Minor nit - the text after " — " should start with a capital letter so I fixed that.)

> I actually looked around for a program/howto to change labels on a swap
> partition, but didn't find one. So I guess there are two options:
> 
>  - Implement it ourself (should be a simple binary open/replace, I guess).
> 
>  - Call mkswap -L again. This would work for real swap partitions, but destroys
> the entire content (not verified), and thus potentially hibernation images?
> 
> I left out label renaming support for now, so that this patch is consistent
> now.

Sounds good to me. Would be good to ask Karel about a tool in util-linux-ng to rename the label of a swap volume. Is there a bug tracker for u-l-ng?
Comment 11 Martin Pitt 2009-10-24 13:33:12 UTC
Thanks.

Scott and http://userweb.kernel.org/~kzak/util-linux-ng/ say to send bugs to the ML, so I sent a mail there about changing labels for swap. (I'm not subscribed, I hope it will get through).

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.