[PATCH] build: Allow mounting of entire disks.

  • Done
  • quality assurance status badge
Details
2 participants
  • Danny Milosavljevic
  • Ludovic Courtès
Owner
unassigned
Submitted by
Danny Milosavljevic
Severity
normal

Debbugs page

Danny Milosavljevic wrote 8 years ago
(address . guix-patches@gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20170714083215.9889-1-dannym@scratchpost.org
* gnu/build/file-systems.scm (disk-partitions): Also return entire drives.
---
gnu/build/file-systems.scm | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

Toggle diff (24 lines)
diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index b6930497d..462ed9b7f 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -377,11 +377,14 @@ not valid header was found."
(string-ref str (- (string-length str) 1)))
(define (partition? name major minor)
- ;; Select device names that end in a digit, like libblkid's 'probe_all'
- ;; function does. Checking for "/sys/dev/block/MAJOR:MINOR/partition"
- ;; doesn't work for partitions coming from mapped devices.
- (and (char-set-contains? char-set:digit (last-character name))
- (> major 2))) ;ignore RAM disks and floppy disks
+ ;; grub-mkrescue does some funny things for EFI support which
+ ;; makes it a lot more difficult than one would expect to support
+ ;; booting an ISO-9660 image from an USB flash drive.
+ ;; For example there's a buggy (too small) hidden partition in it
+ ;; which Linux rightfully refuses to mount.
+ ;; In any case, partition tables are supposed to be optional so
+ ;; here we allow checking entire disks for file systems, too.
+ (> major 2)) ;ignore RAM disks and floppy disks
(call-with-input-file "/proc/partitions"
(lambda (port)
Ludovic Courtès wrote 8 years ago
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 27690@debbugs.gnu.org)
87a843cszq.fsf@gnu.org
Hello,

Danny Milosavljevic <dannym@scratchpost.org> skribis:

Toggle quote (2 lines)
> * gnu/build/file-systems.scm (disk-partitions): Also return entire drives.

In the subject line, please write “file-systems:” instead of “build:”
(the latter is for Makefile and configury.)

Toggle quote (20 lines)
> --- a/gnu/build/file-systems.scm
> +++ b/gnu/build/file-systems.scm
> @@ -377,11 +377,14 @@ not valid header was found."
> (string-ref str (- (string-length str) 1)))
>
> (define (partition? name major minor)
> - ;; Select device names that end in a digit, like libblkid's 'probe_all'
> - ;; function does. Checking for "/sys/dev/block/MAJOR:MINOR/partition"
> - ;; doesn't work for partitions coming from mapped devices.
> - (and (char-set-contains? char-set:digit (last-character name))
> - (> major 2))) ;ignore RAM disks and floppy disks
> + ;; grub-mkrescue does some funny things for EFI support which
> + ;; makes it a lot more difficult than one would expect to support
> + ;; booting an ISO-9660 image from an USB flash drive.
> + ;; For example there's a buggy (too small) hidden partition in it
> + ;; which Linux rightfully refuses to mount.
> + ;; In any case, partition tables are supposed to be optional so
> + ;; here we allow checking entire disks for file systems, too.
> + (> major 2)) ;ignore RAM disks and floppy disks

I think you can remove ‘last-character’ and keep the comment about
/sys/dev/block.

Have you tested that this doesn’t cause any problems on actual hardware,
like matching things that should really be skipped, and then causing
failures down the road in label/UUID code?

Also, it seems that we’d be departing from what libblkid is doing, per
the comment above. To me that raises a flag, though if we really need
it that’s fine of course.

Thoughts? :-)

Thanks,
Ludo’.
Ludovic Courtès wrote 8 years ago
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 27690-done@debbugs.gnu.org)
87shg1qnzv.fsf@gnu.org
This was pushed as 9833bcfc08ef009b9e8b4398baa481ef65c80ad7, closing!

Ludo’.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 27690@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 27690
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help