pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [patch] package.mk: use cp without -p if it fails



On Thu 19 Aug 2021 at 11:22:03 +0200, Sijmen J. Mulder wrote:
> "Amitai Schleier" <schmonz%schmonz.com@localhost>:
> > FWIW, I've been running for a long time with a similar local diff for 
> > similar reasons (many VMs building binary packages into an NFS 
> > location):
> > 
> > --- mk/pkgformat/pkg/package.mk
> > +++ mk/pkgformat/pkg/package.mk
> > @@ -66,7 +66,8 @@ ${PKGFILE}: ${STAGE_PKGFILE}
> >          @${STEP_MSG} "Creating binary package ${.TARGET}"
> >          ${RUN} ${MKDIR} ${.TARGET:H};                                   
> > \
> >          ${LN} -f ${STAGE_PKGFILE} ${PKGFILE} 2>/dev/null ||             
> > \
> > -               ${CP} -pf ${STAGE_PKGFILE} ${PKGFILE}
> > +               ${CP} -pf ${STAGE_PKGFILE} ${PKGFILE} 2>/dev/null ||    
> > \
> > +               ${CMP} ${STAGE_PKGFILE} ${PKGFILE}
> >   .endif
> 
> I'm afraid I don't know how that works. From what I can
> see /usr/bin/cmp (which CMP is set to here) compares two files, how
> does this fix the issue?

Maybe it is intended to fail with an error code if the destination file
exists but is not the same? Or it is a subtle typo, where another ${CP}
was meant.

-Olaf.
-- 
___ "Buying carbon credits is a bit like a serial killer paying someone else to
\X/  have kids to make his activity cost neutral." -The BOFH    falu.nl@rhialto

Attachment: signature.asc
Description: PGP signature



Home | Main Index | Thread Index | Old Index