[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-dev
Subject:    Re: [gentoo-dev] Usage of cp -i to prevent overwriting
From:       Ferris McCormick <fmccor () gentoo ! org>
Date:       2009-01-20 20:18:53
Message-ID: 1232482733.31989.152.camel () liasis ! inforead ! com
[Download RAW message or body]


On Tue, 2009-01-20 at 21:37 +0200, Petteri Räty wrote:
> Ferris McCormick wrote:
> > On Tue, 2009-01-20 at 21:04 +0200, Petteri Räty wrote:
> >> Many times upstream Java projects don't include build.xml files or
> >> proper build systems so we include build.xml files in $FILESDIR. In case
> >> upstream some day adds one we usually use cp -i to detect if upstream
> >> adds this file in new versions. If devs do their job properly, this will
> >> never show to users. On #gentoo-dev at least grobian and darkside did
> >> not like this and proposed using test and die instead. If we think that
> >> cp -i is not acceptable, this should be made a function to avoid code
> >> duplication in my opinion. Here's a suggestion:
> >>
> >> function cp-no-replace() {
> >> 	debug-print-function ${FUNCNAME} $*
> >>
> >> 	[[ ${#} != 2 ]] && die "${FUNCNAME} takes two arguments"
> >> 	[[ -e ${2} ]] && die "die target exists"
> >>
> >> 	cp "${1}" "${2}" || die "cp failed"
> >> }
> >>
> >> So do you think:
> >> a) cp -i is fine
> > 
> > Fine with me
> > 
> >> b) this function should be added to eutils
> > 
> > I don't like this one --- 
> > [[ ${#} != 2 ]] && die "${FUNCNAME} takes two arguments"
> > [[ -e ${2} ]] && die "die target exists"
> > 
> > How does the user recover from that?  I would become irate if a build
> > died without giving some useful indication the problem.
> > 
> 
> You did not understand the issue if you are fine with a) but then make
> this statement. a) would surely be even more confusing to the user.
> 
> Regards,
> Petteri

I think I understand the issue.  My point is that
die "die target exists"
gives no clue whatsoever as to what to do or where the problem is and
strikes me as something that should never appear in a proper build.  If
that's the preferred solution, at least indicate that the ebuild has not
caught up with upstream and that the user is not at fault.

'cp -i' will at least ask a question, and I find that marginally better
--- it's confusing, but at least it says something.  But it seems to me
that if we hit this case, no one (including the package owner) knows
which .xml file to use, so stopping the build makes sense, but do it
with some message that explains exactly what is going on.

I do not intend to respond further to this thread.

Regards,
Ferris
-- 
Ferris McCormick (P44646, MI) <fmccor@gentoo.org>
Developer, Gentoo Linux (Sparc, Userrel, Trustees)

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic