News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_cpcitor

iDSK clobbers existing file

Started by cpcitor, 22:14, 27 December 14

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

cpcitor

Hello,

I'm using iDSK (version 0.13 compiled from sources on Ubuntu 14.04 64 bits) to put two files on a newly created disk image.

After seeing my program crash, I realized that one file was corrupted in the DSK image.

On investigating, it appears that the insertion of the second file in the disk image clobbers 32 bytes in the first file.

This can be repoduced with the commands below.


# create a 10k file full of 'A's
yes A | dd bs=10k count=1 >a.bin
# create a small ASCII file
echo '10 print "Hello."' | dd bs=10k count=1 >b.bas

iDSK a.dsk -n -i a.bin -e 1000 -c 1000 -t 1
# now DSK is fine with first file
cp a.dsk b.dsk
iDSK b.dsk -f -i b.bas -t 0
# now a.bin is clobbered


Notice that the second file is an ascii file saved as .BAS. Firmware accepts that.


The benefit of reproducing it with repetitive file is that the corruption is easy to spot.

The following area of the dsk file was uniformly filled before b.bas is written.
Afte b.bas is written, 32 bytes are overwritten.

000015a0: 41 0a 41 0a 41 0a 41 0a 41 0a 41 0a 41 0a 41 0a  A.A.A.A.A.A.A.A.
000015b0: 41 0a 41 0a 41 0a 41 0a 41 0a 41 0a 41 0a 41 0a  A.A.A.A.A.A.A.A.
000015c0: 41 0a 41 0a 41 0a 41 0a 41 0a 41 0a 41 0a 41 0a  A.A.A.A.A.A.A.A.
000015d0: 41 0a 41 0a 41 0a 41 0a 41 0a 41 0a 41 0a 41 0a  A.A.A.A.A.A.A.A.
000015e0: e5 00 00 00 ff ff ff ff a0 f6 11 21 ff 7f 00 00  ...........!....
000015f0: ff ff ff ff 40 00 00 00 00 00 00 00 00 00 00 00  ....@...........
00001600: 41 0a 41 0a 41 0a 41 0a 41 0a 41 0a 41 0a 41 0a  A.A.A.A.A.A.A.A.
00001610: 41 0a 41 0a 41 0a 41 0a 41 0a 41 0a 41 0a 41 0a  A.A.A.A.A.A.A.A.
00001620: 41 0a 41 0a 41 0a 41 0a 41 0a 41 0a 41 0a 41 0a  A.A.A.A.A.A.A.A.
00001630: 41 0a 41 0a 41 0a 41 0a 41 0a 41 0a 41 0a 41 0a  A.A.A.A.A.A.A.A.


Is there something wrong with the arguments used to run iDSK ?
I'm suspecting a bug in iDSK.

Any hints ?

Thank you for your attention.

Any alternative to iDSK that can be compiled from sources ?
Had a CPC since 1985, currently software dev professional, including embedded systems.

I made in 2013 the first CPC cross-dev environment that auto-installs C compiler and tools: cpc-dev-tool-chain: a portable toolchain for C/ASM development targetting CPC, later forked into CPCTelera.

AMSDOS

Push'n'Pop mentions v0.15 of iDSK here if that's of any use, but that's going back to Sept 2010, it might of been updated again since then.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

cpcitor

Quote from: AMSDOS on 22:40, 27 December 14
Push'n'Pop mentions v0.15 of iDSK here if that's of any use, but that's going back to Sept 2010, it might of been updated again since then.

Thank you Amsdos. It looks like source code of 0.15 is available on Source Checkout - cpcsdk - Collection of tools for helping cross-development for .

I compared sources with 0.13 and there are some areas indeed that seemed cleaned up, though it doesn't look like bug fixing, so I'm not sure it would change anything.

Alas, it doesn't compile on my machine, complains strangely about std::hex that compiled okay on 0.13.

Thank you again.

Main.cpp: In function 'int main(int, char**)':
Main.cpp:76:31: error: invalid conversion from 'std::ios_base& (*)(std::ios_base&)' to 'std::ios& (*)(std::ios&) {aka std::basic_ios<char>& (*)(std::basic_ios<char>&)}' [-fpermissive]
                       >> std::hex     >> Option( 'e', "exec", exeAdress )
                               ^
In file included from Main.cpp:9:0:
getopt_pp.h:430:42: error:   initializing argument 1 of 'GetOpt::GetOpt_pp& GetOpt::GetOpt_pp::operator>>(std::ios& (*)(std::ios&))' [-fpermissive]
                 GETOPT_INLINE GetOpt_pp &operator >> ( std::ios & ( *iomanip )( std::ios & ) );
                                          ^
Main.cpp:78:31: error: invalid conversion from 'std::ios_base& (*)(std::ios_base&)' to 'std::ios& (*)(std::ios&) {aka std::basic_ios<char>& (*)(std::basic_ios<char>&)}' [-fpermissive]
                       >> std::dec     >> Option( 't', "type", AmsdosType )
                               ^
In file included from Main.cpp:9:0:
getopt_pp.h:430:42: error:   initializing argument 1 of 'GetOpt::GetOpt_pp& GetOpt::GetOpt_pp::operator>>(std::ios& (*)(std::ios&))' [-fpermissive]
                 GETOPT_INLINE GetOpt_pp &operator >> ( std::ios & ( *iomanip )( std::ios & ) );
                                          ^

Had a CPC since 1985, currently software dev professional, including embedded systems.

I made in 2013 the first CPC cross-dev environment that auto-installs C compiler and tools: cpc-dev-tool-chain: a portable toolchain for C/ASM development targetting CPC, later forked into CPCTelera.

AMSDOS

The Push'n'Pop thread might help:


@Devilmarkus mentions the libgcc_s_dw2-1.dll is missing and another link is provided -> http://cpcsdk.googlecode.com/files/iDSK_015.7z


Unfortunately I cannot test and am unsure if it will address the overwriting issue.


Are you using iDSK to create a new Disk Image?
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

cpcitor

Tank you for your reply. I have not tried iDSK 0.15 binary, it is for Windows. I could install Wine in one command line but it would download 300MB of 32-bit code in 96 packages. Given what I learn in the meantime about iDSK I'd rather look for a replacement.

Quote from: AMSDOS on 00:25, 28 December 14
Are you using iDSK to create a new Disk Image?

Yes, the -n switch does that.  Apparently it avoids some bugs in iDSK but I need to put 2 files on the image.

Other threads on push'n'pop mentions bugs in iDSK.

PulkoMandy - 08 June 2010 - 18:20:27 wrote on Push'n'Pop | Amstrad CPC Demoscene | Custom tools for a demo ?
QuoteI started trying to use existing tools (iDSK, cpcdsk, cpcxfs) but quickly encountered bugs.

Krusty wrote on Push'n'Pop | Amstrad CPC Demoscene | How do you crossdev code without winape ?
QuoteThe iDSK tool supposed to put my file in a DSK is bugged and corrupted the file at a certain place (very hard to find the source of the problem).
Back to current iDSK bug, I tried to work around the bug by rewriting the corrupted file. That worked, but the other file got marked "deleted". iDSK 0.13 is not reliable.
Push'n'Pop | Amstrad CPC Demoscene | How do you crossdev code without winape ? (look for SyX - 16 July 2011 - 13:12:05 ).
QuoteWell, Krusty, i think that i had the same problem with iDSK long time ago, it happened when i replaced a file in the DSK,

As a last resort I might write one, but I agree with what Pulkomandy wrote: Push'n'Pop | Amstrad CPC Demoscene | Custom tools for a demo ?
QuoteSo yes, I write stuff myself, but sharing it with other people made me spend much less time on it. In the end I can spend more time on z80 code and less on the stuff around it. Reloaded is one more step in this direction.

Regards.
Had a CPC since 1985, currently software dev professional, including embedded systems.

I made in 2013 the first CPC cross-dev environment that auto-installs C compiler and tools: cpc-dev-tool-chain: a portable toolchain for C/ASM development targetting CPC, later forked into CPCTelera.

cpcitor

I fetched cpcxfs from Kevin's download page http://cpctech.cpc-live.com/download/cpcxfs.zip .
Usage is not very well documented, but using both iDSK (for the binary with an amsdos header) and that cpcxfs (to insert the basic loader) it worked.

A quick look at source code shows that cpcxfs (which is based on an old program named cpcfs where some parts are dated from 1996) has nothing to do with cpcfs described at cpcfs - cpcsdk - Dsk image and real floppy management - Collection of tools for and available at Source Checkout - cpcsdk - Collection of tools for helping cross-development for . The latter source code seems much more modern.

Anyway, I can work on at the moment.
Had a CPC since 1985, currently software dev professional, including embedded systems.

I made in 2013 the first CPC cross-dev environment that auto-installs C compiler and tools: cpc-dev-tool-chain: a portable toolchain for C/ASM development targetting CPC, later forked into CPCTelera.

AMSDOS

I remember using "cpcfs" for extracting and adding programs, but it was for the original DSK images the earlier Emulators used (CPCEMU & CPE). The Extended DSK format (also DSK extension), was made I think to cater for software with Copy Protection, but the new format didn't work with "cpcfs", so "cpcxfs" was created, which pretty much works in the same manner as "cpcfs".
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Powered by SMFPacks Menu Editor Mod