Bug 1564597 - /usr/bin/erl uses sed to get basename
Summary: /usr/bin/erl uses sed to get basename
Alias: None
Product: Fedora
Classification: Fedora
Component: erlang
Version: rawhide
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Peter Lemenkov
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2018-04-06 17:37 UTC by Jan Pazdziora
Modified: 2018-08-08 16:09 UTC (History)
5 users (show)

Fixed In Version: erlang-
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2018-08-08 16:09:32 UTC
Type: Bug

Attachments (Terms of Use)

Description Jan Pazdziora 2018-04-06 17:37:09 UTC
Description of problem:

The /usr/bin/erl (which is a symlink to /usr/lib64/erlang/bin/erl which is a symlink to /usr/lib64/erlang/erts- invokes sed just to get the basename from $0 to set it to PROGNAME:

  PROGNAME=`echo $0 | sed 's/.*\///'`

It should be possible to just use string substitution


with the same effect.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Strace some erl command to see what processes are started.

Actual results:

There's a fork + exec of sed.

Expected results:

No external process should be needed.

Additional info:

/usr/lib64/erlang/bin/start_erl could use the same change.

Comment 1 Peter Lemenkov 2018-07-11 12:55:54 UTC
(In reply to Jan Pazdziora from comment #0)

Jan, thanks for the report. Just in case - do you know if it's a "bashism" or not?

Comment 2 Jan Pazdziora 2018-07-12 12:37:58 UTC
It is POSIX-ism. I've also filed it upstream as https://github.com/erlang/otp/pull/1814 but it was determined to be breaking some shells of those that otp supports.

So we cannot get the change from upstream but we might be able to patch on the distribution level where we know what shell we ship in Fedora.

Comment 3 Fedora Update System 2018-07-30 12:14:22 UTC
erlang- has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-2cc78b6d31

Comment 4 Fedora Update System 2018-07-30 19:39:22 UTC
erlang- has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-2cc78b6d31

Comment 5 Fedora Update System 2018-08-08 16:09:32 UTC
erlang- has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.