Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mons to the FreeBSD ports #30

Open
0mp opened this issue Dec 5, 2018 · 4 comments · May be fixed by #44
Open

Add mons to the FreeBSD ports #30

0mp opened this issue Dec 5, 2018 · 4 comments · May be fixed by #44

Comments

@0mp
Copy link
Contributor

0mp commented Dec 5, 2018

Hi there,

we are adding mons to the FreeBSD ports at the moment (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=222206) and there are some problems with some hard-coded paths. Would you mind if I submit fixes that make the installation process a little bit more general? It should not be too long/intrusive.

@Ventto
Copy link
Owner

Ventto commented Jan 11, 2019

Thanks @0mp for the feedback and your proposal.
Feel free to pull request !

@0mp
Copy link
Contributor Author

0mp commented Jan 11, 2019

@Ventto Cool! I'll send some patches if I happen to work on that port again. 👍

@cemeyer
Copy link

cemeyer commented Aug 12, 2020

So we have a FreeBSD port now — thanks! There are some GNU sed assumptions in libshlist that break it, though. E.g., the sed i command does not work the same in BSD sed as GNU sed, which breaks list_insert:

$ echo 1 2 3 | sed '1ifoobar'     # BSD sed
sed: 1: "1ifoobar": command i expects \ followed by text

$ echo 1 2 3 | gsed '1ifoobar'   # GNU sed
foobar
1 2 3

$ echo 1 2 3 | sed '1i\
foobar '          # BSD sed again
foobar 1 2 3

Aliasing sed to gsed on FreeBSD (and adding a port dependency on gsed) fixes it; currently I've hacked in a:

sed() {
  gsed "$@"
}

definition to my copy of mons so that it works.

Edit: tracking in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=248632 .

@kevans91
Copy link

I suspect the answer to this is something like:

diff --git a/liblist.sh b/liblist.sh
index d3a2144..f9bb2d2 100644
--- a/liblist.sh
+++ b/liblist.sh
@@ -75,7 +75,8 @@ list_push_back () {
 #
 list_insert () {
     test "$#" -ne 3 && return 1
-    i="$2"; [ "$i" != '$' ] &&  i=$((i+1)); echo "$3" | sed "${i}i${1}"
+    i="$2"; [ "$i" != '$' ] &&  i=$((i+1)); echo "$3" | sed "${i}i\\
+${1}"
 }
 
 ##
diff --git a/liblist_unsafe.sh b/liblist_unsafe.sh
index 4ae9951..2da93d5 100644
--- a/liblist_unsafe.sh
+++ b/liblist_unsafe.sh
@@ -79,7 +79,8 @@ list_push_back () {
 #
 list_insert () {
     test "$#" -ne 3 && return 1; i="$3"; [ "$i" != '$' ] &&  i=$((i+1))
-    eval "$1=\"\$(echo \"\$$1\" | sed \"${i}i${2}\")\""
+    eval "$1=\"\$(echo \"\$$1\" | sed \"${i}i\\
+${2}\")\""
 }
 
 ##

This solves the immediate problem, at least- the i command is POSIX specified to be the way that we're currently strictly accepting it, and gsed seems to be OK with it. The test suite has some other issues that leave me unable to fully test libshlist and I don't use mons, so I've not submitted a PR for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants