From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org,Ulrich Mueller <ulm@gentoo.org>
Subject: Re: [gentoo-dev] RFC: eutils.eclass: More reliable return status for e*_clean.
Date: Fri, 16 Feb 2018 10:57:13 +0100 [thread overview]
Message-ID: <E27B9D74-06D4-4C9D-AAB8-513C11810F98@gentoo.org> (raw)
In-Reply-To: <23174.39529.765544.519294@a1i15.kph.uni-mainz.de>
Dnia 16 lutego 2018 09:46:33 CET, Ulrich Mueller <ulm@gentoo.org> napisał(a):
>Currently the return status of e{cvs,svn,git}_clean is not at all
>reliable, because only the last command in the pipeline is tested.
>In addition, there are two pipelines in ecvs_clean, and the exit
>status of the first one is completely ignored.
>
>Another issue is that xargs -0 is an extension not specified by POSIX.
>See patch included below, fixing both problems. (Note that this is
>close to the implementation originally proposed in bug 210708 [1].)
>
>Should we take this as an opportunity to split off these three
>functions into their own eclass, e.g. vcs-clean.eclass?
>
>Ulrich
>
>[1] https://bugs.gentoo.org/210708
>
>
>From 83c0afbfb4ef0c501c65dcd8e0c9c8bd30cdd70a Mon Sep 17 00:00:00 2001
>From: =?UTF-8?q?Ulrich=20M=C3=BCller?= <ulm@gentoo.org>
>Date: Fri, 16 Feb 2018 07:47:46 +0100
>Subject: [PATCH] eutils.eclass: More reliable return status for
>e*_clean.
>
>In ecvs_clean, combine the two find commands into one, so that the
>exit status of the first one won't be ignored.
>
>Also use find -exec rather then find | xargs, so we don't have to
>check the exit status of all commands in the pipeline.
>---
> eclass/eutils.eclass | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
>diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
>index 8bbd561015ad..bce8cf1c2610 100644
>--- a/eclass/eutils.eclass
>+++ b/eclass/eutils.eclass
>@@ -44,8 +44,8 @@ fi
> # internal CVS directories. Defaults to $PWD.
> ecvs_clean() {
> [[ $# -eq 0 ]] && set -- .
>- find "$@" -type d -name 'CVS' -prune -print0 | xargs -0 rm -rf
>- find "$@" -type f -name '.cvs*' -print0 | xargs -0 rm -rf
>+ find "$@" \( -type d -name 'CVS' -prune -o -type f -name '.cvs*' \) \
>+ -exec rm -rf '{}' \+
Could you please use quotes instead of backslash escapes all the way? They're generally less confusing since escapes trigger different behavior in different contexts in bash.
> }
>
> # @FUNCTION: esvn_clean
>@@ -55,7 +55,7 @@ ecvs_clean() {
> # internal Subversion directories. Defaults to $PWD.
> esvn_clean() {
> [[ $# -eq 0 ]] && set -- .
>- find "$@" -type d -name '.svn' -prune -print0 | xargs -0 rm -rf
>+ find "$@" -type d -name '.svn' -prune -exec rm -rf '{}' \+
> }
>
> # @FUNCTION: egit_clean
>@@ -65,7 +65,7 @@ esvn_clean() {
> # contains internal Git directories. Defaults to $PWD.
> egit_clean() {
> [[ $# -eq 0 ]] && set -- .
>- find "$@" -type d -name '.git*' -prune -print0 | xargs -0 rm -rf
>+ find "$@" -type d -name '.git*' -prune -exec rm -rf '{}' \+
> }
>
> # @FUNCTION: emktemp
--
Best regards,
Michał Górny (by phone)
next prev parent reply other threads:[~2018-02-16 9:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-16 8:46 [gentoo-dev] RFC: eutils.eclass: More reliable return status for e*_clean Ulrich Mueller
2018-02-16 9:57 ` Michał Górny [this message]
2018-02-16 18:12 ` [gentoo-dev] RFC v2: " Ulrich Mueller
2018-02-16 18:55 ` Michał Górny
2018-02-16 13:06 ` [gentoo-dev] RFC: " Michael Orlitzky
2018-02-16 14:52 ` Michał Górny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E27B9D74-06D4-4C9D-AAB8-513C11810F98@gentoo.org \
--to=mgorny@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
--cc=ulm@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox