Two SAE-related bugs in R9B

Julian Fondren <>
Thu Nov 7 19:22:35 CET 2002


(Where should I send such reports in the future, if not to this list?)

1. elink creates scripts with "#!/usr/bin/env beam_evm", where
   /usr/bin/env looks for beam_evm my $PATH, for which the R9B
   installation had neither provision nor warning.  Three fixes:

     * warn that PATH needs to be extended
     * install a symlink to beam_evm with the other symlinks
     * hardcode the path "#! /usr/local/lib/erlang/.../beam_evm";
       this solution breaks across moves to newer versions of
       Erlang/OTP.

2. is_script/1 of $ERL_TOP/erts/boot/src/elink.erl tries to match
   {ok,F} and then {ok,eisdir}; probably it should match
   {error,eisdir} instead of the latter.

   (Incidentally, is_script/1 is only trivially different from a
   function of the same name that I've written.  I wonder if this
   a commonly-invented wheel?)

--- also, here is a 'hello world' for escript/(ecc/elink)

% USAGE
%
%   shell% escript hello.erl
%
% main/1 is applied to a list of any arguments given after
% ``hello.erl''.
%
%   shell% ecc hello.erl
%   shell% elink -t unix -d -o hello -S hello -m hello.beam
%   shell% ./hello
%
% start/1 is applied to the list of binaries [Unknown|Args], where the
% first element of Args is the invocation (here, "./hello"); I've no
% clue what Unknown is -- except that it doesn't appear to be the
% binary data in hello, or beam_evm.
%
% Beware: the process of either usage will die silently on an error.
-module(hello).
-export([start/1, main/1]).

main(Args) ->
    io:format("Arguments: ~p\n", [Args]),
    hello().
    % no halt()

start([_,Self|Args]) ->
    io:format("Called as: ~s\n"
              "Arguments: ~p\n",
              [binary_to_list(Self), lists:map(fun binary_to_list/1, 
Args)]),
    hello(),
    halt().

% alternate definition:
%  start([_,_|Args]) ->
%      main(lists:map(fun binary_to_list/1, Args)), halt().

hello() ->
    io:format("Hello, world!\n").


_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. 
http://join.msn.com/?page=features/virus




More information about the erlang-questions mailing list