[ENHANCEMENT]: Simplify couchdb wrapper script logic
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- shell
- Domain
- build-system
Research direction
Start with rel/files/couchdb.in and compare its current canonical_readlink and $0 handling with the proposed {{prefix}} change. Read the configure process and rel/couchdb.config to determine how custom installation roots are represented. Done means the wrapper works when execed without breaking deployments whose installation prefix is not the default.
Written by the indexing model from the issue text.
Description
Provide a brief overview of what the new feature is all about
I propose the following:
diff --git a/rel/files/couchdb.in b/rel/files/couchdb.in
index 332bfe0f2..7837d794f 100755
--- a/rel/files/couchdb.in
+++ b/rel/files/couchdb.in
@@ -12,19 +12,8 @@
# License for the specific language governing permissions and limitations under
# the License.
-canonical_readlink ()
- {
- FILE=$(dirname "$1")/$(basename "$1");
- if [ -h "$FILE" ]; then
- cd $(dirname "$1")
- canonical_readlink $(readlink "$FILE");
- else
- cd "${1%/*}" && pwd -P;
- fi
-}
-COUCHDB_BIN_DIR=$(canonical_readlink "$0")
-ERTS_BIN_DIR=$COUCHDB_BIN_DIR/../
-cd "$COUCHDB_BIN_DIR/../"
+ERTS_BIN_DIR="{{prefix}}"
+cd "$ERTS_BIN_DIR"
export ROOTDIR=${ERTS_BIN_DIR%/*}
This makes the script work when it is execed. $0 cannot be relied upon when execing and it is kinda unreliable in general (there are bunch of edge cases related to it), it should be avoided wherever possible. prefix is the ideal substitute solving all inconveniences.
I would make a PR out of it, but the configure script is very rudimentary and there is (to my knowledge) no way to override the location of root other than editing rel/couchdb.config after configuring.
I find it likely that there are users/distros/packagers which install couchdb into custom locations but are unaware that rel/couchdb.config requires editing (I don't think that this fact is documented anywhere), so substituting {{prefix}} will lead to ., which will break existing and new deployments of couchdb.
This is all a result of couchdb's non-standard build process which was designed to not support installing couchdb. I think that I read somewhere that making couchdb properly installable is on the roadmap. If it ever gets implemented, this proposed change could be added too.
The advantages provided by this change are miniscule (I consider the exec and $0 things to be very minor issues, I see the main value of this change in simplifying the script and being able to dump canonical_readlink()), the disadvantages are significant.
- Dominant language
- Erlang
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 10h 14m
- Merged PRs (30d)
- 36
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/couchdb
-
Difficulty 4/5 3-5 days Newbie friendliness 44/100
apache/couchdb#6162 · 4 comments ·
Maintainers usually reply within 1 day
-
Fix: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' insteadMay be free again @devx-arjun claimed this 7 days ago, and no pull request is open. Openbeginner-friendly build chore patches-welcome
Difficulty 4/5 3-5 days Newbie friendliness 45/100
apache/couchdb#6144 · 4 comments ·
Maintainers usually reply within 1 day
-
bug needs-triage
Difficulty 4/5 3-5 days Newbie friendliness 48/100
apache/couchdb#6132 · 3 comments ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 45/100
apache/couchdb#6120 · 5 comments ·
Maintainers usually reply within 1 day
-
bug needs-triage
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Maintainers usually reply within 1 day
Similar issues
-
bug misleading tooling trivial
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Docs example projects pinned to a literal library version instead of 3.*Possibly taken @DaveSkender claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
facioquo/stock-indicators-dotnet#2372 ·
Maintainers usually reply within 1 day
-
Type/Task
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ballerina-platform/ballerina-library#9301 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
oxidecomputer/humility#737 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day