[erlang-bugs] erl_tar:add cannot alter archives

Mike Ziebeck mike@REDACTED
Tue Mar 3 18:47:31 CET 2009


Hello,

 using erl_tar:add existing tar archives cannot be
 altered. Existing file entries are dropped.

 The manual does not tell anything about that limit.
 (As it would do about e.g. module:zip)

 test code as follows:

 t() ->
    % delete file from previous tests
    file:delete( TFile="tc_01.tar"),
   
    % open, save Bin1, close
    {ok,Tar1}=erl_tar:open(TFile, [write]),
    ok=erl_tar:add(Tar1, <<"Bin1">>, "Bin1.txt",[]),
    ok=erl_tar:close(Tar1),
    % now there is an archive and in there as expected file: Bin1.txt
  
    % open, save Bin2, close
    {ok,Tar2}=erl_tar:open(TFile, [write]),
    ok=erl_tar:add(Tar2, <<"Bin2">>, "Bin2.txt",[]),
    ok=erl_tar:close(Tar2).
    % now there is an archive and in there as expected file: Bin2.txt
    % but file Bin1.txt is lost

Chears.
--mz--



More information about the erlang-bugs mailing list