Bug 264711 - net/endlessh: fix wrong use of STRIP
Summary: net/endlessh: fix wrong use of STRIP
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Bernard Spil
URL:
Keywords: easy
Depends on:
Blocks:
 
Reported: 2022-06-16 12:40 UTC by Robert Clausecker
Modified: 2022-06-20 18:00 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (brnrd)
fuz: merge-quarterly?


Attachments
net/endlessh: fix wrong use of STRIP (974 bytes, patch)
2022-06-16 12:40 UTC, Robert Clausecker
fuz: maintainer-approval? (brnrd)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Clausecker freebsd_committer freebsd_triage 2022-06-16 12:40:02 UTC
Created attachment 234726 [details]
net/endlessh: fix wrong use of STRIP

STRIP_CMD was meant instead of STRIP, causing the build to hang when building
unstripped packages.  The error also prevented the binary from being stripped
as intended.

Tested with Poudriere on armv7 arm64 FreeBSD 13.
Please MFH this build fix if possible.
Comment 1 Mark Millard 2022-06-18 04:31:16 UTC
I'll note that the FreeBSD build servers seem to define
things so that they do not hang but they also do not
execute the file after the ${STRIP} :

=======================<phase: stage          >============================
===>  Staging for endlessh-1.1_1
===>   Generating temporary packing list
install -d /wrkdirs/usr/ports/net/endlessh/work/stage/usr/local/bin
install -m 755 endlessh /wrkdirs/usr/ports/net/endlessh/work/stage/usr/local/bin/
install -d /wrkdirs/usr/ports/net/endlessh/work/stage/usr/local/man/man1
install -m 644 endlessh.1 /wrkdirs/usr/ports/net/endlessh/work/stage/usr/local/man/man1/
install  -m 0644 /usr/ports/net/endlessh/files/endlessh.newsyslog.conf  /usr/ports/net/endlessh/files/endlessh.conf.sample /wrkdirs/usr/ports/net/endlessh/work/stage/usr/local/etc/
s /wrkdirs/usr/ports/net/endlessh/work/stage/usr/local/bin/endlessh
make: exec(s) failed (No such file or directory)
====> Compressing man pages (compress-man)
===> Staging rc.d startup script(s)
*** Error code 1 (ignored)
===========================================================================
=======================<phase: package        >============================
===>  Building package for endlessh-1.1_1
===========================================================================
=>> Cleaning up wrkdir
===>  Cleaning for endlessh-1.1_1
build of net/endlessh | endlessh-1.1_1 ended at Thu Jun 16 21:09:56 UTC 2022
build time: 00:00:02

So it looks like, in such a context, ${STRIP} translates to: s
Comment 2 Robert Clausecker freebsd_committer freebsd_triage 2022-06-18 14:06:46 UTC
(In reply to Mark Millard from comment #1)

More specifically, STRIP defaults to -s.  The idea is to run the C compiler like this:

    ${CC} ${CFLAGS} ${STRIP} ...

so it strips the binary if STRIP is set to -s.

In make syntax, a leading dash means to ignore errors from a command.  Hence,

    ${STRIP} ...

expands to

    -s ...

which is executed as

    s ...

with failure ignored.  Of course the command fails as there is no binary named s in the search path, so curiously two wrongs make a right here and the build just so happens to succeed.
Comment 3 Mark Millard 2022-06-18 22:10:39 UTC
(In reply to Robert Clausecker from comment #2)

I see in Mk/bsd.port.subdir.mk :

.if !defined(DEBUG_FLAGS)
STRIP?= -s
.endif

which indicates 2 ways for the -s to not be there:

A) DEBUG_FLAGS defined
B) STRIP already defined (to be something else, such as empty)

And that explains why I got the "it hangs up" case
in what I was doing: no -s was assigned.
Comment 4 commit-hook freebsd_committer freebsd_triage 2022-06-20 11:50:32 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0befb0f7e74637d9152aa286e4c18188cc5344ae

commit 0befb0f7e74637d9152aa286e4c18188cc5344ae
Author:     Bernard Spil <brnrd@FreeBSD.org>
AuthorDate: 2022-06-20 11:43:43 +0000
Commit:     Bernard Spil <brnrd@FreeBSD.org>
CommitDate: 2022-06-20 11:43:43 +0000

    net/endlessh: fix wrong use of STRIP

     * STRIP_CMD was meant instead of STRIP, causing the
       build to hang when building unstripped packages.

    PR:             264711
    Submitted by:   Robert Clausecker <fuz fuz su>

 net/endlessh/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 5 Bernard Spil freebsd_committer freebsd_triage 2022-06-20 18:00:49 UTC
Thank you Robert!