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 01436138247 for ; Sun, 12 Jan 2014 02:59:02 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 12BFFE0B92; Sun, 12 Jan 2014 02:59:02 +0000 (UTC) Received: from qmta08.westchester.pa.mail.comcast.net (qmta08.westchester.pa.mail.comcast.net [76.96.62.80]) by pigeon.gentoo.org (Postfix) with ESMTP id 82EA1E0B92 for ; Sun, 12 Jan 2014 02:59:01 +0000 (UTC) Received: from omta13.westchester.pa.mail.comcast.net ([76.96.62.52]) by qmta08.westchester.pa.mail.comcast.net with comcast id CqwM1n00317dt5G58qz1CX; Sun, 12 Jan 2014 02:59:01 +0000 Received: from odin.tremily.us ([24.18.63.50]) by omta13.westchester.pa.mail.comcast.net with comcast id Cqyz1n00g152l3L3Zqz0Kj; Sun, 12 Jan 2014 02:59:01 +0000 Received: by odin.tremily.us (Postfix, from userid 1000) id 25697ECE048; Sat, 11 Jan 2014 18:58:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tremily.us; s=odin; t=1389495539; bh=CYVVa9NVcPku5nlEFy6bDYF6hNe6gXe4TVOrD4e1Ekk=; h=Date:From:To:Subject:References:In-Reply-To; b=Z4NE/+p5EhSdn7X5GBYBPeGmTV7cOcqy2ti86nVxlHtCNeJ0gDgC+JlVzB48dguEr UcAvZmfJrBc4w1OcoU+XuwPhxp4X5SGj8K4xod6OEO7ZtnMAAB+ZyDIKon4508mBTQ ov0w+JVzE/yji4OKbyNsSGHVrQhoV0klPKfIQH4w= Date: Sat, 11 Jan 2014 18:58:59 -0800 From: "W. Trevor King" To: gentoo-catalyst@lists.gentoo.org Subject: [gentoo-catalyst] Re: [PATCH] Remove some troublesome trailing slashes from paths Message-ID: <20140112025858.GG18522@odin.tremily.us> References: <1389469387-29010-1-git-send-email-dolsen@gentoo.org> <1389469387-29010-2-git-send-email-dolsen@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-catalyst@lists.gentoo.org Reply-to: gentoo-catalyst@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ewQ5hdP4CtoTt3oD" Content-Disposition: inline In-Reply-To: <1389469387-29010-2-git-send-email-dolsen@gentoo.org> OpenPGP: id=39A2F3FA2AB17E5D8764F388FC29BDCDF15F5BE8; url=http://tremily.us/pubkey.txt User-Agent: Mutt/1.5.22 (2013-10-16) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1389495541; bh=q6oXt90PEAWnn/nbZDZrDueds8vILRGFsCRjROhpFao=; h=Received:Received:Received:Date:From:To:Subject:Message-ID: MIME-Version:Content-Type; b=O3IcERqCxGdtDOGYcUpnFY4WlZDxrrfNW2j/VuxxesGTTyP2OjR1J3U99ix26nDgn Clr0h5M2fqFPQhyekWgwFSW+ygny3ZPjdyZ3aWpuAT0tBEBtduz8FGuQK4A0+Oa2P9 YRK7Jkx3JKQ+MM4j9h8ezaWjeV/12tw/LT4cqd6kAVDa4AQpjIynUIKGOWZj95RI4l niI7CvOxfvbJ+9Xjq102jQJNJ8dJFtRwBG5Ykv3VrG8bXqx4nxO5CK0YXqi3IsHnp5 lWgHwMSf/r1wuWR+rl4AU9K6JaA7efqK/hh9D+p8AHpjnjrVPN4MY4OJrIm6eNFqBC iklM7dTduMW6w== X-Archives-Salt: 8801379e-6bac-40d0-8f45-3eff0338abe4 X-Archives-Hash: 06d6319668845f43a9d0d8dc4af96aa7 --ewQ5hdP4CtoTt3oD Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jan 11, 2014 at 11:43:07AM -0800, Brian Dolbec wrote: > - self.settings["target_path"]=3Dnormpath(self.settings["storedir"]+\ > - "/builds/"+self.settings["target_subpath"]+".tar.bz2") > + self.settings["target_path"] =3D normpath(self.settings["storedir"] + > + "/builds/" + self.settings["target_subpath"].rstrip('/') + > + ".tar.bz2") I find it hard to imagine target_subpath ending with a slash. If it did, I think that would be a bug where it's set, not something we should try to work around here. In the current master (e5a9e20): $ git grep -A2 'target_subpath.*=3D' | cat modules/generic_stage_target.py: self.settings["target_sub= path"]=3Dself.settings["rel_type"]+"/"+\ modules/generic_stage_target.py- self.sett= ings["target"]+"-"+self.settings["subarch"]+"-"+\ modules/generic_stage_target.py- self.sett= ings["version_stamp"] -- modules/snapshot_target.py: self.settings["target_subpath"]= =3D"portage" modules/snapshot_target.py- st=3Dself.settings["storedir"] modules/snapshot_target.py- self.settings["snapshot_path"] = =3D normpath(st + "/snapshots/" so we should be safe without this change. > - self.settings["source_path"]=3Dnormpath(self.settings["storedir"]+\ > - "/builds/"+self.settings["source_subpath"]+".tar.bz2") > + self.settings["source_path"] =3D normpath(self.settings["storedir"] + > + "/builds/" + self.settings["source_subpath"].rstrip("/") + > + ".tar.bz2") source_subpath comes from the spec file, but I think we should check for trailing slashes (and error out if we find them) when we load the spec file, not here. This also holds for the later source_subpath and snapshot stripping. > self.settings["snapshot_cache_path"]=3D\ > normpath(self.settings["snapshot_cache"]+"/"+\ > - self.settings["snapshot"]+"/") > + self.settings["snapshot"]) Looks good to me, but doesn't this need a corresponding update to: if "SNAPCACHE" in self.settings: snapshot_cache_hash=3D\ read_from_clst(self.settings["snapshot_cache_path"]+\ "catalyst-hash") and also to: if "SNAPCACHE" in self.settings: myf=3Dopen(self.settings["snapshot_cache_path"]+"catalyst-hash","w") myf.write(self.settings["snapshot_path_hash"]) myf.close() These will still *work* without a properly joined path, but they won't use their intended =E2=80=A6/catalyst-hash file (and may not be cleaned up correctly). > self.settings["chroot_path"]=3Dnormpath(self.settings["storedir"]+\ > - "/tmp/"+self.settings["target_subpath"]+"/") > + "/tmp/"+self.settings["target_subpath"]) Looks good to me, but grepping for chroot_path gives lots of hits, and I didn't check them all. > - local destdir=3D".${subdir}/tmp" > + local destdir=3D"${subdir}/tmp" Looks good to me, but=E2=80=A6 > echo "Running ${file_name} in chroot ${chroot_path}" > - ${clst_CHROOT} ${chroot_path} ${destdir}/${file_name} || exit 1 > + ${clst_CHROOT} ${chroot_path} .${destdir}/${file_name} || exit 1 =E2=80=A6do we really need this dot? I'll test and find out ;). Cheers, Trevor --=20 This email may be signed or encrypted with GnuPG (http://www.gnupg.org). For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy --ewQ5hdP4CtoTt3oD Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJS0gTxAAoJEKKfehoaNkbtUmcQAJkUS0Hjw2XLSgTYyCX/GfOq YeO5s/6C38EPwP4+OGwSzHRJIv2eDmI9yKt4SPIi5z6BBXs2n4xdZV7KOMtfuwYG gstSwJo0XpmiYQxV5MVAVTug5JDSiXGbPHTj7/5a2aDyUCe50vFAHPyNcx6K3EMF hFbNCEsMEcRvOEES393HLSrfIsn0TZeG0FqXYzC4W15wHBlrOOHnHd8rt4YNxiwH MJSMbDUroJKhOq5IZU2HkgLz1otD0VS0rpmxFlP1xBDHPHTag9WBRTlh8UtTL1RI cd1upV0XpUqVOv3YUHbYZyYOzYGXWsmVc5WKReaFLgsV3HUoeyiVfWb5b38ojN7O W08aWho6I2lCHayr2cuHkq263zY2rFukPHtnJtBb88EF4sxYZJvA2py6YFQz7aGt 2Is1SnlMbS+QHtCcuAc0fSd+DOsvLYdewoRfh1cr005yjiA/q6QtSSJd5smJLVyh tC8xEATjK2jp7KCCvL65B8BAzw8v1Qc3QS229ZkrNwtoKFdRtaapbKQmSTA+BhGB ntq2NZ0kXQNVNX58X2Rnw4o5zVuRRylueZlc6w/MUNr1S/hYyqpFE4gcwkgmxYk6 wjgq+Ss8EdMCvHD0X8x5QCNq8S/9iMS+WvWIjWiNmCHxT7ft50y3eMiwUxEp4HCW YWMmwyF9zCTImg4GiV8V =n2JC -----END PGP SIGNATURE----- --ewQ5hdP4CtoTt3oD--