Bug 274348 - security/acme.sh pkg-install bug in 3.0.6_1
Summary: security/acme.sh pkg-install bug in 3.0.6_1
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: Dan Langille
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-08 07:49 UTC by Moviuro
Modified: 2023-11-24 13:38 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (dvl)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Moviuro 2023-10-08 07:49:34 UTC
https://github.com/freebsd/freebsd-ports/commit/beb96db3cafbf2f65508e09de788a93839060dc2#diff-decc86480f366f42157f70acd9c461d0a1ce822ca3733426f9e0b4e8fab03293R6 contains a shell syntax error.

When upgrading security/acme.sh on my various jails, the acme.sh pkg-install script errored with:

    [car.popho.be] [18/22] Extracting acme.sh-3.0.6_1: 100%                                                                                             
    [: !-f: unexpected operator

The correct line should be:

    if [ ! -f /var/log/acme.sh.log ]
Comment 1 Mina Galić freebsd_triage 2023-10-08 07:51:46 UTC
that whole script is not pkg -r safe, and i have no idea how to make it safe without converting it to pkg-lua-script(5)
Comment 2 Mina Galić freebsd_triage 2023-10-08 09:54:49 UTC
looking at the code, cuz i couldn't find any docs, it looks like
we should use ${PKG_ROOTDIR}${PKG_PREFIX} instead of of /usr/local.
and i think /usr/bin/install can stay the way it is, since it's not a binary that needs to be of a certain ABI for this operation to succeed
Comment 3 Dan Langille freebsd_committer freebsd_triage 2023-10-08 11:50:51 UTC
(In reply to Mina Galić from comment #2)
Where you do see /usr/local used?

Apart from here?

[11:50 pkg01 dan ~/ports/head/security/acme.sh] % grep -r /usr/local * 
files/acme-crontab.in:# This file should be copied to /usr/local/etc/cron.d/acme
Comment 4 Dan Langille freebsd_committer freebsd_triage 2023-10-08 12:05:21 UTC
(In reply to Moviuro from comment #0)

Thank you for this report. I have failed in the past to see this message but I am able to reproduce it via 'poudriere testport'.

While fixing the error, I will also rename pkg-install to pkg-post-install re https://docs.freebsd.org/en/books/porters-handbook/pkg-files/#pkg-install

This also means the POST-INSTALL check can be removed from that file.
Comment 5 commit-hook freebsd_committer freebsd_triage 2023-10-08 12:26:08 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=678db807ed62622394f5ce17b7e492a300d10043

commit 678db807ed62622394f5ce17b7e492a300d10043
Author:     Dan Langille <dvl@FreeBSD.org>
AuthorDate: 2023-10-08 12:22:15 +0000
Commit:     Dan Langille <dvl@FreeBSD.org>
CommitDate: 2023-10-08 12:25:19 +0000

    security/acme.sh: fix post-install script

    The install script contained a syntax error which caused the log file
    to not be created.

    While here:

    * rename script from pkg-install to pkg-post-install
    * include another crontab example which provides additional contet to
      logging.

    PR:             274348

 security/acme.sh/Makefile               |  1 +
 security/acme.sh/files/acme-crontab.in  | 24 +++++++++++++++++++++---
 security/acme.sh/pkg-install (gone)     | 11 -----------
 security/acme.sh/pkg-post-install (new) |  7 +++++++
 4 files changed, 29 insertions(+), 14 deletions(-)
Comment 6 Dan Langille freebsd_committer freebsd_triage 2023-10-08 13:02:38 UTC
Leaving this open pending further reports re /usr/local
Comment 7 Dan Langille freebsd_committer freebsd_triage 2023-11-24 13:38:08 UTC
With no further replies, closing.