From owner-freebsd-ports@freebsd.org Thu Jun 28 08:27:43 2018 Return-Path: Delivered-To: freebsd-ports@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CCC151024BA3 for ; Thu, 28 Jun 2018 08:27:43 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7D31B70C79; Thu, 28 Jun 2018 08:27:43 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from atuin.in.mat.cc (unknown [IPv6:2a01:678:42:ffff:3e15:c2ff:fec4:452e]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: mat/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id ECC5024B64; Thu, 28 Jun 2018 08:27:42 +0000 (UTC) (envelope-from mat@FreeBSD.org) Date: Thu, 28 Jun 2018 10:27:38 +0200 From: Mathieu Arnold To: Joseph Ward Cc: freebsd-ports@freebsd.org Subject: Re: Any way to prevent do-extract chmod and chown? Message-ID: <20180628082738.uv3bs6jmrrp52h5m@atuin.in.mat.cc> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="z6bfi6uyvi4vghdu" Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180323 X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2018 08:27:44 -0000 --z6bfi6uyvi4vghdu Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jun 27, 2018 at 07:06:44PM -0400, Joseph Ward wrote: > Hi everyone, >=20 > I'm creating some internal-only ports and I'm trying to maintain the > permissions and owners of the files present in the distfile.tar.gz when > they get packaged up for install. >=20 > When I "make extract", the "do-extract" target is performing a chmod and > chown on everything, as seen from the following excerpt from the > bsd.port.mk file: >=20 >=20 > .if !target(do-extract) > do-extract: ${EXTRACT_WRKDIR} > =A0=A0=A0=A0=A0=A0=A0 @for file in ${EXTRACT_ONLY}; do \ > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if ! (cd ${EXTRACT_WRKDIR} = && ${EXTRACT_CMD} > ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\ > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 then \ > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 exi= t 1; \ > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 fi; \ > =A0=A0=A0=A0=A0=A0=A0 done > =A0=A0=A0=A0=A0=A0=A0 @if [ ${UID} =3D 0 ]; then \ > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ${CHMOD} -R ug-s ${WRKDIR};= \ > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ${CHOWN} -R 0:0 ${WRKDIR}; \ > =A0=A0=A0=A0=A0=A0=A0 fi > .endif >=20 >=20 > Short of commenting those lines out (which I really don't want to do > because I have 0 idea why it's there or what I'd break with other ports) > is there any way at all to maintain the ownership of the files?=A0 Building ports as root is a rare thing these days, most build tools build everything as a regular user (most of the time, nobody) so ownership of files in distribution files is not retained anyway. To set user/group/mode ownership in the resulting packages, you need to use the @user, @group and @mode keywords in the pkg-plist file. (or the @ keyword if one file needs a specific user/group/mode.) See: https://www.freebsd.org/doc/en/books/porters-handbook/plist-keywords.html --=20 Mathieu Arnold --z6bfi6uyvi4vghdu Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKTBAABCgB9FiEEOraXidLtEhBkQLpbOkUW81GDzkgFAls0m/lfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNB QjY5Nzg5RDJFRDEyMTA2NDQwQkE1QjNBNDUxNkYzNTE4M0NFNDgACgkQOkUW81GD zkjjDhAAuPNDeWOwihT1+Wis6fQeG2SEwKuOFHaagRvQsAt4U+nfro7sSZ3NYbtQ KuD6arSupj2FnltaywD93aZCnyxoQfA4ETaJ3anRCD6mhrK1agWlxcQcBRCcEy38 goM+Sm1VNZsc/8u4jEUjEzLMO1cQbsBnavjBnz7l+/5oKooon8iTYH20B4wpA8Yz VCD1uFsv64QZ+4SGVebVWklICbLCvq/tucplzYUvp6bw5rEhUAEdBbRNwIPOexzI Yu2asM4HlfqorFhpdf7w7Q9Qkd3jjtWVCBtJhngkK/bMc/P5NIxmNSEUrSl67rNp V7ORmrNDdKfFboNYpReEIaJ/4YYthou3EmSkouUiStjuUEA1mfLq9ssKojqh8p5t uFyteZWNIf5rWihbGJNvQMRcVgabOn2YqJOB6dvoQpWzdsAglHA8TJgRPVygogMf eamuFFOfGErGQePqPlAos1u617bvd32izJriXC1dQsGMk0OwnIIU98ZjE9CTHeHj 6Qs2lkSR41lVmPJKl0SZN0s2TOqUp8xXDa6lrzC2KzO85TPvPHo/bWgFgVjpV0N1 1g/XwPRRPYoRY88HuBuixK6XOF3QPOI5xD5IODN1+WArMOJYxyXAMS/rWEzuMUWB bPQ68vcm4lkQ9tMQZ3Pa7wOgCFr7I0YhgDzxBMEJvU8EhDiPM0g= =er0k -----END PGP SIGNATURE----- --z6bfi6uyvi4vghdu--