Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recursive ADDFOLDER dies with malloc error #35

Open
apple2geek opened this issue Dec 18, 2020 · 3 comments
Open

Recursive ADDFOLDER dies with malloc error #35

apple2geek opened this issue Dec 18, 2020 · 3 comments

Comments

@apple2geek
Copy link

I was relocating the contents of a large image to a smaller image. I began by extracting the contents of the larger image recursively, which worked:

block:A2.DESKTOP apple2geek$ cadius EXTRACTFOLDER ../A2DeskTop.po /A2.DESKTOP/DESK.ACC/ .
cadius v 1.4.4 (c) Brutal Deluxe 2011-2013.
  - Extract folder '/A2.DESKTOP/DESK.ACC/' :
      o Extract File   : /A2.DESKTOP/DESK.ACC/CALCULATOR
CALCULATOR=Type(F1),AuxType(0640),VersionCreate(00),MinVersion(00),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)
      o Extract File   : /A2.DESKTOP/DESK.ACC/EYES
EYES=Type(F1),AuxType(0640),VersionCreate(00),MinVersion(00),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)
      o Extract File   : /A2.DESKTOP/DESK.ACC/FIND.FILES
FIND.FILES=Type(F1),AuxType(0640),VersionCreate(00),MinVersion(00),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)
      o Extract File   : /A2.DESKTOP/DESK.ACC/KEY.CAPS
KEY.CAPS=Type(F1),AuxType(0640),VersionCreate(00),MinVersion(00),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)
      o Extract File   : /A2.DESKTOP/DESK.ACC/PUZZLE
PUZZLE=Type(F1),AuxType(0640),VersionCreate(00),MinVersion(00),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)
      o Extract File   : /A2.DESKTOP/DESK.ACC/RUN.BASIC.HERE
RUN.BASIC.HERE=Type(F1),AuxType(0640),VersionCreate(00),MinVersion(00),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)
      o Extract File   : /A2.DESKTOP/DESK.ACC/SCREEN.DUMP
SCREEN.DUMP=Type(F1),AuxType(0640),VersionCreate(00),MinVersion(00),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)
      o Extract File   : /A2.DESKTOP/DESK.ACC/SORT.DIRECTORY
SORT.DIRECTORY=Type(F1),AuxType(0640),VersionCreate(00),MinVersion(00),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)
      o Extract File   : /A2.DESKTOP/DESK.ACC/THIS.APPLE
THIS.APPLE=Type(F1),AuxType(0640),VersionCreate(00),MinVersion(00),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)
      + Extract Folder : /A2.DESKTOP/DESK.ACC/CONTROL.PANELS
      o Extract File   : /A2.DESKTOP/DESK.ACC/CONTROL.PANELS/CONTROL.PANEL
CONTROL.PANEL=Type(F1),AuxType(0640),VersionCreate(00),MinVersion(00),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)
      o Extract File   : /A2.DESKTOP/DESK.ACC/CONTROL.PANELS/DATE
DATE=Type(F1),AuxType(0640),VersionCreate(00),MinVersion(00),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)
      o Extract File   : /A2.DESKTOP/DESK.ACC/CONTROL.PANELS/JOYSTICK
JOYSTICK=Type(F1),AuxType(0640),VersionCreate(00),MinVersion(00),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)
      o Extract File   : /A2.DESKTOP/DESK.ACC/CONTROL.PANELS/SYSTEM.SPEED
SYSTEM.SPEED=Type(F1),AuxType(0640),VersionCreate(00),MinVersion(00),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)
      + Extract Folder : /A2.DESKTOP/DESK.ACC/SCREEN.SAVERS
      o Extract File   : /A2.DESKTOP/DESK.ACC/SCREEN.SAVERS/FLYING.TOASTERS
FLYING.TOASTERS=Type(F1),AuxType(0640),VersionCreate(00),MinVersion(00),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)
      o Extract File   : /A2.DESKTOP/DESK.ACC/SCREEN.SAVERS/INVERT
INVERT=Type(F1),AuxType(0640),VersionCreate(00),MinVersion(00),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)
      o Extract File   : /A2.DESKTOP/DESK.ACC/SCREEN.SAVERS/MELT
MELT=Type(F1),AuxType(0640),VersionCreate(00),MinVersion(00),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)
    => File(s) : 16,  Folder(s) : 3,  Error(s) : 0
block:A2.DESKTOP apple2geek$
block:A2.DESKTOP apple2geek$ ls -la DESK.ACC
total 144
drwx------  14 apple2geek  staff   476 Dec 17 19:05 .
drwxr-xr-x   8 apple2geek  staff   272 Dec 17 19:06 ..
-rw-r--r--   1 apple2geek  staff  2980 Dec 25  1920 CALCULATOR#F10640
drwx------   7 apple2geek  staff   238 Dec 17 19:05 CONTROL.PANELS
-rw-r--r--   1 apple2geek  staff  1961 Dec 25  1920 EYES#F10640
-rw-r--r--   1 apple2geek  staff  3150 Dec 25  1920 FIND.FILES#F10640
-rw-r--r--   1 apple2geek  staff  2490 Dec 25  1920 KEY.CAPS#F10640
-rw-r--r--   1 apple2geek  staff  2754 Dec 25  1920 PUZZLE#F10640
-rw-r--r--   1 apple2geek  staff   465 Dec 25  1920 RUN.BASIC.HERE#F10640
-rw-r--r--   1 apple2geek  staff   345 Dec 25  1920 SCREEN.DUMP#F10640
drwx------   6 apple2geek  staff   204 Dec 17 19:05 SCREEN.SAVERS
-rw-r--r--   1 apple2geek  staff  1157 Dec 25  1920 SORT.DIRECTORY#F10640
-rw-r--r--   1 apple2geek  staff  4356 Dec 25  1920 THIS.APPLE#F10640
-rw-r--r--   1 apple2geek  staff     0 Dec 17 19:05 _FileInformation.txt
block:A2.DESKTOP apple2geek$

Then attempted to add this folder to the smaller image, but was greeted with a malloc() error:

block:A2.DESKTOP apple2geek$ cadius ADDFOLDER ../400K.po /DESKTOP/A2.DESKTOP/ DESK.ACC
cadius v 1.4.4 (c) Brutal Deluxe 2011-2013.
  - Add folder 'DESK.ACC' :
cadius(88113,0x7fff796a4000) malloc: *** error for object 0x7f99a0c041a8: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6
block:A2.DESKTOP apple2geek$

I was able to successfully add the contents by using CREATEFOLDER and multiple ADDFILE operations, but it took much longer and much more effort than the recursive ADDFOLDER would have.

@mach-kernel
Copy link
Owner

Thanks for the detailed report! While I try to reproduce this, see if the 1.4.5 release helps.

@apple2geek
Copy link
Author

Curious. The 1.4.5 release worked, in that it did not crash with a malloc() error, but it did NOT add the contents into the image as expected:

block:A2.DESKTOP apple2geek$ cadius ADDFOLDER ../400K.po /DESKTOP/A2.DESKTOP/ DESK.ACC
cadius v 1.4.5 (c) Brutal Deluxe 2011-2013.
  - Add folder 'DESK.ACC' :
      o Add File   : /DESKTOP/A2.DESKTOP/CALCULATOR#F10640
      o Add File   : /DESKTOP/A2.DESKTOP/CONTROL.PANELS/CONTROL.PANEL#F10640
      + Add Folder : /DESKTOP/A2.DESKTOP/CONTROL.PANELS
      o Add File   : /DESKTOP/A2.DESKTOP/CONTROL.PANELS/DATE#F10640
      o Add File   : /DESKTOP/A2.DESKTOP/CONTROL.PANELS/JOYSTICK#F10640
      o Add File   : /DESKTOP/A2.DESKTOP/CONTROL.PANELS/SYSTEM.SPEED#F10640
      o Add File   : /DESKTOP/A2.DESKTOP/EYES#F10640
      o Add File   : /DESKTOP/A2.DESKTOP/FIND.FILES#F10640
      o Add File   : /DESKTOP/A2.DESKTOP/KEY.CAPS#F10640
      o Add File   : /DESKTOP/A2.DESKTOP/PUZZLE#F10640
      o Add File   : /DESKTOP/A2.DESKTOP/RUN.BASIC.HERE#F10640
      o Add File   : /DESKTOP/A2.DESKTOP/SCREEN.DUMP#F10640
      o Add File   : /DESKTOP/A2.DESKTOP/SCREEN.SAVERS/FLYING.TOASTERS#F10640
      + Add Folder : /DESKTOP/A2.DESKTOP/SCREEN.SAVERS
      o Add File   : /DESKTOP/A2.DESKTOP/SCREEN.SAVERS/INVERT#F10640
      o Add File   : /DESKTOP/A2.DESKTOP/SCREEN.SAVERS/MELT#F10640
      o Add File   : /DESKTOP/A2.DESKTOP/SORT.DIRECTORY#F10640
      o Add File   : /DESKTOP/A2.DESKTOP/THIS.APPLE#F10640
    => File(s) : 16,  Folder(s) : 2,  Error(s) : 0

This resulted in:

block:A2.DESKTOP apple2geek$ cadius catalog ../400K.po
cadius v 1.4.5 (c) Brutal Deluxe 2011-2013.
  - Catalog volume '../400K.po'
  Name                  Type   Aux      Size     Data     Res  Data   Res  Sparse Index  Struct  Access    Creation Date     Modification Date
/DESKTOP/
  BASIC.SYS             SYS   $0000    10240    10240       0    20    0      0     1     Sapl   R B      00-???-2000 00:00   00-???-2000 00:00
  PRODOS                SYS   $0000    17128    17128       0    34    0      0     1     Sapl   R B      00-???-2000 00:00   00-???-2000 00:00
  /A2.DESKTOP/
    CALCULATOR          $F1   $0640     2980     2980       0     6    0      0     1     Sapl   RWBND    31-Dec-2069 17:00   31-Dec-2069 17:00
    DESKTOP.SYSTEM      SYS   $0000     8192     8192       0    12    0      4     1     Sapl   RWBND    25-Dec-2020 18:03   25-Dec-2020 18:03
    DESKTOP2            $F1   $0000   114400   114400       0   216    0      8     1     Sapl   RWBND    25-Dec-2020 18:03   25-Dec-2020 18:03
    EYES                $F1   $0640     1961     1961       0     4    0      0     1     Sapl   RWBND    31-Dec-2069 17:00   31-Dec-2069 17:00
    FIND.FILES          $F1   $0640     3150     3150       0     7    0      0     1     Sapl   RWBND    31-Dec-2069 17:00   31-Dec-2069 17:00
    KEY.CAPS            $F1   $0640     2490     2490       0     5    0      0     1     Sapl   RWBND    31-Dec-2069 17:00   31-Dec-2069 17:00
    PUZZLE              $F1   $0640     2754     2754       0     6    0      0     1     Sapl   RWBND    31-Dec-2069 17:00   31-Dec-2069 17:00
    RUN.BASIC.HERE      $F1   $0640      465      465       0     1    0      0     0     Seed   RWBND    31-Dec-2069 17:00   31-Dec-2069 17:00
    SCREEN.DUMP         $F1   $0640      345      345       0     1    0      0     0     Seed   RWBND    31-Dec-2069 17:00   31-Dec-2069 17:00
    SORT.DIRECTORY      $F1   $0640     1157     1157       0     3    0      0     1     Sapl   RWBND    31-Dec-2069 17:00   31-Dec-2069 17:00
    THIS.APPLE          $F1   $0640     4356     4356       0     9    0      0     1     Sapl   RWBND    31-Dec-2069 17:00   31-Dec-2069 17:00
    /CONTROL.PANELS/
      CONTROL.PANEL     $F1   $0640     4783     4783       0    10    0      0     1     Sapl   RWBND    31-Dec-2069 17:00   31-Dec-2069 17:00
      DATE              $F1   $0640     1859     1859       0     4    0      0     1     Sapl   RWBND    31-Dec-2069 17:00   31-Dec-2069 17:00
      JOYSTICK          $F1   $0640     1091     1091       0     3    0      0     1     Sapl   RWBND    31-Dec-2069 17:00   31-Dec-2069 17:00
      SYSTEM.SPEED      $F1   $0640     1076     1076       0     3    0      0     1     Sapl   RWBND    31-Dec-2069 17:00   31-Dec-2069 17:00
    /OPTIONAL/
      SELECTOR          $F1   $0000    39776    39776       0    77    0      1     1     Sapl   RWBND    25-Dec-2020 18:03   25-Dec-2020 18:03
    /PREVIEW/
      SHOW.FONT.FILE    $F1   $0640     1046     1046       0     3    0      0     1     Sapl   RWBND    31-Dec-2069 17:00   31-Dec-2069 17:00
      SHOW.IMAGE.FILE   $F1   $0640     2362     2362       0     5    0      0     1     Sapl   RWBND    31-Dec-2069 17:00   31-Dec-2069 17:00
      SHOW.TEXT.FILE    $F1   $0640     2393     2393       0     5    0      0     1     Sapl   RWBND    25-Dec-2020 18:03   25-Dec-2020 18:03
    /SCREEN.SAVERS/
      FLYING.TOASTERS   $F1   $0640     1569     1569       0     4    0      0     1     Sapl   RWBND    31-Dec-2069 17:00   31-Dec-2069 17:00
      INVERT            $F1   $0640      176      176       0     1    0      0     0     Seed   RWBND    31-Dec-2069 17:00   31-Dec-2069 17:00
      MELT              $F1   $0640      705      705       0     2    0      0     1     Sapl   RWBND    31-Dec-2069 17:00   31-Dec-2069 17:00
              Block : 800     Free : 325     File : 24     Directory : 5

When I was expecting the "ADD"ed (local) directory to come along for the ride.
The parent DESK.ACC folder/directory was completely lost/discarded. This was the EXPECTED result:

  - Catalog volume '400K.po'
  Name                    Type   Aux      Size     Data     Res  Data   Res  Sparse Index  Struct  Access    Creation Date     Modification Date
/DESKTOP/
  BASIC.SYS               SYS   $0000    10240    10240       0    20    0      0     1     Sapl   R B      00-???-2000 00:00   00-???-2000 00:00
  PRODOS                  SYS   $0000    17128    17128       0    34    0      0     1     Sapl   R B      00-???-2000 00:00   00-???-2000 00:00
  /A2.DESKTOP/
    DESKTOP.SYSTEM        SYS   $0000     8192     8192       0    12    0      4     1     Sapl   RWBND    25-Dec-2020 18:03   25-Dec-2020 18:03
    DESKTOP2              $F1   $0000   114400   114400       0   216    0      8     1     Sapl   RWBND    25-Dec-2020 18:03   25-Dec-2020 18:03
    /DESK.ACC/
      CALCULATOR          $F1   $0640     2980     2980       0     6    0      0     1     Sapl   RWBND    25-Dec-2020 18:03   25-Dec-2020 18:03
      EYES                $F1   $0640     1961     1961       0     4    0      0     1     Sapl   RWBND    25-Dec-2020 18:03   25-Dec-2020 18:03
      FIND.FILES          $F1   $0640     3150     3150       0     7    0      0     1     Sapl   RWBND    25-Dec-2020 18:03   25-Dec-2020 18:03
      KEY.CAPS            $F1   $0640     2490     2490       0     5    0      0     1     Sapl   RWBND    25-Dec-2020 18:03   25-Dec-2020 18:03
      PUZZLE              $F1   $0640     2754     2754       0     6    0      0     1     Sapl   RWBND    25-Dec-2020 18:03   25-Dec-2020 18:03
      RUN.BASIC.HERE      $F1   $0640      465      465       0     1    0      0     0     Seed   RWBND    25-Dec-2020 18:03   25-Dec-2020 18:03
      SCREEN.DUMP         $F1   $0640      345      345       0     1    0      0     0     Seed   RWBND    25-Dec-2020 18:03   25-Dec-2020 18:03
      SORT.DIRECTORY      $F1   $0640     1157     1157       0     3    0      0     1     Sapl   RWBND    25-Dec-2020 18:03   25-Dec-2020 18:03
      THIS.APPLE          $F1   $0640     4356     4356       0     9    0      0     1     Sapl   RWBND    25-Dec-2020 18:03   25-Dec-2020 18:03
      /CONTROL.PANELS/
        CONTROL.PANEL     $F1   $0640     4783     4783       0    10    0      0     1     Sapl   RWBND    25-Dec-2020 18:03   25-Dec-2020 18:03
        DATE              $F1   $0640     1859     1859       0     4    0      0     1     Sapl   RWBND    25-Dec-2020 18:03   25-Dec-2020 18:03
        JOYSTICK          $F1   $0640     1091     1091       0     3    0      0     1     Sapl   RWBND    25-Dec-2020 18:03   25-Dec-2020 18:03
        SYSTEM.SPEED      $F1   $0640     1076     1076       0     3    0      0     1     Sapl   RWBND    25-Dec-2020 18:03   25-Dec-2020 18:03
      /SCREEN.SAVERS/
        FLYING.TOASTERS   $F1   $0640     1569     1569       0     4    0      0     1     Sapl   RWBND    25-Dec-2020 18:03   25-Dec-2020 18:03
        INVERT            $F1   $0640      176      176       0     1    0      0     0     Seed   RWBND    25-Dec-2020 18:03   25-Dec-2020 18:03
        MELT              $F1   $0640      705      705       0     2    0      0     1     Sapl   RWBND    25-Dec-2020 18:03   25-Dec-2020 18:03
    /OPTIONAL/
      SELECTOR            $F1   $0000    39776    39776       0    77    0      1     1     Sapl   RWBND    25-Dec-2020 18:03   25-Dec-2020 18:03
    /PREVIEW/
      SHOW.FONT.FILE      $F1   $0640     1046     1046       0     3    0      0     1     Sapl   RWBND    31-Dec-2069 17:00   31-Dec-2069 17:00
      SHOW.IMAGE.FILE     $F1   $0640     2362     2362       0     5    0      0     1     Sapl   RWBND    31-Dec-2069 17:00   31-Dec-2069 17:00
      SHOW.TEXT.FILE      $F1   $0640     2393     2393       0     5    0      0     1     Sapl   RWBND    25-Dec-2020 18:03   25-Dec-2020 18:03
                Block : 800     Free : 325     File : 24     Directory : 6

Open a separate issue for the ADDFOLDER behavior?

@mach-kernel
Copy link
Owner

I confirmed that the old (1.1x) Windows version exhibits the same behavior. While I agree with your expected result I am wary of changing the default behavior of the tool (i.e. it may break someone's script).

You can achieve what you want with:

ADDFOLDER ../400K.po /DESKTOP/A2.DESKTOP/DESK.ACC DESK.ACC

I am thinking we can either: make the help text more useful, add a flag to preserve the directory, or both?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants