Merge lp://staging/~cezary0/cryptsetup/bugfix474258_refactored into lp://staging/~ubuntu-core-dev/cryptsetup/ubuntu

Proposed by Cezary Baginski
Status: Rejected
Rejected by: Steve Langasek
Proposed branch: lp://staging/~cezary0/cryptsetup/bugfix474258_refactored
Merge into: lp://staging/~ubuntu-core-dev/cryptsetup/ubuntu
Diff against target: 401 lines (+231/-76)
2 files modified
debian/cryptdisks.functions (+124/-76)
debian/test_cryptdisk.sh (+107/-0)
To merge this branch: bzr merge lp://staging/~cezary0/cryptsetup/bugfix474258_refactored
Reviewer Review Type Date Requested Status
Surbhi Palande Pending
Steve Langasek Pending
Review via email: mp+91775@code.staging.launchpad.net

Description of the change

I refactored the code for clarity and fixed the error in the condition:

  if ! pre_out=$("$PRECHECK" "$src" 2> /dev/null) && \
            [ "$MAKESWAP" != "yes" ] && \
            ! /lib/cryptsetup/checks/blkid "$src" swap >/dev/null; then
                 log_warning_msg "$dst: the precheck for '$src' failed: $pre_out"

The error was introduced here (Debian):

   http://anonscm.debian.org/viewvc/pkg-cryptsetup/cryptsetup/trunk/debian/cryptdisks.functions?r1=384&r2=388

in short the current bad condition:

  if has_a_filesystem and ! for_cryptswap and ! swap -> then fail

should have been:

  if has_a_filesystem and !( for_cryptswap and swap) -> then fail

I made other changes based on feedback here:

   https://code.launchpad.net/~cezary0/cryptsetup/bugfix474258/+merge/91560

and I created a small test suite to test the changes and refactored code. During this, I found a similar bug/condition for the encrypted tmp handling - and fixed it too.

The tests are messy but useful and can easily be extended to cover more edge cases.

To post a comment you must log in.
Revision history for this message
Steve Langasek (vorlon) wrote :

This merge request has been superseded by an unrelated solution which appears to have been uploaded to Ubuntu:

cryptsetup (2:1.4.1-2ubuntu2) precise; urgency=low

  * Split up package in cryptsetup and cryptsetup-bin. (LP: #343363).
  * Do not overwrite existing filesystems when creating swap (LP: #474258).
  * Add aesni module when we have hardware encryption.

 -- Jean-Louis Dupond <email address hidden> Mon, 12 Mar 2012 10:14:30 +0100

Please check whether this solves the problem for you, and if not, please propose an updated patch.

Unmerged revisions

176. By Cezary Baginski

debian/cryptdisks.functions: minor refactoring and prevent destroying valid
  filesystems (LP:#474258)

  debian/test_cryptdisk.sh: minimalistic test suite for the above

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: