Menu

#2216 c1541 should extract all available data properly

v3.x
open
nobody
None
c1541
2026-03-19
2026-03-17
SlagDog
No

The attached disk image contains an intentionally broken second file with the 2nd sector linking back to the first sector.

c1541 "Sex Show 8_cycled.d64" -extract

OPENCBM: sucessfully loaded libopencbm.so
D64 disk image recognised: Sex Show 8_cycled.d64, 35 tracks.
Unit 8 drive 0: D64 disk image attached: Sex Show 8_cycled.d64.
Error: trying to extract more data than image can contain (174848), possibly a
cyclic T/S chain in file 'fucking people 1', aborting.
floppy write failed
Unit 8 drive 0: D64 disk image detached: Sex Show 8_cycled.d64.

", aborting."
Why? There are quite some files left which would properly extract.
This applies to all image formats of course.

1 Attachments

Discussion

  • gpz

    gpz - 2026-03-18

    Please test

    Index: src/c1541.c
    ===================================================================
    --- src/c1541.c (Revision 46028)
    +++ src/c1541.c (Arbeitskopie)
    @@ -2883,7 +2883,7 @@
         disk_image_t *disk_image;
         unsigned int disk_type;
         size_t disk_size;
    
    -    size_t total_written;
    +    size_t file_written;
         uint8_t *buf, *str;
         unsigned int channel = 2;
         char *p00_name = NULL;
    @@ -2929,7 +2929,7 @@
         track = floppy->Dir_Track;
         sector = floppy->Dir_Sector;
    
    
    -    total_written = 0;
    +    file_written = 0;
         while (1) {
             int i, res;
    
    @@ -2948,6 +2948,8 @@
             for (i = 0; i < 256; i += SLOT_SIZE) {
                 uint8_t file_type = buf[i + SLOT_TYPE_OFFSET];
    
    
    +            file_written = 0;
    +
                 if (((file_type & 7) == CBMDOS_FT_SEQ
                             || (file_type & 7) == CBMDOS_FT_PRG
                             || (file_type & 7) == CBMDOS_FT_USR)
    @@ -3071,28 +3073,23 @@
                         }
                         do {
                             /* guard against cyclic blocks */
    -                        if (total_written < disk_size) {
    +                        if (file_written < disk_size) {
                                 status = vdrive_iec_read(floppy, &c, 0);
                                 fputc(c, fd);
    -                            total_written++;
    +                            file_written++;
                             } else {
                                 fprintf(stderr,
                                         "Error: trying to extract more data than"
                                         " image can contain (%zu), possibly a\n"
    -                                    "       cyclic T/S chain in file '%s',"
    -                                    " aborting.\n",
    +                                    "       cyclic T/S chain in file '%s'.\n",
                                         disk_size, name);
    -                            fclose(fd);
    -                            if (p00_name != NULL) {
    -                                lib_free(p00_name);
    -                            }
    -                            vdrive_iec_close(floppy, channel);
    -                            return FD_WRTERR;
    +                            break;
                             }
                         } while (status == SERIAL_OK);
                     }
                     if (p00_name != NULL) {
                         lib_free(p00_name);
    +                    p00_name = NULL;
                     }
    
                     vdrive_iec_close(floppy, 0);
    
     
    • Querino

      Querino - 2026-03-19

      Maybe the OP don't compile himself, i did a quich test.

      c1541 "Sex Show 8_cycled.d64" -extract

      sex show eight
      fucking people 1
      Error: trying to extract more data than image can contain (174848), possibly a
      cyclic T/S chain in file 'fucking people 1'.
      fucking people 2
      fucking people 3
      fucking people 5
      fucking people 6
      fucking people 7
      fucking people 8
      fucking people 9
      fucking people a
      fucking people b
      fucking people c
      fucking people d
      fucking people e
      fucking people f
      fucking people g
      fucking people h
      fucking people i
      fucking people j
      fucking people k
      fucking people l
      fucking people m
      fucking people n
      fucking people o
      fucking people p
      fucking people r
      fucking people s
      nude 1
      nude 2

      Then the same with SEXSHOW8.D64

      c1541 "SEXSHOW8.D64" -extract

      sex show eight
      nude 1
      nude 2
      fucking people 1
      fucking people 2
      fucking people 3
      fucking people 5
      fucking people 6
      fucking people 7
      fucking people 8
      fucking people 9
      fucking people a
      fucking people b
      fucking people c
      fucking people d
      fucking people e
      fucking people f
      fucking people g
      fucking people h
      fucking people i
      fucking people j
      fucking people k
      fucking people l
      fucking people m
      fucking people n
      fucking people o
      fucking people p
      fucking people r
      fucking people s

      Now compared all the extracted files. All identical, except fucking people 1 (obviously).

       
  • SlagDog

    SlagDog - 2026-03-19

    Obviously you tested against the patched version, Querino?
    I DO compile myself and after the recent patch can confirm the issue is resolved.
    OP out :)

     

Log in to post a comment.

MongoDB Logo MongoDB