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

Remove absolute pathnames to binaries and rely on PATH #29

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

Conversation

spacefrogg
Copy link
Contributor

Fixes issues with distributions that use non-standard binary paths (e.g., in
isolated build environments). Scripts rely on PATH for other programs, anyway.

@apenwarr apenwarr closed this Jun 15, 2020
@apenwarr apenwarr reopened this Jun 15, 2020
@apenwarr apenwarr changed the base branch from master to main June 15, 2020 19:44
do Outdated
@@ -24,7 +24,7 @@ usage() {
}

mydir=$(dirname "$0")
cd "$(/bin/pwd)" && cd "$mydir" || die "can't find self in dir: $mydir"
cd "$(pwd)" && cd "$mydir" || die "can't find self in dir: $mydir"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't do this, as it will end up using the shell's internal pwd implementation. That has subtle differences which we are intentionally trying to bypass.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we should call pwd as /usr/bin/env pwd or capture the path to pwd in a variable if the performance penalty is too high.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, just to clarify, do you really truly have a system where the 'pwd' command is not in /bin? Because that seems like a hopelessly broken system to me. Why on earth would a system with no /bin/pwd have a /usr/bin/env?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NixOS! NixOS has no /bin/pwd, but it maintains env and sh in typical locations for compatibility with scripts.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. We can use env pwd then if we must, although it seems a bit ridiculous. (There is no need for /usr/bin/env here; the explicit path is just to force sh to not use its internal version. If it has an internal env, that's ok.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -10,13 +10,13 @@ fi

# builds 1xx*/all to test for basic/dangerous functionality.
# We don't want to run more advanced tests if the basics don't work.
/bin/ls 1[0-9][0-9]*/all.do |
ls 1[0-9][0-9]*/all.do |
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...whereas yes, I think it's fine to remove the /bin when calling ls.

@spacefrogg
Copy link
Contributor Author

spacefrogg commented Jun 20, 2020 via email

@periish
Copy link

periish commented Oct 27, 2020

On the topic of portability, sh isn’t guaranteed to have the local builtin.

@apenwarr
Copy link
Owner

apenwarr commented Oct 28, 2020 via email

@spacefrogg
Copy link
Contributor Author

How should we proceed? Shall I keep the path to pwd in a variable?

 Fixes issues with distributions that use non-standard binary paths (e.g., in
 isolated build environments). Scripts rely on PATH for other programs, anyway.

 Use /usr/bin/env to find the pwd binary avoiding the shell built-in.
@periish
Copy link

periish commented Nov 12, 2020 via email

@apenwarr
Copy link
Owner

apenwarr commented Nov 12, 2020 via email

@spacefrogg
Copy link
Contributor Author

I incorporated all changes. I am a bit puzzled, now. @apenwarr, do you accept this PR or does it need further work?

@spacefrogg
Copy link
Contributor Author

@apenwarr As this PR hasn't seen any attention for the last year now, I want to reach out to you again concerning the time you are willing to invest into this topic.

Apart from this particular PR, I have spent some effort brushing up redoconf. The current implementation has several bugs, some deficiencies and lacked modularity/extensibility in certain respects (as it was very focussed on compiling C code). I kept its function completely compatible with the libssl/hello world example from the documentation.

I also added builders and feature detectors for building TeX documents.

Before publishing my extended version of redoconf, I wanted to hear your opinion on the way forward. I don't want to distract you from anything, which is why I would be willing to publish and push forward redoconf separately from redo.

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.

3 participants