From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Subject: bug#25573: Adding btrfs support may break reconfigured system Date: Mon, 30 Jan 2017 10:41:49 +0100 Message-ID: <87sho0evfm.fsf@gnu.org> References: <87wpddzqsz.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39112) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cY8UN-00069J-5B for bug-guix@gnu.org; Mon, 30 Jan 2017 04:43:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cY8UI-0002Jq-C9 for bug-guix@gnu.org; Mon, 30 Jan 2017 04:43:07 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:52530) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cY8UI-0002Jc-8o for bug-guix@gnu.org; Mon, 30 Jan 2017 04:43:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cY8UI-0008Bt-39 for bug-guix@gnu.org; Mon, 30 Jan 2017 04:43:02 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87wpddzqsz.fsf@gmail.com> (Alex Kost's message of "Sun, 29 Jan 2017 21:03:56 +0300") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Alex Kost Cc: 25573@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, Alex Kost skribis: > Hello, recently I found that "guix system" makes a "broken" system for > me. When I boot a freshly created system, I get something like this: > > In procedure <...> at ./gnu/build/file-systems.scm:282:4 (device) > In procedure fport_seek: Invalid argument > > and I'm thrown at the Guile promt. I think this is due to =E2=80=98read-superblock=E2=80=99 trying to seek bey= ond the end of one of the devices that=E2=80=99s on your machine. Could you try the attached patch and see if it solves the problem? Thanks for reporting it! Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm index 6e5c6aaf1..f8ab95370 100644 --- a/gnu/build/file-systems.scm +++ b/gnu/build/file-systems.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright =C2=A9 2014, 2015, 2016 Ludovic Court=C3=A8s +;;; Copyright =C2=A9 2014, 2015, 2016, 2017 Ludovic Court=C3=A8s ;;; Copyright =C2=A9 2016, 2017 David Craven ;;; ;;; This file is part of GNU Guix. @@ -72,14 +72,25 @@ "Bind-mount SOURCE at TARGET." (mount source target "" MS_BIND)) =20 +(define (seek* fd/port offset whence) + "Like 'seek' but return -1 instead of throwing to 'system-error' upon +EINVAL. This makes it easier to catch cases like OFFSET being too large f= or +FD/PORT." + (catch 'system-error + (lambda () + (seek fd/port offset whence)) + (lambda args + (if (=3D EINVAL (system-error-errno args)) + -1 + (apply throw args))))) + (define (read-superblock device offset size magic?) "Read a superblock of SIZE from OFFSET and DEVICE. Return the raw superblock on success, and #f if no valid superblock was found. MAGIC? takes a bytevector and returns #t when it's a valid superblock." (call-with-input-file device (lambda (port) - (seek port offset SEEK_SET) - + (and (=3D offset (seek* port offset SEEK_SET)) (let ((block (make-bytevector size))) (match (get-bytevector-n! port block 0 (bytevector-length blo= ck)) ((? eof-object?) @@ -87,7 +98,7 @@ takes a bytevector and returns #t when it's a valid super= block." ((? number? len) (and (=3D len (bytevector-length block)) (and (magic? block) - block)))))))) + block))))))))) =20 (define (sub-bytevector bv start size) "Return a copy of the SIZE bytes of BV starting from offset START." --=-=-=--