Merge ~info-martin-konrad/epics-base:fix-broken-epicshostarch-script into epics-base:3.14

Proposed by Martin Konrad
Status: Merged
Approved by: Andrew Johnson
Approved revision: 27c6e6a3851187aaaf4bce21142d6de56c291aab
Merged at revision: 27c6e6a3851187aaaf4bce21142d6de56c291aab
Proposed branch: ~info-martin-konrad/epics-base:fix-broken-epicshostarch-script
Merge into: epics-base:3.14
Diff against target: 17 lines (+2/-2)
1 file modified
startup/EpicsHostArch (+2/-2)
Reviewer Review Type Date Requested Status
J. Lewis Muir (community) Abstain
Andrew Johnson Approve
Review via email: mp+354949@code.launchpad.net

Commit message

Issue has been reported by Thorsten (https://epics.anl.gov/core-talk/2018/msg00451.php).

To post a comment you must log in.
Revision history for this message
Andrew Johnson (anj) wrote :

Thanks Martin.

review: Approve
Revision history for this message
J. Lewis Muir (jlmuir) wrote :

LGTM, except

  $*

should be

  "$@"

I know it was like that before your change, but this is the first time I've looked at the file.

Also, looking at Launchpad's tree view, the file mode is 0644 (-rw-r--r--), but it should be 0755 (-rwxr-xr-x) since it's meant to be executed.

review: Needs Fixing
Revision history for this message
Andrew Johnson (anj) wrote :

I will change the file permissions to be 0755, but since the arguments to EpicsHostArch.pl should never contain spaces there is no real difference between $* and "$@" here. If anything using $* is slightly safer since the final target name would get a '-' instead of any spaces, but the right place to remove spaces would actually be in the Perl script, and either way I don't think anyone is ever likely to hit this problem.

See https://unix.stackexchange.com/questions/41571/what-is-the-difference-between-and for a nice description of how $* and "$@" differ.

Revision history for this message
J. Lewis Muir (jlmuir) wrote :

I certainly agree it's unlikely that anyone will hit the problem, but from the POV of just wanting to write correct and portable code, I still think the correct form is "$@". We probably just disagree here. If I pass an argument that contains spaces, I've done that on purpose, and I don't want anything to remove them or split one argument into more than one. In this case, I don't foresee a valid argument ever containing spaces, but if the Perl script that gets exec'd wants to validate the argument, it could, but it can't if the shell script does not faithfully pass it to the Perl script.

review: Abstain

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/startup/EpicsHostArch b/startup/EpicsHostArch
2index de7f3d5..2d2dfbd 100644
3--- a/startup/EpicsHostArch
4+++ b/startup/EpicsHostArch
5@@ -11,10 +11,10 @@ EHA=EpicsHostArch.pl
6 cd "$(dirname "$0")/.."
7
8 # Perl script will be installed into lib/perl
9-[[ -f lib/perl/$EHA ]] && exec perl lib/perl/$EHA $*
10+[ -f lib/perl/$EHA ] && exec perl lib/perl/$EHA $*
11
12 # If Base hasn't been built yet, use the source Luke
13-[[ -f src/tools/$EHA ]] && exec perl src/tools/$EHA $*
14+[ -f src/tools/$EHA ] && exec perl src/tools/$EHA $*
15
16 # Die with an error message
17 echo "$0: Can't find $EHA" >&2

Subscribers

People subscribed via source and target branches