Symbolic links for everybody!

With a bit of free time on my hands, I started to apply a couple tricks I’d learned, and write a checkout and build Python script for my “unstable” Verbosio code – specifically the template editing system I’m still trying to get working.

One of the challenges is in making sure edits propagate both upstream into the Mercurial repository and downstream into the Firefox test builds. Since the code I’m working on starts two subdirectories deep in the repository, and ends up a different three subdirectories deep in the Mozilla source code, it gets tricky. Unless you use symbolic links.

Now, if you’re on Linux or Macintosh, you have a built-in symbolic link command already: ln -s (source) (target). Windows users… well, if you’re on Windows 7 or Vista, and using the newer filesystem (not NTFS), you also have a built-in symbolic link command: mklink /D (target) (source). If you’re on Windows before Vista, you can install an utility called “junction”, and off you go. UPDATE: Faulty statement struck per comments. Sorry about that.

On Windows and Linux, I find I only need one symbolic link: from my source repository’s desired working directory to a special folder in mozilla/extensions. On Mac, I need two: the source-to-target one, and another from target-to-inside-the-Namoroka.app-special-folder. (Otherwise, changes I make don’t show up in the Mac environment, short of rebuilding tier_app.)

Since I can’t always remember the format of these commands, a little Python takes care of the dirty work. (Oh, did you notice how Microsoft again does things in the reverse order Linux and Mac’s terminals do?) It also supports checking out the latest FIREFOX_3_6_*_RELEASE tag (handy when I don’t want to look that up either) and building the whole smash, including a few shell scripts I commonly use to run my Mochitests.

Wouldn’t it be nice if files that don’t get pre-processed were symbolically linked in at build time, until the installer was built?

I’ll blog again in a day or two, talking about hash tables in JavaScript – and why I suddenly decided to care.

6 thoughts on “Symbolic links for everybody!”

  1. On non-Windows platforms, any files in dist that can be symlinked generally are. (You can even ask to symlink your chrome, as an alternative to flat chrome.) On Windows we still copy everything, although there are plans to use hard links where possible.

  2. Win7 is still using NTFS 3.1 the same as Windows XP, it just integrated some functionalities of this fs that were not available in XP. In the case of symbolic links, as Win XP did recognize them even though it could not create them, it’s more like junction got incorporated with the OS and does not need to be downloaded separately than anything else.
    Note that since in XP there was *no* way to see if a link had been created on a file, it was probably much better to leave it only accessible to a few power users.

  3. > Windows 7 or Vista, and using the newer filesystem (not NTFS)
    > If you’re on NTFS, you can install an utility called “junction”, and off you go.
    Sorry, what?
    I’m think you mean
    “Windows 7 or Vista and using NTFS”
    and
    “If you’re on XP or earlier, and use NTFS, you can download ‘junction'”

  4. “if you’re on Windows 7 or Vista, and using the newer filesystem (not NTFS)”
    Huh?? What “newer” filesystem do Windows Vista and Windows 7 have besides NTFS?

  5. NTFS with Windows Vista and 7 support symlinks (they work like their Unix counterparts..) They’re not quite the same as NTFS junctions.
    They should work for what you expect. For XP though, junction is the fallback option, but its not about filesystem, but rather, NT version.
    http://msdn.microsoft.com/en-us/library/aa365680.aspx
    and
    http://en.wikipedia.org/wiki/NTFS_symbolic_link
    (I suppose you meant “not FAT32” and not “not NTFS” in your original post)

Comments are closed.