Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

9907291855: Conversion from NSURL to a classic HFS path is incorrect when POSIX path contains a legal ":" character #21310

Open
openradar-mirror opened this issue Sep 18, 2019 · 0 comments

Comments

@openradar-mirror
Copy link

Description

FB7291855

When calling CFURLCopyFileSystemPath(path, 1) in order to get a HFS style path, this returns incorrect results when the path contains a folder with a colon (or slash) in its name.

I understand that this particular function is marked deprecated, but HFS paths are still needed in some parts of the OS API, e.g. when passing file refs to AppleScripts, and so this should still work correctly, at least, when needed. And I'm suspect it used to work correctly, but got broken a while ago.

How to reproduce the bug:

In Xcode, create a new "command line" project and use the attached main.m file. Run the program - it'll create a file named "FolderEndingInSlash/" inside "/tmp", when you look at the tmp folder with Finder (where ":" in a POSIX file name appears as a "/").

Then it calls CFURLCopyFileSystemPath to get the HFS path, which correctly would be:

Macintosh HD:private:tmp:FolderEndingInSlash/

However, the "/" at the end is missing.

The reason for this bug seems to be that this function calls stringByStandardizingPath afterwards, which strips the slash by mistake.

You can read more about this here: https://stackoverflow.com/a/57948775/43615

Product Version: 10.14
Created: 2019-09-18T16:13:22.113994
Originated: 18Sept19
Open Radar Link: http://www.openradar.me/9907291855

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant