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 command builtin for freebsd #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sarcasticadmin
Copy link

Description

Depends on: Ventto/libshlist#2
Closes: #30

It does not seem that "command -pv xrandr" is able to find xrandr in my PATH on FreeBSD. Im not sure if this is due to there just not being a default /etc/environment set or what but I think we should be checking
the current PATH as well as the default to make sure we search all possibilities.

Let me know what you think.

Tests

Building with my PR from libshlist: Ventto/libshlist#2 nets me the expect results:

mkdir build
make install PREFIX=$(realpath ./build) LIB=$(realpath ../libshlist/liblist.sh)
...
$ build/bin/mons
Monitors:        2
Mode: primary
0:*  LVDS-1   (enabled)

It does not seem that "command -pv xrandr" is able to find xrandr in my
PATH on FreeBSD. Im not sure if this is due to there just not being a
default /etc/environment set or what but I think we should be checking
the current PATH as well as the default to make sure we search all
possibilities.
@cemeyer
Copy link

cemeyer commented Aug 21, 2020

The problem is the -p flag:

             If the -p option is specified, the command search is performed
             using a default value of PATH that is guaranteed to find all of
             the standard utilities.

It ignores user's PATH and substitutes _PATH_STDPATH, which is /usr/bin : /bin : /usr/sbin : /sbin.

I don't think that makes much sense for mons and would suggest simply dropping the -p.

@sarcasticadmin
Copy link
Author

@cemeyer Thanks for the clarification, thats makes sense since xrandr is under /usr/local/bin in FreeBSD.

Regardless, I think it still makes some sense cover both cases and check _PATH_STDPATH if for whatever reason the user was to botch their PATH.

@cemeyer
Copy link

cemeyer commented Aug 21, 2020

Sure, it seems harmless to me.

@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.

Add mons to the FreeBSD ports
3 participants