From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id D9EDF138247 for ; Mon, 13 Jan 2014 23:24:06 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C0756E0B84; Mon, 13 Jan 2014 23:24:04 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 1BB1BE0B82 for ; Mon, 13 Jan 2014 23:24:04 +0000 (UTC) Received: from vapier.localnet (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 5232E33F708; Mon, 13 Jan 2014 23:24:03 +0000 (UTC) From: Mike Frysinger Organization: wh0rd.org To: gentoo-portage-dev@lists.gentoo.org Subject: Re: [gentoo-portage-dev] [PATCH] Check for and report read-only filesystems Date: Mon, 13 Jan 2014 18:24:06 -0500 User-Agent: KMail/1.13.7 (Linux/3.12.1; KDE/4.6.5; x86_64; ; ) Cc: Chris Reffett References: <52D0B588.4010506@gentoo.org> In-Reply-To: <52D0B588.4010506@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart17608333.KpjugO8jgp"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201401131824.07417.vapier@gentoo.org> X-Archives-Salt: 3f213367-dfca-4966-862b-042e8b5e497e X-Archives-Hash: eeec89dbc7a7b9952544f83dca6fdf8d --nextPart17608333.KpjugO8jgp Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Friday 10 January 2014 22:07:52 Chris Reffett wrote: > Attached is a patch to test if Portage is going to write to a > read-only filesystem and print out the list of filesystems that need > to be remounted RW. This leaves ${D} intact rather than having some > files moved before hitting the RO filesystem. Fixes bug 378869. Since > git.overlays.gentoo.org is down, I haven't had the chance to rebase > this against latest, but I can resubmit if it doesn't cleanly apply. > This is my first patch to the list, so I apologize if I didn't submit > correctly. please use `git send-email` to post patches. attaching them makes things=20 harder to review. > --- /dev/null > +++ b/pym/portage/util/checkwriteable.py > > + with open("/proc/mounts") as procmounts: this won't work on non-Linux systems also, as a general style thing, unless there's a real need for the var to h= ave=20 a "full" name, just use "f" or "fp" > + roregex =3D re.compile(r'(\A|,)ro(\Z|,)') > + for line in procmounts: > + if roregex.search(line.split(" ")[3].strip()) is not None: > + romount =3D line.split(" ")[1].strip() > + ro_filesystems.add(romount) ad hoc parsing of /proc/mounts isn't a good thing. at the risk of over=20 engineering, there should be a func that would take care of expanding the=20 mount paths into a list of namedcollections (one per mount). then you simp= ly=20 walk it looking at its options. > + for directory in dir_list: > + for filesystem in ro_filesystems: > + if re.match(filesystem, directory): > + ro_filesystems_written.add(filesystem) there's no need to use re and in fact you don't want to. you're looking at= =20 wrong strings here, not regexes. =2Dmike --nextPart17608333.KpjugO8jgp Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (GNU/Linux) iQIcBAABAgAGBQJS1HWXAAoJEEFjO5/oN/WBOkAP/Rt2jmMYMPa3NKtisySisLJF 51oQcH05OtaS75TeLbtb3S7CMg61zZlTQ51yCl4Vo4e857sf69nBHC9XW+LZQpm1 hse447bYH+lNJaoSZgKp8GQCl7fLZtMqbQd4z6vqFh4D+h7FaaEWGobT56lKTbFF 2mEGbmpMLVo6h0HW0eCBr9hQodnSzvNxQlhpmMuFHaAJKQbCYPjQ1nPLIotFj+5i vRpegkonh1LUt9iERJmk0limLT0UruPtmBjc4Yd/QuzTYsBhWBOmPa9PwfWQFBiL /GZGMEj19ux8yC9NCSJlF1j8yeTNjUUT8NaHWC1xUJQgmc5t+QjBXHyKu0ZF1OzB vpCCxhKLrr/puLgJtvm3greHREDSy8SRpQ/PLSgNaSvjsfCEXgT9G6v/7+0bPA9w dldrhe6jNz41TiHba5ItO7VmcYM/lsxjcPPBDkbqTg1o3Ges191OqPKyC/44qeId C5ce5jyZFG7Sn9dWestKOhoK6aSSK6oFkXIi0f7tzquqr2YCE10VwMNsTin0Vxjt YcmvX11C7kGMD1nXZK7JA/LpZGwR30yw6Gve42jDMGh/ehuoa28eyzsUJxWg6jie g0jszyGAMpClGR0vyXPow/pt/0Wm+JCW5MgOkum+o7wOxXNX9/1DNdnw6W89AgVr DRd9SZOfvudlA1WyW/8U =xLyo -----END PGP SIGNATURE----- --nextPart17608333.KpjugO8jgp--