Skip to content

fsys: resolve symlinks on Unix platforms#4626

Closed
liushuyu wants to merge 1 commit intofontforge:masterfrom
liushuyu:master
Closed

fsys: resolve symlinks on Unix platforms#4626
liushuyu wants to merge 1 commit intofontforge:masterfrom
liushuyu:master

Conversation

@liushuyu
Copy link
Copy Markdown

@liushuyu liushuyu commented Feb 10, 2021

This will make fontforge resolve the symbolic links on the Unix platforms when loading its assets.

This resolves the issue where if fontforge is invoked through symlink, it will not be able to load the resources.

Type of change

  • Non-breaking change

This change is Reviewable

Comment thread gutils/fsys.c Outdated
Copy link
Copy Markdown
Contributor

@skef skef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems fine to me. Anyone else have concerns?

@jtanx
Copy link
Copy Markdown
Contributor

jtanx commented Feb 10, 2021

Can you explain a full example? imo if you want to resolve symlinks this should be done on the path to the fontforge binary itself instead of the folder containing fontforge (like there is a potential difference resolving /a/b/c vs /a/b/c/fontforge).

@liushuyu
Copy link
Copy Markdown
Author

Can you explain a full example? imo if you want to resolve symlinks this should be done on the path to the fontforge binary itself instead of the folder containing fontforge (like there is a potential difference resolving /a/b/c vs /a/b/c/fontforge).

This could happen in many Linux distro where /bin/ is a symlink to /usr/bin. The fontforge will look for resource files in /share in this case, which is incorrect. This fix will hopefully resolve such issue.

Regarding your concern with the path resolution, I will change my patch to resolve the path to the binary.

@jtanx
Copy link
Copy Markdown
Contributor

jtanx commented Feb 12, 2021

Which distro is this? Sounds more like a problem that if you symlink /bin to /usr/bin, then so too should /share to /usr/share

Comment thread gutils/fsys.c
Comment on lines +556 to +559
if ( (buf = realpath(program_dir, NULL)) ) {
free(program_dir);
program_dir = buf;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whitespace is misaligned.

@frank-trampe
Copy link
Copy Markdown
Contributor

@liushuyu, just pinging regarding what @jtanx said.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants