info-mtools
[Top][All Lists]
Advanced

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

Re: [Info-mtools] mtools under MSYS/MSYS2


From: Tony Richardson
Subject: Re: [Info-mtools] mtools under MSYS/MSYS2
Date: Fri, 23 Feb 2018 08:43:24 -0600

On Tue, Jan 30, 2018 at 11:14 AM, Tony Richardson <address@hidden> wrote:
I am using mtools to access data in a FAT partition on a VHD disk image from Windows.

I built mtools from within cygwin and it works great.  However, the current project I am working on uses MSYS2 as a build environment and I would like to get mtools working from within MSYS2.  I was able to build the tools, but they don't work correctly.  The directory tools work and I can copy files from Windows to the disk image, but I can't use mtype to list file contents or use mcopy to copy a file from the image to Windows.  I get a "No such file or directory" error.

I want to dig into this a little more, but I thought I would ask if anyone might have an idea of where to look?

To build mtools under Windows, I had to comment out the "#define HAVE_ICONV_H 1" line from config.h after running configure.  I also had to supply an implementation for strndup in config.c.  Would not having iconv.h be the cause of the problem?

Thanks,
Tony Richardson

OK.  I dug into it a little more.  It appears that using drive letters for the FAT image is not supported by all of the utilities under MSYS, MSYS2 or native Windows.  (They work fine under cygwin which does not use drive letters.)  Specifically the tools that use the mcopy function (mcopy, mread, mtype, and mwrite) do not support the use of a drive letter (surprisingly mdel does allow the use of a drive letter).  The mcopy-based tools only work with images specified on the command line and files that use the double colon notation ("mtype -i image.vhd@@0x7e00 ::autoexec.bat" works fine).  I suppose the problem is that with a command like "mcopy a:file1 b:file2" you can't be sure which device should be read/written using the mtools FAT routines and which should be written/read using the host file system routines.  I can see that writing to an already mounted file system via the mtools FAT routines could be disastrous.

Although using the double colon notation works fine for me under MSYS2, I sure like the convenience of using drive letters associated with image files in the .mtoolsrc configuration file.  (I have several VirtualBox and qemu images with FAT partitions and I find using mtools to be the most convenient method for transferring files to/from these images (It is a lot more convenient than mounting/unmounting images using the Windows disk manager.).  I wonder if having directional mcopy tools might provide the desired level of convenience?  I am thinking of adding mcopytf (mcopy to fat) and mcopyff (mcopy from fat) commands.  Using "mcopyff a:file1 b:file2" would open a:file1 using the mtools FAT routines while opening b:file2 with the host routines.  Using mcopytf would do the opposite.  There is still risk, but it seems acceptable.  Any thoughts?

Tony

reply via email to

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