Skip to content

pathnames.rl wrong handling of paths to other volumes #59

Description

@ryandesign

toolbox/pathnames.rl has this comment illustrating the conversions it performs:

	/*
	 * To Mac:
	 * file                -> file
	 * :directory:file     -> directory/file
	 * volume:directory    -> /volume/directory
	 * :                   -> ./
	 * ::                  -> ../
	 * :::                 -> ../../
	 *
	 * To Unix:
	 * file                -> file
	 * directory/file      -> :directory:file
	 * /volume/file        -> volume:file
	 *
	 */

First of all, the "To Mac" and "To Unix" headings are backwards, aren't they?

And for volumes, at least when "Unix" means "macOS", the conversion should be:

  • Mac to Unix:
    • volume:directory -> /Volumes/volume/directory
  • Unix to Mac:
    • /Volumes/volume/file -> volume:file

Other unices mount their volumes elsewhere.

I'm trying to use MWC68K & MWCPPC to compile a project, and in order to write a Makefile that allows out-of-source builds, some include paths and file paths have had to become absolute, so they're rather long. MWC68K & MWCPPC appear to have their own code to check whether the given paths are valid, and based on classic Mac OS rules, they're not. MWC68K & MWCPPC don't know that the directory separator in my world is "/" so it thinks I've asked it to operate on a file whose name is longer than 31 characters:

% pwd
/Volumes/Shared/long-pathname-test
% mpw MWC68K test.c
% rm test.c.o
% mpw MWC68K $PWD/test.c
### MWC68K Usage Error:
# some component of pathname is too long;
# files/directories <= 31 and full pathname <= 255;
# '/Volumes/Shared/long-pathname-test/test.c' not accepted
# errors caused tool to abort

I don't suppose there's any way for mpw to know which arguments I've passed are supposed to represent filesystem paths so that it could convert those from Unix to Mac format for me, so I've tried converting them myself. The problem then is that my files are not on the main volume but on a separate volume called "Shared". The Unix path to the Shared volume on macOS is "/Volumes/Shared". The Mac OS path to that volume is "Shared:". We can confirm that using AppleScript:

% osascript -e 'POSIX file "/Volumes/Shared" as text' 
Shared:

Here's therefore what I've tried and the result:

% mpw MWC68K $(osascript -e "POSIX file \"$PWD/test.c\" as text")       
### MWC68K OS Error:
# can't resolve file path for 'Shared:long-pathname-test:test.c'
# OS error -41 (Error message file not available)
# errors caused tool to abort

What does work, but shouldn't, is:

% mpw MWC68K Volumes:$(osascript -e "POSIX file \"$PWD/test.c\" as text")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions