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

Fixing list insert error under BSD sed #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

sarcasticadmin
Copy link

@sarcasticadmin sarcasticadmin commented Aug 21, 2020

Description

This was related to the FreeBSD port for mons and the issue opened up in the portstree bugzilla: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=248632

BSD sed was unable to correctly leverage i command resulting in the following output when running mons on master 375bbba3aa700c8b3b33645a7fb70605c8b0ff0c:

 $ ./mons
sed: 1: "1iLVDS-1": command i expects \ followed by text
Monitors: 0
Mode: primary

The following change was initially suggested by @kevans91 here: Ventto/mons#30 (comment) but I did some more testing to get the following to be compliant for both GNU and BSD versions of sed.

Tests

I have added appropriate tests for both the libshlist and libshlist_unsafe variations.

$ sh tests/test_freebsd.sh 
sed is /usr/bin/sed
test: insert pass
--------------------------
sed is a shell function
test: insert pass
$ sh tests/test_unsafe_freebsd.sh 
sed is /usr/bin/sed
test: insert pass
--------------------------
sed is a shell function
test: insert pass

As for mons this also fixes the original error. I do have an issue with how command -pv xrandr is working and have to modify it to command -v xrandr but Ill open that issue in mons for discussion:

$ ./mons
Monitors:        2
Mode: primary
0:*  LVDS-1   (enabled) 

@arkhan
Copy link

arkhan commented Jan 6, 2021

hello, any update..?

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 this pull request may close these issues.

2 participants