help-octave
[Top][All Lists]
Advanced

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

Re: Problem with pkg on Intel Mac?


From: A. Scottedward Hodel
Subject: Re: Problem with pkg on Intel Mac?
Date: Sat, 1 Dec 2007 18:18:56 -0600

(formal bug report sent with bug-octave separately)

Several others have reported problems with segmentation faults when using pkg on Intel Macs. The problem on my machine (Macbook Pro, Mac OS X 10.4.11) appears to be in the save command when saving in default (text) form.

Conditions:
latest fink installation; installed octave-2.9.14, then removed so that I could install octave from CVS (2.9.17+). With that installation, here's the results. Can anyone else duplicate this problem?

octave:1> zap.real = 1
zap =
{
  real =  1
}

octave:2> zap.imag = 2;
octave:3> zap.chk{1} = rand(3)
zap =
{
  real =  1
  imag =  2
  chk =

  {
    [1,1] =

       0.89862   0.98075   0.19748
       0.50522   0.73628   0.55608
       0.34868   0.72909   0.69272

  }

}

octave:4> save jnk zap

The problem appears to be in the save command when saving in default (text) mode:
octave:1> zap.real = 1
zap =
{
  real =  1
}

octave:2> save -hdf5 jnk zap
octave:3> save jnk zap

I put several print statements in pkg.m (modified file attached) to track down the segmentation fault. The output is below. The segmentation fault (octave CVS 2.9.17+) appears to occur in the "save" command when updating ~/.octave_packages.
I was able to repeat the problem as follows:

octave:1>  pkg install -verbose general-1.0.3.tar.gz
pkg: entry
pkg::install: entry
mkdir (/var/tmp/oct-8q8L9Z)
untar (general-1.0.3.tar.gz, /var/tmp/oct-8q8L9Z)
prepare installation 1 of 1
mkoctfile SHA1.cc
mkoctfile deref.cc
mkoctfile mark_for_deletion.cc
pkg::is_architecture_dependent: exit
pkg::is_architecture_dependent: exit
pkg::is_architecture_dependent: exit
pkg::is_architecture_dependent: exit
pkg::is_architecture_dependent: exit
pkg::is_architecture_dependent: exit
pkg::is_architecture_dependent: exit
pkg::is_architecture_dependent: exit
pkg::is_architecture_dependent: exit
pkg::is_architecture_dependent: exit
copyfile /var/tmp/oct-8q8L9Z/general-1.0.3/src/SHA1.oct /var/tmp/ oct-8q8L9Z/general-1.0.3/src/deref.oct /var/tmp/oct-8q8L9Z/ge ark_for_deletion.oct /var/tmp/oct-8q8L9Z/general-1.0.3/inst/i386- apple-darwin8.11.1-api-v29
copyfile: entry
copyfile: exit
prepared installation 1 of 1
install 1 of 1
desc 1 of 1
pdir 1 of 1
copyfile: entry
copyfile: exit
copyfile: entry
copyfile: exit
copyfile: entry
copyfile: exit
copyfile: entry
copyfile: exit
copy 1 of 1
create_pkgadddel 1 of 1
and again 1 of 1
installed 1 of 1
check dir 1 of 1
checked dir 1 of 1
autoload check dir 1 of 1
autoload checked dir 1 of 1
add to package list: global_install = 0
add to package list: complement
add to package list: save_order
add to package list: save

*** local user variables:

  Prot Name            Size                     Bytes  Class
  ==== ====            ====                     =====  =====
   rwd local_list      1x31                        31  char

Total is 31 elements using 31 bytes

local_list = /Users/hodelas/.octave_packages

*** local user variables:

  Prot Name                Size                     Bytes  Class
  ==== ====                ====                     =====  =====
   rwd local_packages      1x1                        229  cell

Total is 1 element using 229 bytes

local_packages =

{
  [1,1] =
  {
    name = general
    version = 1.0.3
    date = 2007-09-25
    author = Various authors
    maintainer = The Octave Community
    title = General
    description = General tools for octave.
    categories = General
    depends =

    {
      [1,1] =
      {
        package = octave
        operator = >=
        version = 2.9.7
      }

    }

    autoload =  1
    license = GPL version 2 or later
    url = http://octave.sf.net
    dir = /Users/hodelas/octave/general-1.0.3
    archprefix = /Users/hodelas/octave/general-1.0.3
  }

}

panic: Segmentation fault -- stopping myself...
Segmentation fault


Modified pkg.m diff file:
*** /usr/local/octave/share/octave/2.9.17+/m/pkg/pkg.m Sat Dec 1 18:06:28 2007
--- pkg.m       Sat Dec  1 18:04:22 2007
***************
*** 175,180 ****
--- 175,181 ----
  ## PKG_ADD: mark_as_command pkg

  function [local_packages, global_packages] = pkg (varargin)
+   printf("pkg: entry\n"); fflush(stdout);
    ## Installation prefix (XXX: what should these be on windows?)
    persistent user_prefix = false;
    persistent prefix = -1;
***************
*** 368,376 ****
--- 369,379 ----
      otherwise
error ("you must specify a valid action for 'pkg'. See 'help pkg' for details");
    endswitch
+   printf("pkg: exit\n"); fflush(stdout);
  endfunction

function descriptions = rebuild (prefix, archprefix, list, files, auto, verbose)
+   printf("pkg::rebuild: enter\n"); fflush(stdout);
    if (isempty (files))
      [dirlist, err, msg] = readdir (prefix);
      if (err)
***************
*** 445,453 ****
--- 448,458 ----
        descriptions (dup) = [];
      endif
    endif
+   printf("pkg::rebuild: exit\n"); fflush(stdout);
  endfunction

  function build (files, handle_deps, autoload, verbose)
+   printf("pkg::build: entry\n"); fflush(stdout);
    if (length (files) < 1)
      error ("insufficient number of files");
    endif
***************
*** 482,491 ****
--- 487,498 ----
        unlink (buildlist);
      endif
    end_unwind_protect
+   printf("pkg::build: exit\n"); fflush(stdout);
  endfunction

function install (files, handle_deps, autoload, prefix, archprefix, verbose,
                  local_list, global_list, global_install)
+   printf("pkg::install: entry\n"); fflush(stdout);

# Check that the directory in prefix exist. If it doesn't: create it!
    if (! exist (prefix, "dir"))
***************
*** 643,652 ****
--- 650,661 ----
    ## Prepare each package for installation
    try
      for i = 1:length (descriptions)
+ printf("prepare installation %d of %d\n",i, length (descriptions)); fflush(stdout);
        desc = descriptions{i};
        pdir = packdirs{i};
        prepare_installation (desc, pdir);
        configure_make (desc, pdir, verbose);
+ printf("prepared installation %d of %d\n",i, length (descriptions)); fflush(stdout);
      endfor
    catch
      ## Something went wrong, delete tmpdirs
***************
*** 678,691 ****
--- 687,710 ----
    ## Install each package
    try
      for i = 1:length (descriptions)
+ printf("install %d of %d\n",i, length(descriptions)); fflush (stdout);
        desc = descriptions{i};
+ printf("desc %d of %d\n",i, length(descriptions)); fflush (stdout);
        pdir = packdirs{i};
+ printf("pdir %d of %d\n",i, length(descriptions)); fflush (stdout);
        copy_files (desc, pdir, global_install);
+ printf("copy %d of %d\n",i, length(descriptions)); fflush (stdout);
        create_pkgadddel (desc, pdir, "PKG_ADD", global_install);
+ printf("create_pkgadddel %d of %d\n",i, length (descriptions)); fflush(stdout);
        create_pkgadddel (desc, pdir, "PKG_DEL", global_install);
+ printf("and again %d of %d\n",i, length(descriptions)); fflush (stdout);
        finish_installation (desc, pdir, global_install)
+ printf("installed %d of %d\n",i, length(descriptions)); fflush (stdout);
      endfor
    catch
+     printf("uh-oh! something broke!\n");
+     lasterr()
+
      ## Something went wrong, delete tmpdirs
      for i = 1:length (tmpdirs)
        rm_rf (tmpdirs{i});
***************
*** 700,705 ****
--- 719,725 ----
    ## Check if the installed directory is empty. If it is remove it
    ## from the list
    for i = length (descriptions):-1:1
+ printf("check dir %d of %d\n",i, length(descriptions)); fflush (stdout);
      if (dirempty (descriptions{i}.dir, {"packinfo", "doc"}) &&
        dirempty (getarchdir (descriptions{i})))
        warning ("package %s is empty\n", descriptions{i}.name);
***************
*** 707,738 ****
--- 727,776 ----
        rm_rf (getarchdir (descriptions{i}));
        descriptions(i) = [];
      endif
+ printf("checked dir %d of %d\n",i, length(descriptions)); fflush (stdout);
    endfor

    ## If the package requested that it is autoloaded, or the installer
    ## requested that it is, then mark the package as autoloaded.
    for i = length (descriptions):-1:1
+ printf("autoload check dir %d of %d\n",i, length (descriptions)); fflush(stdout); if (autoload > 0 || (autoload == 0 && isautoload (descriptions (i))))
        fclose (fopen (fullfile (descriptions{i}.dir, "packinfo",
                               ".autoload"), "wt"));
        descriptions{i}.autoload = 1;
      endif
+ printf("autoload checked dir %d of %d\n",i, length (descriptions)); fflush(stdout);
    endfor

    ## Add the packages to the package list
    try
+ printf("add to package list: global_install = %d \n",global_install); fflush(stdout);
      if (global_install)
idx = complement (packages_to_uninstall, 1:length (global_packages)); global_packages = save_order ({global_packages{idx}, descriptions{:}});
        save (global_list, "global_packages");
        installed_pkgs_lst = {local_packages{:}, global_packages{:}};
      else
+     printf("add to package list: complement\n"); fflush(stdout);
idx = complement (packages_to_uninstall, 1:length (local_packages));
+     printf("add to package list: save_order\n"); fflush(stdout);
local_packages = save_order ({local_packages{idx}, descriptions{:}});
+     printf("add to package list: save\n"); fflush(stdout);
+       whos local_list
+       fflush(stdout);
+       local_list
+       fflush(stdout);
+       whos local_packages
+       fflush(stdout);
+       local_packages
+       fflush(stdout);
        save (local_list, "local_packages");
+     printf("add to package list: installed list\n"); fflush(stdout);
        installed_pkgs_lst = {local_packages{:}, global_packages{:}};
+     printf("added to package list: \n"); fflush(stdout);
      endif
    catch
+     printf("on no! %s \n",  lasterr()); fflush(stdout);
      ## Something went wrong, delete tmpdirs
      for i = 1:length (tmpdirs)
        rm_rf (tmpdirs{i});
***************
*** 746,751 ****
--- 784,790 ----
        printf ("error: couldn't append to %s\n", local_list);
      endif
      rethrow (lasterror ());
+ printf("added to package list: global_install = %d \n",global_install); fflush(stdout);
    end_try_catch

    ## All is well, let's clean up
***************
*** 774,783 ****
--- 813,824 ----
load_packages_and_dependencies (idx, handle_deps, installed_pkgs_lst,
                                    global_install);
    endif
+   printf("pkg::install: exit\n"); fflush(stdout);
  endfunction

  function uninstall (pkgnames, handle_deps, verbose, local_list,
                    global_list, global_install)
+   printf("pkg::uninstall: entry\n"); fflush(stdout);
    ## Get the list of installed packages
    [local_packages, global_packages] = installed_packages(local_list,
                                                         global_list);
***************
*** 898,903 ****
--- 939,945 ----
      endif
    endif

+   printf("pkg::uninstall: exit\n"); fflush(stdout);
  endfunction

  ##########################################################
***************
*** 2053,2058 ****
--- 2095,2101 ----
  endfunction

function idx = load_package_dirs (lidx, idx, handle_deps, installed_pkgs_lst)
+   printf("pkg::load_package_dir: exit\n"); fflush(stdout);
    for i = lidx
      if (isfield (installed_pkgs_lst{i}, "loaded") &&
        installed_pkgs_lst{i}.loaded)
***************
*** 2080,2088 ****
--- 2123,2134 ----
        endif
      endif
    endfor
+   printf("pkg::load_package_dir: exit\n"); fflush(stdout);
+   printf("pkg::install: exit\n"); fflush(stdout);
  endfunction

  function dep = is_architecture_dependent (nm)
+   printf("pkg::is_architecture_dependent: exit\n"); fflush(stdout);
persistent archdepsuffix = {".oct",".mex",".a",".so",".so.*",".dll","dylib"};

    dep = false;
***************
*** 2103,2106 ****
--- 2149,2153 ----
        break;
      endif
    endfor
+   printf("pkg::is_architecture_dependent: exit\n"); fflush(stdout);
  endfunction



reply via email to

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