[Magic-dev] Re: Some notes on Magic 7.4

R. Timothy Edwards tim.edwards at multigig.com
Sat Mar 11 23:34:54 EST 2006


Dear Eric,

> I am using the magic-7.4.6 on windows XP with cygwin, and in the cygwin terminal,
> the following line appears after quitting magic:
> 
> $ magic4 icb
> icb.mag: Function not implemented
> pfetwcapc.mag: Function not implemented
> nfetwcapc.mag: Function not implemented
> rename: Permission denied
> 
> The first 3 lines seem to related to the expand cell action (key x), since icb contains pfetwcapc and nfetwcapc. 
> And it fails to overwrite the original file if I tried to modify it, so the last line must be that.  In 7.3, the
> rename permission denied ONLY happens when I save the second time. i.e., I load a file, fix something and save,
> it's ok. And then, I fix something more, and save, then permission denied.  But now, with 7.4, I get the error
> even the first time I fix something.  I have searched internet about this issue, and windows permission to the
> file includes everyone and myself.

I suspect the problem is in part Cygwin's, in its implementation of Unix
system functions.

I have not yet compiled version 7.4 under Cygwin, so you are probably
encountering these issues for the first time.

When you expand the cell, you load its contents from the file.  The
difference in 7.4 is that it uses fcntl() calls to place an advisory
lock on the file.  This function likely has no counterpart in Windows,
so I suspect the fcntl() call is what produces the "Function not
implemented".  The way to disable this is to undefine FILE_LOCKS
using "configure --disable-locking", although it looks like I will
want to disable this by default for Cygwin.

The "rename" error is due to magic's way of saving files.  To prevent
a file from being wiped out if a fatal crash occurs while writing a
file, magic first writes to a temporary file name, then renames it to
the same name as the original.  The temporary file is probably the
one that has the incorrect permissions, and you don't see it because
it exists for only a fraction of a second.  I would be very suspicious
of database/DBio.c lines 2306 to 2327, some of which is very specific
to UNIX systems.  In particular, the mkstemp() function under UNIX
generates a file with permissions 0600.  It may correct the error
to move the code in DBio.c lines 2323-2325 up to line 2288 (and
change "expandname" to "tmpname" in chmod(), so that it fixes the
permissions on the temporary file itself).  Try this and let me know
if it works.

					Regards,
					Tim

+--------------------------------+-------------------------------------+
| Dr. R. Timothy Edwards (Tim)   | email: tim.edwards at multigig.com     |
| MultiGiG, Inc.                 | web:   http://www.multigig.com      |
| 100 Enterprise Way, Suite A-3  | phone: (831) 621-3283               |
| Scotts Valley, CA 95066        | cell:  (240) 401-0616               |
+--------------------------------+-------------------------------------+



More information about the magic-dev mailing list