From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id F38A9138334 for ; Mon, 17 Sep 2018 06:52:44 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C07B0E08C0; Mon, 17 Sep 2018 06:52:43 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 8BAF5E08C0 for ; Mon, 17 Sep 2018 06:52:43 +0000 (UTC) Received: from localhost.localdomain (d202-252.icpnet.pl [109.173.202.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id E640D335CD1; Mon, 17 Sep 2018 06:52:40 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-portage-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-portage-dev] [PATCH] f{owners,perms}: Warn when using relative path Date: Mon, 17 Sep 2018 08:52:33 +0200 Message-Id: <20180917065233.14030-1-mgorny@gentoo.org> X-Mailer: git-send-email 2.19.0 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-Transfer-Encoding: 8bit X-Archives-Salt: 8b1f02f1-c060-412d-868c-e8fd9aacc3cf X-Archives-Hash: 9ff52b7b6e56e85b422d9ec4715dbe50 --- bin/ebuild-helpers/fowners | 15 +++++++++++++++ bin/ebuild-helpers/fperms | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/bin/ebuild-helpers/fowners b/bin/ebuild-helpers/fowners index 68004210b..70297c6e6 100755 --- a/bin/ebuild-helpers/fowners +++ b/bin/ebuild-helpers/fowners @@ -8,6 +8,21 @@ if ! ___eapi_has_prefix_variables; then EPREFIX= ED=${D} fi +got_owner= +for arg; do + [[ ${arg} == -* ]] && continue + if [[ ! ${got_owner} ]]; then + got_owner=1 + continue + fi + if [[ ${arg} != /* ]]; then + eqawarn "Relative path passed to '${0##*/}': ${arg}" + eqawarn "This is unsupported. Please use 'chmod' when you need to work on files" + eqawarn "outside the installation image (\${ED})." + fi +done + + # we can't prefix all arguments because # chown takes random options slash="/" diff --git a/bin/ebuild-helpers/fperms b/bin/ebuild-helpers/fperms index c63a6abc3..f98560039 100755 --- a/bin/ebuild-helpers/fperms +++ b/bin/ebuild-helpers/fperms @@ -8,6 +8,21 @@ if ! ___eapi_has_prefix_variables; then ED=${D} fi +got_mode= +for arg; do + # - can either be an option or a mode string + [[ ${arg} == -* && ${arg} != -[ugorwxXst] ]] && continue + if [[ ! ${got_mode} ]]; then + got_mode=1 + continue + fi + if [[ ${arg} != /* ]]; then + eqawarn "Relative path passed to '${0##*/}': ${arg}" + eqawarn "This is unsupported. Please use 'chmod' when you need to work on files" + eqawarn "outside the installation image (\${ED})." + fi +done + # we can't prefix all arguments because # chmod takes random options slash="/" -- 2.19.0