[M3devel] symlink grief?

Jay K jay.krell at cornell.edu
Fri Sep 3 12:53:51 CEST 2010


 +++ /cm3/bin/cm3  -ship -DROOT=/home/jay/dev2/cm3 +++
--- shipping from I386_LINUX ---

"/home/jay/dev2/cm3/m3-libs/m3core/I386_LINUX/.M3SHIP", line 1: quake runtime error: unable to create directory "/cm3": errno=17

--procedure--  -line-  -file---
make_dir           --  <builtin>
                    1  /home/jay/dev2/cm3/m3-libs/m3core/I386_LINUX/.M3SHIP

Fatal Error: package build failed
 *** execution of [<function _BuildGlobalFunction at 0xb7378844>, <function _ShipFunc


/cm3 is a symlink to /home/jay/cm3
They both exist.
/home/jay/cm3 is a directory.

I predict no good answers here.
 - a code base that historically used stat, that I changed to lstat.

I think maybe I should put it back to stat.
And maybe come up with new functions for fs_rmrec to use.

Wild guess... we have code like:


PROCEDURE IsDirectory (path: TEXT): BOOLEAN =
  VAR s: File.Status;
  BEGIN
    TRY
      s := FS.Status (path);
      RETURN (s.type = FS.DirectoryFileType);
    EXCEPT OSError.E =>
      RETURN FALSE;
    END;
  END IsDirectory;


Maybe the right thing is to mimic Posix and allow code like:


PROCEDURE IsDirectory (path: TEXT): BOOLEAN =
  VAR s: File.Status;
  BEGIN
    TRY
      s := FS.LinkStatus (path);
      RETURN (s.type = FS.SymblicLinkFileType);
    EXCEPT OSError.E =>
      RETURN FALSE;
    END;
  END IsDirectory;

or such?

Not sure it is needed.

Or FS.StatusNoLinkResolve? Is that clearer?

There are a few basic problems here:
  - The "Modula-3 code base" has been written I assume without symlinks in mind. ??
  - I don't have symlinks in mind, much at all, since I'm usually not on a system with them.
  I don't have a mental model of how to program with them, etc.
  Maybe some short document I can read and memorize?


 - Jay
 		 	   		  


More information about the M3devel mailing list