Bug 267670 - net/tsocks: ". tsocks off" results in sed error "bad flag in substitution command"
Summary: net/tsocks: ". tsocks off" results in sed error "bad flag in substitution com...
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: Emanuel Haupt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-09 16:44 UTC by Christina Mueller
Modified: 2022-11-10 14:35 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christina Mueller 2022-11-09 16:44:46 UTC
After using ". tsocks on", a subsequent ". tsocks off" results in

  sed: 1: "s/\/usr/local\/lib\/lib ...": bad flag in substitute command: '/'

It's obvious that the backslash in front of the slash between usr and local is missing. The corresponding line in /usr/local/bin/toscks is 56; adding the missing backslash fixes the error.

Thanks,
--Christina
Comment 1 commit-hook freebsd_committer freebsd_triage 2022-11-10 07:53:47 UTC
A commit in branch main references this bug:

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

commit d9f28ee265f94f4bcedb7d24648042ca1325c230
Author:     Emanuel Haupt <ehaupt@FreeBSD.org>
AuthorDate: 2022-11-10 07:40:57 +0000
Commit:     Emanuel Haupt <ehaupt@FreeBSD.org>
CommitDate: 2022-11-10 07:49:19 +0000

    net/tsocks: Fix erroneous substitution

    When patching the wrapper script for /usr to ${PREFIX} a part in a sed
    statement gets substituted that should be escaped. Adjust sed statement
    in a way that it doesn't break after patching ${PREFIX}.

    While here:

    - move a REINPLACE_CMD operation to a pre-existing patch file
    - pacify portclippy
    - reformat with portfmt

    PR:             267670
    Reported by:    chris@mumac.de

 net/tsocks/Makefile                 |  24 ++++----
 net/tsocks/files/patch-tsocks (new) |  11 ++++
 net/tsocks/files/patch-tsocks.c     | 118 +++++++++++++++++++++++++++++++++++-
 3 files changed, 138 insertions(+), 15 deletions(-)
Comment 2 commit-hook freebsd_committer freebsd_triage 2022-11-10 07:54:49 UTC
A commit in branch 2022Q4 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=7315cff722a585625b60e0df07125bdf61963c6a

commit 7315cff722a585625b60e0df07125bdf61963c6a
Author:     Emanuel Haupt <ehaupt@FreeBSD.org>
AuthorDate: 2022-11-10 07:40:57 +0000
Commit:     Emanuel Haupt <ehaupt@FreeBSD.org>
CommitDate: 2022-11-10 07:53:51 +0000

    net/tsocks: Fix erroneous substitution

    When patching the wrapper script for /usr to ${PREFIX} a part in a sed
    statement gets substituted that should be escaped. Adjust sed statement
    in a way that it doesn't break after patching ${PREFIX}.

    While here:

    - move a REINPLACE_CMD operation to a pre-existing patch file
    - pacify portclippy
    - reformat with portfmt

    PR:             267670
    Reported by:    chris@mumac.de

    (cherry picked from commit d9f28ee265f94f4bcedb7d24648042ca1325c230)

 net/tsocks/Makefile                 |  24 ++++----
 net/tsocks/files/patch-tsocks (new) |  11 ++++
 net/tsocks/files/patch-tsocks.c     | 118 +++++++++++++++++++++++++++++++++++-
 3 files changed, 138 insertions(+), 15 deletions(-)
Comment 3 Christina Mueller 2022-11-10 08:38:26 UTC
Thanks a lot for this incredibly fast fix! Do you want me to test the fix? I'll have to clone the ports git repository, first, which seems to take a few minutes...
Comment 4 Emanuel Haupt freebsd_committer freebsd_triage 2022-11-10 10:07:44 UTC
Thank you for your bug report. I was able to reproduce this 100%. The committed patch solved the issue for me but more feedback is always welcome :-)
Comment 5 Emanuel Haupt freebsd_committer freebsd_triage 2022-11-10 14:35:55 UTC
Fix committed and merged to quarterly, thanks!