[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #53695] tar.m is incompatible with BSD tar

From: Mike Miller
Subject: [Octave-bug-tracker] [bug #53695] tar.m is incompatible with BSD tar
Date: Wed, 18 Apr 2018 18:49:20 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0


                 Summary: tar.m is incompatible with BSD tar
                 Project: GNU Octave
            Submitted by: mtmiller
            Submitted on: Wed 18 Apr 2018 03:49:19 PM PDT
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: Confirmed
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: BSD



The tar.m function only works with the output of GNU tar, in particular when
parsing the output of the program to return a list of files.

This can be tested and worked on easily enough on a GNU system by installing
the 'bsdtar' package and changing the function to invoke 'bsdtar'

Ideally the tar.m function (and other functions that call tar) can be made to
work with all variants of the tar utility.

With bsdtar on Debian:

>> test tar.m
a dir2
a dir2/file2
a file1
***** test
 ## test tar together with untar
 orig_dir = pwd ();
   dirname = tarname = outdir = "";
   dirname = tempname ();
   assert (mkdir (dirname));
   chdir (dirname);
   dirname2 = "dir2";
   assert (mkdir (dirname2));
   fname1 = "file1";
   fname2 = fullfile (dirname2, "file2");
   fid = fopen (fname1, "wt");
   assert (fid >= 0);
   fdisp (fid, "Hello World");
   fclose (fid);
   fid = fopen (fname2, "wt");
   assert (fid >= 0);
   fdisp (fid, "Goodbye World");
   fclose (fid);
   tarname = [tempname() ".tar"];
   filelist = tar (tarname, {dirname2, fname1});
   if (! strcmp (filelist{3}, fname1))
     error ("tar file contents does not match expected file");
   if (! exist (tarname, "file"))
     error ("tar archive file cannot be found!");
   outdir = tempname;
   untar (tarname, outdir);
   fid = fopen (fullfile (outdir, fname1), "rt");
   assert (fid >= 0);
   str = fgetl (fid);
   fclose (fid);
   assert (str, "Hello World");
   fid = fopen (fullfile (outdir, fname2), "rt");
   assert (fid >= 0);
   str = fgetl (fid);
   fclose (fid);
   assert (str, "Goodbye World");
   chdir (orig_dir);
   unlink (tarname);
   confirm_recursive_rmdir (false, "local");
   if (exist (dirname))
     rmdir (dirname, "s");
   if (exist (outdir))
     rmdir (outdir, "s");
!!!!! test failed
filelist(3): out of bound 0

Two key differences, the '-v' output goes to stderr, and each line starts with
a prefix of 'a' before the file name.

Confirmed test failure with the buildbot workers running on macOS.


Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]